-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
BUG: make read_csv
be able to read large floating numbers into float
#62542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
1b6e3a2
8908d84
2686655
4aa0ff1
706503f
544a257
62b49f9
6c03279
6aa8398
44b68bc
e16c71b
fc01097
93c94b5
380e6ec
6b4cedb
b3519c1
2e0af7a
0973086
c7ddf17
a7ab941
8b57401
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1069,6 +1069,10 @@ cdef class TextReader: | |
else: | ||
col_res = None | ||
for dt in self.dtype_cast_order: | ||
if (dt.kind in "iu" and | ||
self._column_has_float(i, start, end, na_filter, na_hashset)): | ||
continue | ||
|
||
try: | ||
col_res, na_count = self._convert_with_dtype( | ||
dt, i, start, end, na_filter, 0, na_hashset, na_fset) | ||
|
@@ -1342,6 +1346,27 @@ cdef class TextReader: | |
else: | ||
return None | ||
|
||
cdef bint _column_has_float(self, int64_t col, | ||
int64_t start, int64_t end, | ||
bint na_filter, kh_str_starts_t *na_hashset): | ||
"""Check if the column contains any float number.""" | ||
cdef: | ||
Py_ssize_t i, lines = end - start | ||
coliter_t it | ||
const char *word = NULL | ||
|
||
coliter_setup(&it, self.parser, col, start) | ||
|
||
for i in range(lines): | ||
COLITER_NEXT(it, word) | ||
|
||
if na_filter and kh_get_str_starts_item(na_hashset, word): | ||
continue | ||
|
||
if self.parser.decimal in word or b"e" in word or b"E" in word: | ||
|
||
return True | ||
|
||
return False | ||
|
||
# Factor out code common to TextReader.__dealloc__ and TextReader.close | ||
# It cannot be a class method, since calling self.close() in __dealloc__ | ||
|
Uh oh!
There was an error while loading. Please reload this page.