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

Series.apply fails when the series is a timezone aware datetime #25959

Closed
goriccardo opened this issue Apr 2, 2019 · 4 comments

Comments

@goriccardo
Copy link

commented Apr 2, 2019

To reproduce the problem:

import pandas as pd

s = pd.util.testing.makeTimeSeries()
s = s.tz_localize('UTC')
pd.Series(s.index).apply(lambda x: pd.Series([1,2]))

AttributeError: 'PandasArray' object has no attribute 'tolist'

It works fine if the function to apply returns a scalar instead of a Series:

import pandas as pd

s = pd.util.testing.makeTimeSeries()
s = s.tz_localize('UTC')
pd.Series(s.index).apply(lambda x: 1)

or it there is no timezone information in the series.

import pandas as pd

s = pd.util.testing.makeTimeSeries()
pd.Series(s.index).apply(lambda x: pd.Series([1,2]))

The issue is present with pandas 0.24.2, it used to work fine with 0.23.4.

@ThomasKluiters

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

I'd like to pick this up as my first issue to contribute to this repo :)

@jbrockmendel

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

One more reason EAs should have “tolist” cc @jreback @jorisvandenbossche

@ThomasKluiters

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

Then would the better fix be to just implement tolist for extension arrays?

@jbrockmendel

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

Implementing tolist can wait for now.

@jreback jreback added this to the 0.25.0 milestone Apr 4, 2019

ThomasKluiters added a commit to ThomasKluiters/pandas that referenced this issue Apr 10, 2019

ThomasKluiters added a commit to ThomasKluiters/pandas that referenced this issue Apr 10, 2019

@jreback jreback modified the milestones: 0.25.0, Contributions Welcome May 12, 2019

jreback added a commit that referenced this issue May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.