pandas.errors.ParserWarning
-
exception pandas.errors.ParserWarning[source] -
Warning raised when reading a file that doesn’t use the default ‘c’ parser.
Raised by
pd.read_csvandpd.read_tablewhen it is necessary to change parsers, generally from the default ‘c’ parser to ‘python’.It happens due to a lack of support or functionality for parsing a particular attribute of a CSV file with the requested engine.
Currently, ‘c’ unsupported options include the following parameters:
-
sepother than a single character (e.g. regex separators) -
skipfooterhigher than 0 -
sep=Nonewithdelim_whitespace=False
The warning can be avoided by adding
engine=’python’as a parameter inpd.read_csvandpd.read_tablemethods.See also
-
pd.read_csv - Read CSV (comma-separated) file into DataFrame.
-
pd.read_table - Read general delimited file into DataFrame.
Examples
Using a
sepinpd.read_csvother than a single character:>>> import io >>> csv = u'''a;b;c ... 1;1,8 ... 1;2,1''' >>> df = pd.read_csv(io.StringIO(csv), sep='[;,]') ... # ParserWarning: Falling back to the 'python' engine...
Adding
engine=’python’topd.read_csvremoves the Warning:>>> df = pd.read_csv(io.StringIO(csv), sep='[;,]', engine='python')
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.errors.ParserWarning.html