@@ -103,10 +103,42 @@ class EmptyDataError(ValueError):
103
103
104
104
class ParserWarning (Warning ):
105
105
"""
106
- Warning that is raised in `pd.read_csv` whenever it is necessary
107
- to change parsers (generally from 'c' to 'python') contrary to the
108
- one specified by the user due to lack of support or functionality for
109
- parsing particular attributes of a CSV file with the requested engine.
106
+ Warning raised when reading a file that doesn't use the default 'c' parser.
107
+
108
+ Raised by `pd.read_csv` and `pd.read_table` when it is necessary to change
109
+ parsers, generally from the default 'c' parser to 'python'.
110
+
111
+ It happens due to a lack of support or functionality for parsing a
112
+ particular attribute of a CSV file with the requested engine.
113
+
114
+ Currently, 'c' unsupported options include the following parameters:
115
+
116
+ 1. `sep` other than a single character (e.g. regex separators)
117
+ 2. `skipfooter` higher than 0
118
+ 3. `sep=None` with `delim_whitespace=False`
119
+
120
+ The warning can be avoided by adding `engine='python'` as a parameter in
121
+ `pd.read_csv` and `pd.read_table` methods.
122
+
123
+ See Also
124
+ --------
125
+ pd.read_csv : Read CSV (comma-separated) file into DataFrame.
126
+ pd.read_table : Read general delimited file into DataFrame.
127
+
128
+ Examples
129
+ --------
130
+ Using a `sep` in `pd.read_csv` other than a single character:
131
+
132
+ >>> import io
133
+ >>> csv = u'''a;b;c
134
+ ... 1;1,8
135
+ ... 1;2,1'''
136
+ >>> df = pd.read_csv(io.StringIO(csv), sep='[;,]')
137
+ ... # ParserWarning: Falling back to the 'python' engine...
138
+
139
+ Adding `engine='python'` to `pd.read_csv` removes the Warning:
140
+
141
+ >>> df = pd.read_csv(io.StringIO(csv), sep='[;,]', engine='python')
110
142
"""
111
143
112
144
0 commit comments