Skip to content

BUG: GH15426 timezone lost in groupby-agg with cython functions #15433

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

Closed

Conversation

stephenrauch
Copy link
Contributor

@codecov-io
Copy link

codecov-io commented Feb 17, 2017

Codecov Report

Merging #15433 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master   #15433      +/-   ##
==========================================
+ Coverage   90.36%   90.37%   +<.01%     
==========================================
  Files         136      136              
  Lines       49553    49554       +1     
==========================================
+ Hits        44780    44782       +2     
+ Misses       4773     4772       -1
Impacted Files Coverage Δ
pandas/types/cast.py 85.45% <100%> (+0.02%)
pandas/core/generic.py 96.31% <0%> (ø)
pandas/core/common.py 91.36% <0%> (+0.33%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3ae4c7...64a84ca. Read the comment docs.

@@ -738,3 +738,14 @@ def test_agg_over_numpy_arrays(self):
columns=expected_column)

assert_frame_equal(result, expected)

def test_agg_time_zone_round_trip(self):
ts = pd.Timestamp("2016-01-01 12:00:00", tz='US/Pacific')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number as a comment

df = pd.DataFrame({'a': 1, 'b': [ts + timedelta(minutes=nn)
for nn in range(10)]})

result1 = df.groupby('a')['b'].agg(np.min).iloc[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare with .min() as well

@@ -133,7 +133,8 @@ def trans(x): # noqa
if dtype.tz:
# convert to datetime and change timezone
from pandas import to_datetime
result = to_datetime(result).tz_localize(dtype.tz)
result = to_datetime(result).tz_localize('utc')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add addtl tests in pandas/tests/types/test_cast.py fit them in as appropriate. take out this fix temporarily to validate your test cases, then add back to make sure they work.

@jreback jreback added Groupby Timezones Timezone data dtype labels Feb 17, 2017
@jreback
Copy link
Contributor

jreback commented Feb 17, 2017

add examples from #10668 as well. (and you can list list issue in the whatsnew too)

@jreback
Copy link
Contributor

jreback commented Feb 23, 2017

can you update

@stephenrauch stephenrauch force-pushed the tz-lost-in-groupby-agg branch from ae0ea81 to 64a84ca Compare February 27, 2017 05:32
@jreback jreback added this to the 0.20.0 milestone Feb 27, 2017
@jreback jreback closed this in 6c17f67 Feb 27, 2017
@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

thanks!

AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
closes pandas-dev#15426

Author: Stephen Rauch <[email protected]>

Closes pandas-dev#15433 from stephenrauch/tz-lost-in-groupby-agg and squashes the following commits:

64a84ca [Stephen Rauch] BUG: GH15426 timezone lost in groupby-agg with cython functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: timezone lost in groupby-agg with cython functions
3 participants