Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error when importing my csv file #355

Open
pranavlal opened this issue Mar 22, 2020 · 0 comments
Open

Syntax error when importing my csv file #355

pranavlal opened this issue Mar 22, 2020 · 0 comments

Comments

@pranavlal
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant