Skip to content

Commit

Permalink
Switch order of arguments to be pylookup(column, data_with_column, da…
Browse files Browse the repository at this point in the history
…ta_to_populate_with_column); update version
  • Loading branch information
zachbateman committed Jul 29, 2021
1 parent 27c6cf2 commit 532443d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ pip install pylookup
# Command Line Interface Usage

- To add and populate the "COLUMN" column in "excel_to_populate" from the data in "excel_with_column",
simple run the following command. This currently works for .xlsx (Excel) files and .csv files.
simply run the following command. This currently works for .xlsx (Excel) files and .csv files.

```
pylookup COLUMN excel_to_populate.xlsx excel_with_column.xlsx
pylookup COLUMN excel_with_column.xlsx excel_to_populate.xlsx
```


Expand Down
4 changes: 2 additions & 2 deletions pylookup/pylookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



def pylookup(column_to_fill: str, main_table, reference_table, *args, force_name: bool=False, main_cols_for_matching=None, inplace=False, **kwargs) -> Union[None, pandas.DataFrame]:
def pylookup(column_to_fill: str, reference_table, main_table, *args, force_name: bool=False, main_cols_for_matching=None, inplace=False, **kwargs) -> Union[None, pandas.DataFrame]:
'''
Main function that handles filling a column of the "main_table" arg
based on data matched from the "reference_table" arg.
Expand Down Expand Up @@ -161,7 +161,7 @@ def file_lookup(column_to_fill, main_file, reference_file) -> None:
print('Error! Reference file must be .csv or .xlsx!')


pylookup(column_to_fill, main_df, ref_df, inplace=True)
pylookup(column_to_fill, ref_df, main_df, inplace=True)

if '.xl' in main_file:
main_df.to_excel(main_file, index=False)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rapidfuzz>=0.13.0
pandas>=1.0.0
click>=6.7
click>=8.0.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

setuptools.setup(
name='PyLookup',
version='0.1.3',
version='0.2.0',
packages=['pylookup'],
license='MIT',
author='Zach Bateman',
description='PyLookup - Fuzzy-matching table autofill tool',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/zachbateman/pylookup.git',
download_url='https://github.com/zachbateman/pylookup/archive/v_0.1.3.tar.gz',
download_url='https://github.com/zachbateman/pylookup/archive/v_0.2.0.tar.gz',
keywords=['LOOKUP', 'VLOOKUP', 'TABLE', 'MATCHING'],
install_requires=['rapidfuzz', 'pandas', 'click'],
classifiers=['Development Status :: 3 - Alpha',
Expand Down
4 changes: 2 additions & 2 deletions tests/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def test_add_matched_column(self):
reference = pandas.read_csv('reference_table.csv')

print(main)
main = pylookup.pylookup('TYPE', main, reference)
main = pylookup.pylookup('ANIMAL2', main, reference, force_name=True)
main = pylookup.pylookup('TYPE', reference, main)
main = pylookup.pylookup('ANIMAL2', reference, main, force_name=True)
print(main)

self.assertTrue('TYPE' in main.columns and 'ANIMAL2' in main.columns)
Expand Down

0 comments on commit 532443d

Please sign in to comment.