I am a relatively new python user and am getting a funky error using my IDE (pycharm), but not when using the cmd line.
Simply I:
path ='C:\Users\Dell\Downloads\users.dat'
import pandas as pd
unames = ['user_id', 'gender', 'age', 'occupation', 'zip']
users = pd.read_table(path, sep='::', header=None, names=unames)
After which I receive an error that indicates:
ParserWarning: Falling back to the 'python' engine because the 'c' engine does not
support regex separators; you can avoid this warning by specifying engine='python'.
ParserWarning)
When i input the identical commands into the cmd line and print users
the data prints as expected (i.e., no errors or anything funky).
EDIT: similarly when I input
ratingsdata ='C:\Users\Dell\Downloads\ratings.dat'
I get a funky IOError: [Errno 22] invalid mode ('r') or filename:
Not sure as to why the /r
is not ok in a file path... I understand it's regex, but within the quoted lines??
Help!
Looks like on Python 2.7 Pandas just doesn't handle separators that look regexish. The initial "error" can be worked around by adding engine='python'
as a named parameter in the call, as suggested in the warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With