Skip to content

API: DatetimeIndex and PeriodIndex have same representation #7602

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
Jun 29, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 28, 2014

Closes #7601. Made PeriodIndex to have dummy timezone representation to be consistent with DatetimeIndex, but this should be ommited?

Output after the fix

# DatetimeIndex (No change)
pd.date_range(start='2011-01-01', periods=10, freq='M')
# <class 'pandas.tseries.index.DatetimeIndex'>
# [2011-01-31, ..., 2011-10-31]
# Length: 10, Freq: M, Timezone: None

# PeriodIndex
pd.period_range(start='2011-01-01', periods=10, freq='M')
# <class 'pandas.tseries.period.PeriodIndex'>
# [2011-01, ..., 2011-10]
# Length: 10, Freq: M

@jreback
Copy link
Contributor

jreback commented Jun 28, 2014

doesn't need a tz
what I meant by consistent is the look/feel

@sinhrks
Copy link
Member Author

sinhrks commented Jun 28, 2014

OK. Removed tz repr from PeriodIndex

return summary

def __str__(self):
if compat.PY3:
Copy link
Contributor

Choose a reason for hiding this comment

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

these are not needed - this is a mixin but all object inherit from the PandasObject which already have these defined

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, not noticed. Removed.

@jreback
Copy link
Contributor

jreback commented Jun 29, 2014

can this integrate some of the DatetimeIndex formatting stuff? and out in Base (while leaving the output the same)

in theory could do similarly with Series though might be much trickier

@jreback jreback added this to the 0.14.1 milestone Jun 29, 2014
@jreback
Copy link
Contributor

jreback commented Jun 29, 2014

needs rebase
an u show the examples for both period and datetime in the top of PR

@sinhrks
Copy link
Member Author

sinhrks commented Jun 29, 2014

Rebased and examples are attached.

jreback added a commit that referenced this pull request Jun 29, 2014
API: DatetimeIndex and PeriodIndex have same representation
@jreback jreback merged commit b747903 into pandas-dev:master Jun 29, 2014
@jreback
Copy link
Contributor

jreback commented Jun 29, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Output-Formatting __repr__ of pandas objects, to_string Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: DatetimeIndex and PeriodIndex string representation
2 participants