File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1255,6 +1255,21 @@ The bad line will be a list of strings that was split by the ``sep``:
1255
1255
1256
1256
.. versionadded:: 1.4.0
1257
1257
1258
+ Note that the callable function will handle only a line with too many fields.
1259
+ Bad lines caused by other errors will be silently skipped.
1260
+
1261
+ For example:
1262
+
1263
+ .. code-block :: ipython
1264
+
1265
+ def bad_lines_func(line):
1266
+ print(line)
1267
+
1268
+ data = 'name,type\nname a,a is of type a\nname b,"b\" is of type b"'
1269
+ data
1270
+ pd.read_csv(data, on_bad_lines=bad_lines_func, engine="python")
1271
+
1272
+ The line was not processed in this case, as a "bad line" here is caused by an escape character.
1258
1273
1259
1274
You can also use the ``usecols `` parameter to eliminate extraneous column
1260
1275
data that appear in some lines but not others:
You can’t perform that action at this time.
0 commit comments