Skip to content
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

Interpolating of datetime64 values ignored (at best) #19199

Closed
jbrockmendel opened this issue Jan 12, 2018 · 2 comments
Closed

Interpolating of datetime64 values ignored (at best) #19199

jbrockmendel opened this issue Jan 12, 2018 · 2 comments

Comments

@jbrockmendel
Copy link
Member

tz naive case:

index = pd.Index([23, 26, 30])
dti = pd.DatetimeIndex(['2015-09-23', '2015-09-26', '2015-09-30'])
ser = pd.Series(dti, index=index).reindex(range(23, 31))
df = pd.DataFrame(ser)

>>> ser    # for reference
23   2015-09-23
24          NaT
25          NaT
26   2015-09-26
27          NaT
28          NaT
29          NaT
30   2015-09-30
dtype: datetime64[ns]

>>> ser.interpolate()
23   2015-09-23
24          NaT
25          NaT
26   2015-09-26
27          NaT
28          NaT
29          NaT
30   2015-09-30
dtype: datetime64[ns]

>>> df.interpolate()
            0
23 2015-09-23
24        NaT
25        NaT
26 2015-09-26
27        NaT
28        NaT
29        NaT
30 2015-09-30

tz-aware case

index = pd.Index([23, 26, 30])
dti = pd.DatetimeIndex(['2015-09-23', '2015-09-26', '2015-09-30'], tz='US/Central')
ser = pd.Series(dti, index=index).reindex(range(23, 31))
df = pd.DataFrame(ser)

>>> ser
23   2015-09-23 00:00:00-05:00
24                         NaT
25                         NaT
26   2015-09-26 00:00:00-05:00
27                         NaT
28                         NaT
29                         NaT
30   2015-09-30 00:00:00-05:00
dtype: datetime64[ns, US/Central]

>>> ser.interpolate()
23   2015-09-23 00:00:00-05:00
24                         NaT
25                         NaT
26   2015-09-26 00:00:00-05:00
27                         NaT
28                         NaT
29                         NaT
30   2015-09-30 00:00:00-05:00
dtype: datetime64[ns, US/Central]

>>> df.interpolate()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 4738, in interpolate
    'object') == len(_maybe_transposed_self.T):
  File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1909, in transpose
    return super(DataFrame, self).transpose(1, 0, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 599, in transpose
    new_values = self.values.transpose(axes_numbers)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/base.py", line 696, in transpose
    nv.validate_transpose(args, kwargs)
  File "/usr/local/lib/python2.7/site-packages/pandas/compat/numpy/function.py", line 54, in __call__
    self.defaults)
  File "/usr/local/lib/python2.7/site-packages/pandas/util/_validators.py", line 218, in validate_args_and_kwargs
    validate_kwargs(fname, kwargs, compat_args)
  File "/usr/local/lib/python2.7/site-packages/pandas/util/_validators.py", line 157, in validate_kwargs
    _check_for_default_values(fname, kwds, compat_args)
  File "/usr/local/lib/python2.7/site-packages/pandas/util/_validators.py", line 69, in _check_for_default_values
    format(fname=fname, arg=key)))
ValueError: the 'axes' parameter is not supported in the pandas implementation of transpose()

The ValueError for the DataFrame case is in issue #19198.

@jreback
Copy link
Contributor

jreback commented Jan 12, 2018

we have tons of interpolation issues, pls find the duplicate and close this one

@jbrockmendel
Copy link
Member Author

Dup of #11701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants