-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
datetimeindex.to_period not behaving as expected. #23253
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
Comments
cc @jbrockmendel. Not sure if this is expected, but it does look strange. |
That is weird. Possibly related to #17666? |
Looks the same as #14070. I think there was an issue regarding Period definition. Current doc says Period is span, but not clear whether |
I was going by this part of the docs: http://pandas.pydata.org/pandas-docs/stable/timeseries.html#combining-aliases the combined offsets '2H20min' look like I'd expect, periods that are spaced 2 hours and 20 minutes apart. |
as best I can tell the issue is in def dt64arr_to_periodarr(data, freq, tz):
if data.dtype != np.dtype('M8[ns]'):
raise ValueError('Wrong dtype: %s' % data.dtype)
freq = Period._maybe_convert_freq(freq)
base, mult = _gfc(freq)
return period.dt64arr_to_periodarr(data.view('i8'), base, tz)
|
Code Sample, a copy-pastable example if possible
Problem description
By changing the period to 5 minutes, I expected the output to be:
but it is
Which makes it look like the actual period is one minute ('T') since thats what the output corresponds to, but the freq shows correctly as 5T.
Have I misunderstood what
to_period
should return? or is this a bug?I am using the latest version of pandas (0.23.4)
The text was updated successfully, but these errors were encountered: