How to fix the following warning from VS Code:
No overloads for "pd.read_csv(filepath_or_buffer=input_dir, compression='zip')" match parameters
Argument types: (Literal['../cleaned_data.csv.zip'], Literal['zip'])Pylance (reportGeneralTypeIssues)
for the code
cleaned_df = pd.read_csv(filepath_or_buffer = input_dir, compression = 'zip')
P.S. This error is from Pylance
Pass filepath_or_buffer
as a positional argument and not as a keyword argument:
cleaned_df = pd.read_csv(input_dir, compression = 'zip')
Pandas code and documentation say that the first argument is named filepath_or_buffer
but the module stub used for typing says it is named filepath
.
Pandas code:
Pylance stub:
If you prefer ignoring the error and wait for a future fix from Pylance you can do the following:
cleaned_df = pd.read_csv(filepath_or_buffer = "aaa", compression = 'zip') # type: ignore
Of course ignoring type errors is not good practice but this is a bug in the type checker so..