File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,21 @@ cdef class TextReader:
461461 raise ValueError (" Only length-1 comment characters supported" )
462462 self .parser.commentchar = < char > ord (comment)
463463
464- self .parser.on_bad_lines = on_bad_lines
464+ if isinstance (on_bad_lines, str ):
465+ if on_bad_lines == ' error' :
466+ c_on_bad_lines = ERROR
467+ elif on_bad_lines == ' warn' :
468+ c_on_bad_lines = WARN
469+ elif on_bad_lines == ' skip' :
470+ c_on_bad_lines = SKIP
471+ # Note: can add 'skip_with_log' here later when we work on logging
472+ else :
473+ raise ValueError (f" Invalid value for on_bad_lines: {on_bad_lines}" )
474+ else :
475+ # If it's not a string, assume it's already an integer/enum constant (like ERROR)
476+ c_on_bad_lines = on_bad_lines
477+
478+ self .parser.on_bad_lines = c_on_bad_lines
465479
466480 self .skiprows = skiprows
467481 if skiprows is not None :
You can’t perform that action at this time.
0 commit comments