@@ -1351,7 +1351,7 @@ cdef class TextReader:
1351
1351
bint na_filter, kh_str_starts_t * na_hashset):
1352
1352
""" Check if the column contains any float number."""
1353
1353
cdef:
1354
- Py_ssize_t i, lines = end - start
1354
+ Py_ssize_t i, j, lines = end - start
1355
1355
coliter_t it
1356
1356
const char * word = NULL
1357
1357
@@ -1368,22 +1368,32 @@ cdef class TextReader:
1368
1368
continue
1369
1369
1370
1370
found_first_digit = False
1371
- for c in word:
1372
- if not found_first_digit and c in ignored_chars:
1373
- continue
1374
- elif not found_first_digit and c not in digits:
1371
+ j = 0
1372
+ while word[j] != b" \0" :
1373
+ if not found_first_digit and word[j] in ignored_chars:
1374
+ # no-op
1375
+ pass
1376
+ elif not found_first_digit and word[j] not in digits:
1375
1377
# word isn't numeric
1376
1378
return False
1377
- elif not found_first_digit:
1379
+ elif not found_first_digit and word[j] in digits :
1378
1380
found_first_digit = True
1379
- elif c in float_indicating_chars:
1381
+ elif word[j] in float_indicating_chars:
1380
1382
# preceding chars indicates numeric and
1381
1383
# current char indicates float
1382
1384
return True
1383
- elif c not in digits:
1385
+ elif word[j] not in digits:
1384
1386
# previous characters indicates numeric
1385
1387
# current character shows otherwise
1386
1388
return False
1389
+ elif word[j] in digits:
1390
+ # no-op
1391
+ pass
1392
+ else :
1393
+ raise AssertionError (
1394
+ f" Unhandled case {word[j]=} {found_first_digit=}"
1395
+ )
1396
+ j += 1
1387
1397
1388
1398
return False
1389
1399
0 commit comments