Skip to content

Commit c30677d

Browse files
nejailelsayedhazemm
authored andcommitted
DOC: Update comment for handling bool dtype converstion
1 parent 3fd0acc commit c30677d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/_libs/parsers.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,13 +1015,13 @@ cdef class TextReader:
10151015
i, start, end, name, na_filter, na_hashset,
10161016
na_fset, col_dtype)
10171017
except (ValueError, TypeError, OverflowError) as e:
1018-
# GH#63168: Handle dtype conversion failures based on on_bad_lines
1018+
# Handle dtype conversion failure based on on_bad_lines
10191019
if self.parser.on_bad_lines == SKIP or self.parser.on_bad_lines == WARN:
10201020
# Fall back to string conversion
10211021
col_res, na_count = self._string_convert(
10221022
i, start, end, na_filter, na_hashset)
10231023

1024-
# Track this column's intended dtype for later bad row detection
1024+
# Track the columns intended dtype for bad row detection lateron
10251025
if col_dtype is not None:
10261026
failed_columns_dtypes[i] = col_dtype
10271027

@@ -1059,7 +1059,7 @@ cdef class TextReader:
10591059

10601060
results[i] = col_res
10611061

1062-
# GH#63168: Filter out bad rows if on_bad_lines is SKIP or WARN
1062+
# Filters out the bad rows if on_bad_lines is skipped or warned
10631063
if failed_columns_dtypes:
10641064
# Identify bad rows from columns that failed dtype conversion
10651065
for col_idx, target_dtype in failed_columns_dtypes.items():
@@ -1457,16 +1457,16 @@ _NA_VALUES = _ensure_encoded(list(STR_NA_VALUES))
14571457

14581458
def _identify_bad_rows(values, dtype):
14591459
"""
1460-
Identify row indices where values cannot be converted to the target dtype.
1460+
Identify the row indices when values cannot be converted to the intended target
14611461
1462-
GH#63168: Used to find rows that should be skipped when on_bad_lines='skip'.
1462+
This can be used to find rows that should be skipped when on_bad_lines='skip'
14631463
14641464
Parameters
14651465
----------
14661466
values : ndarray
1467-
Array of values (typically strings/objects) to check.
1467+
Array of values to check
14681468
dtype : numpy dtype
1469-
Target dtype to check conversion against.
1469+
Target dtype to check conversion against
14701470
14711471
Returns
14721472
-------
@@ -1492,7 +1492,7 @@ def _identify_bad_rows(values, dtype):
14921492
elif dtype.kind == "f": # float types
14931493
float(val)
14941494
elif dtype.kind == "b": # boolean
1495-
# Boolean conversion is more complex, skip for now
1495+
# Complex pass it until we fix again
14961496
pass
14971497
except (ValueError, TypeError):
14981498
bad_indices.add(idx)

0 commit comments

Comments
 (0)