We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example below for tz_localize() (Same error for tz_convert())
In [1]: import pandas as pd In [2]: pd.__version__ Out[2]: '0.14.1' In [3]: cohort_date = pd.date_range('20140701', periods=5, freq='D') In [4]: event_date = pd.date_range('20140701', periods=5, freq='D') In [5]: multi_index = pd.MultiIndex.from_product([cohort_date, event_date], names=['cohort_date', 'event_date']) In [6]: df = pd.DataFrame(index=multi_index) In [7]: df Out[7]: Empty DataFrame Columns: [] Index: [(2014-07-01 00:00:00, 2014-07-01 00:00:00), (2014-07-01 00:00:00, 2014-07-02 00:00:00), (2014-07-01 00:00:00, 2014-07-03 00:00:00), (2014-07-01 00:00:00, 2014-07-04 00:00:00), (2014-07-01 00:00:00, 2014-07-05 00:00:00), (2014-07-02 00:00:00, 2014-07-01 00:00:00), (2014-07-02 00:00:00, 2014-07-02 00:00:00), (2014-07-02 00:00:00, 2014-07-03 00:00:00), (2014-07-02 00:00:00, 2014-07-04 00:00:00), (2014-07-02 00:00:00, 2014-07-05 00:00:00), (2014-07-03 00:00:00, 2014-07-01 00:00:00), (2014-07-03 00:00:00, 2014-07-02 00:00:00), (2014-07-03 00:00:00, 2014-07-03 00:00:00), (2014-07-03 00:00:00, 2014-07-04 00:00:00), (2014-07-03 00:00:00, 2014-07-05 00:00:00), (2014-07-04 00:00:00, 2014-07-01 00:00:00), (2014-07-04 00:00:00, 2014-07-02 00:00:00), (2014-07-04 00:00:00, 2014-07-03 00:00:00), (2014-07-04 00:00:00, 2014-07-04 00:00:00), (2014-07-04 00:00:00, 2014-07-05 00:00:00), (2014-07-05 00:00:00, 2014-07-01 00:00:00), (2014-07-05 00:00:00, 2014-07-02 00:00:00), (2014-07-05 00:00:00, 2014-07-03 00:00:00), (2014-07-05 00:00:00, 2014-07-04 00:00:00), (2014-07-05 00:00:00, 2014-07-05 00:00:00)] In [8]: df.tz_localize('UTC') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-8-fa0ae4582d5d> in <module>() ----> 1 df.tz_localize('UTC') /Users/mtrbean/.virtualenvs/stats/lib/python2.7/site-packages/pandas/core/generic.pyc in tz_localize(self, tz, axis, copy, infer_dst) 3492 ax_name = self._get_axis_name(axis) 3493 raise TypeError('%s is not a valid DatetimeIndex or PeriodIndex' % -> 3494 ax_name) 3495 else: 3496 ax = DatetimeIndex([],tz=tz) TypeError: index is not a valid DatetimeIndex or PeriodIndex
The text was updated successfully, but these errors were encountered:
this is not meant to work an a MultiIndex as it's not a defined operation
it will only work on an appropriate level (which is an DatetimeIndex/PeriodIndex)
so I could see providing a level keyword that would make this happen
interested in doing a pr?
Sorry, something went wrong.
I'd love to, and I thin it would be super easy to do with #7792 (when it is resolved).
gr8
want to take a stab at that issue? only slightly more challenging
sure will tackle #7792 first
@mtrbean alright! this should be straightfoward now after #7792
level
Successfully merging a pull request may close this issue.
Example below for tz_localize() (Same error for tz_convert())
The text was updated successfully, but these errors were encountered: