-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: concat of tz-aware with missing #16230
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
your example is not copy-pastable.
|
Sorry, I forgot to paste one line. Now it should be copyable. |
what exactly are you trying to do ? using groupby in this way is very very odd |
Well this is just a reduced minimal example. The method works fine unless there is a user without any complete session, i.e. the apply method returns a column with None's only. Actually this example is even more compact: import pandas as pd
import pytz
from datetime import datetime
ldn = pytz.timezone("Europe/London")
df = pd.DataFrame(data={"times" : [ldn.localize(datetime(2017, 5, 4, 11, 18)),
ldn.localize(datetime(2017, 5, 4, 13, 20)),
ldn.localize(datetime(2017, 3, 4, 11, 18))],
"userID" : [1, 1, 2]})
def timeoffset(df):
col = df.times
forward = [None if i == len(col) -1 else col[i+1] for i in range(len(col))] # This is a simplification
return pd.DataFrame(data={"forward" : forward})
gb = df.groupby("userID")
gb.apply(timeoffset) It seems to me quite a natural way - group by, apply to each group, get a dataframe back for each group that gets combined into one big list of sessions ? |
(also with this repros.
looks like these are some untested cases. a pull-request to fix welcome! |
dupe of #12396 |
Uh oh!
There was an error while loading. Please reload this page.
Code Sample
I am not sure this is the simplest way to produce this error.
Problem description
the last line above throws the following stacktrace:
Expected Output
Output of
pd.show_versions()
pandas: 0.20.0rc1+48.gae70ece
pytest: None
pip: 9.0.1
setuptools: 28.8.0
Cython: 0.25.2
numpy: 1.12.1
scipy: None
xarray: None
IPython: 6.0.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: