Skip to content

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

Merged

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins added Output-Formatting __repr__ of pandas objects, to_string Clean labels Jul 24, 2019
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]
Copy link
Member Author

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()
)
Copy link
Contributor

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

Copy link
Member Author

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.

else:
return _trim_zeros_float(values, na_rep)
result = _trim_zeros_float(values, na_rep)
return np.array(result, dtype="object")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@jreback jreback added this to the 1.0 milestone Jul 25, 2019
@jreback jreback merged commit 1a22f9d into pandas-dev:master Jul 25, 2019
@jreback
Copy link
Contributor

jreback commented Jul 25, 2019

thanks @simonjayhawkins

@simonjayhawkins simonjayhawkins deleted the clean-pandas-io-formats-format.py branch July 26, 2019 03:15
quintusdias pushed a commit to quintusdias/pandas_dev that referenced this pull request Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants