-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Remove NotImplementedError for parse_dates keyword in read_excel #15820
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 all commits
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 |
---|---|---|
|
@@ -1176,13 +1176,18 @@ def _should_parse_dates(self, i): | |
if isinstance(self.parse_dates, bool): | ||
return self.parse_dates | ||
else: | ||
name = self.index_names[i] | ||
if self.index_names is not None: | ||
name = self.index_names[i] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorisvandenbossche this fixes, though not quite sure why this could/would be @gfyoung any idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right. yep must not have taken that path at all, e.g. if you want to look and see maybe missing something obvious, would be great. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure thing. Just curious, what test was failing beforehand that allowed you to catch this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorisvandenbossche re-enabled the |
||
else: | ||
name = None | ||
j = self.index_col[i] | ||
|
||
if is_scalar(self.parse_dates): | ||
return (j == self.parse_dates) or (name == self.parse_dates) | ||
return ((j == self.parse_dates) or | ||
(name is not None and name == self.parse_dates)) | ||
else: | ||
return (j in self.parse_dates) or (name in self.parse_dates) | ||
return ((j in self.parse_dates) or | ||
(name is not None and name in self.parse_dates)) | ||
|
||
def _extract_multi_indexer_columns(self, header, index_names, col_names, | ||
passed_names=False): | ||
|
@@ -1352,6 +1357,7 @@ def _get_name(icol): | |
|
||
def _agg_index(self, index, try_parse_dates=True): | ||
arrays = [] | ||
|
||
for i, arr in enumerate(index): | ||
|
||
if (try_parse_dates and self._should_parse_dates(i)): | ||
|
@@ -1512,6 +1518,7 @@ def _cast_types(self, values, cast_type, column): | |
|
||
def _do_date_conversions(self, names, data): | ||
# returns data, columns | ||
|
||
if self.parse_dates is not None: | ||
data, names = _process_date_conversion( | ||
data, self._date_conv, self.parse_dates, self.index_col, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test that hits this warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, though I am puzzled why a simple
parse_dates=True
doesn't just work.....