Open angelika233 opened 1 day ago
remove mapping_dict
from to_df()
Seems like this _apply_mapping
is actually doing 2 things: first it filters a dataframe, and then renames the columns. Eg. if we have a filter + mapping dict like this: {"my_col": "my_new_col_name"} and a df with 2 columns, "my_col" and "my_other_col", after applying this function, we'd get a df with 1 column, "my_new_col_name".
So I guess this function is confusing for 3 reasons:
So it should probably be split into 2 functions or just native dataframe functions used (filtering a df and renaming columns are done with a single line of code in core pandas, so it's likely wrappers are not needed).
[ ] Check if
_apply_user_mapping()
is needed and if possible replace it withdf.rename(columns=mapping_dict)
.[ ]
api_connection()
should be refactored intoto_records()
or just included as part ofto_df()
[ ] add unit tests
https://github.com/dyvenia/viadot/pull/1053#discussion_r1778744268