I’ve worked on my python project in PyCharm. When I’m executing its different files everything goes smoothly. However, when I’m executing the files in shell, it seems like I get errors that I don’t get in the IDE.
For example, being a simplified structure of my project:
+--PROJECT +--data +--myfile.csv +--__init__.py +--main.py
And being a simplified main.py:
import pandas as pd if __name__ == "__main__": dataframe = pd.read_csv("data/myfile.csv", on_bad_lines='skip', sep=sep)
The execution in PyCharm is clean, while when I run it in Shell it yields:
TypeError: parser_f() got an unexpected keyword argument 'on_bad_lines'
I guess this could be a matter of Python versions, but I don’t quite see where the problem is. I have a 3.8 version in PyCharm and a 3.8.10 in Linux.
EDITED: Included the source file and its path
Advertisement
Answer
What version of pandas do you use? According to this documentation the on_bad_lines
is only added in 1.3.0. You can check that by using
$ python # start an interpreter >>> import pandas >>> print(pandas.__version__)