cdQA icon indicating copy to clipboard operation
cdQA copied to clipboard

Syntax error when importing my csv file

Open pranavlal opened this issue 5 years ago • 0 comments

Hi all, I have constructed a custom data set in a csv file. This data set is of stack over flow questions. I have the questions in the "title" column and the answers in the "paragraphs" column. When I import the file, I get the following error on line 1. Traceback (most recent call last): File "train_cdqa.py", line 5, in df = pd.read_csv('cdqa.csv', converters={'paragraphs': literal_eval}, engine='python') File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f return _read(filepath_or_buffer, kwds) File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 454, in _read data = parser.read(nrows) File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 1133, in read ret = self._engine.read(nrows) File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 2464, in read data = self._convert_data(data) File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 2534, in _convert_dat a clean_dtypes, File "/home/pranav/.virtualenvs/robociso/lib/python3.7/site-packages/pandas/io/parsers.py", line 1691, in convert_to ndarrays values = lib.map_infer(values, conv_f) File "pandas/_libs/lib.pyx", line 2329, in pandas._libs.lib.map_infer File "/usr/lib/python3.7/ast.py", line 46, in literal_eval node_or_string = parse(node_or_string, mode='eval') File "/usr/lib/python3.7/ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "", line 1 I haven't taken the course, but I've heard a lot of good things about the OCSP certification: ^ SyntaxError: invalid syntax (

What is the problem and how do I fix it?

pranavlal avatar Mar 22 '20 05:03 pranavlal