-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: pandas\io\formats\format.py #27577
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
CLN: pandas\io\formats\format.py #27577
Conversation
formatter = self.formatter or _get_format_timedelta64( | ||
self.values, nat_rep=self.nat_rep, box=self.box | ||
) | ||
fmt_values = np.array([formatter(x) for x in self.values]) | ||
return fmt_values | ||
return [formatter(x) for x in self.values] |
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.
this is the most relevant change here.
return type now consistent with parent class and other formatters.
mypy should have picked this up. but since we don't have numpy stubs, all numpy types resolve to Any
Timedelta64Formatter( | ||
values=self, nat_rep=na_rep, justify="all" | ||
).get_result() | ||
) |
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.
use asarray or pass copy=False
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.
sure. was keeping the code as close to original as possible.
pandas/io/formats/format.py
Outdated
else: | ||
return _trim_zeros_float(values, na_rep) | ||
result = _trim_zeros_float(values, na_rep) | ||
return np.array(result, dtype="object") |
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.
same
thanks @simonjayhawkins |
xref #27512 (comment)