Skip to content

BUG: repr of Periods in a Series is broken #10974

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
merged 1 commit into from
Sep 3, 2015

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Sep 2, 2015

Closes #10971. It is caused by #10718.

@sinhrks sinhrks added the Output-Formatting __repr__ of pandas objects, to_string label Sep 2, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone Sep 2, 2015
@@ -2106,7 +2106,9 @@ def _format_strings(self):
class PeriodArrayFormatter(IntArrayFormatter):

def _format_strings(self):
values = np.array(self.values.to_native_types(), dtype=object)
values = self.values
Copy link
Contributor

Choose a reason for hiding this comment

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

just do

values = PeriodIndex(self.values).to_native_types()

Copy link
Member Author

Choose a reason for hiding this comment

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

In Series, self.values is already np.ndarray of period. No need to do round-trip?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's cleaner this way / when we do s period dtype will clean this up

Copy link
Member Author

Choose a reason for hiding this comment

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

Understood. Updated.

jreback added a commit that referenced this pull request Sep 3, 2015
BUG: repr of Periods in a Series is broken
@jreback jreback merged commit f82e177 into pandas-dev:master Sep 3, 2015
@jreback
Copy link
Contributor

jreback commented Sep 3, 2015

thank you sir!

@sinhrks sinhrks deleted the period_repr branch September 3, 2015 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants