File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -194,13 +194,15 @@ pandas 0.11.0
194
194
- Substitute warning for segfault when grouping with categorical grouper
195
195
of mismatched length (GH3011 _)
196
196
- Fix exception in SparseSeries.density (GH2083 _)
197
+ - Fix upsampling bug with closed='left' and daily to daily data (GH3020 _)
197
198
198
199
.. _GH2758 : https://github.com/pydata/pandas/issues/2758
199
200
.. _GH2809 : https://github.com/pydata/pandas/issues/2809
200
201
.. _GH2810 : https://github.com/pydata/pandas/issues/2810
201
202
.. _GH2837 : https://github.com/pydata/pandas/issues/2837
202
203
.. _GH2898 : https://github.com/pydata/pandas/issues/2898
203
204
.. _GH3035 : https://github.com/pydata/pandas/issues/3035
205
+ .. _GH3020 : https://github.com/pydata/pandas/issues/3020
204
206
.. _GH2978 : https://github.com/pydata/pandas/issues/2978
205
207
.. _GH2877 : https://github.com/pydata/pandas/issues/2877
206
208
.. _GH2739 : https://github.com/pydata/pandas/issues/2739
Original file line number Diff line number Diff line change @@ -209,7 +209,13 @@ def _resample_timestamps(self, obj):
209
209
else :
210
210
# upsampling shortcut
211
211
assert (self .axis == 0 )
212
- result = obj .reindex (binner [1 :], method = self .fill_method ,
212
+
213
+ if self .closed == 'right' :
214
+ res_index = binner [1 :]
215
+ else :
216
+ res_index = binner [:- 1 ]
217
+
218
+ result = obj .reindex (res_index , method = self .fill_method ,
213
219
limit = self .limit )
214
220
else :
215
221
# Irregular data, have to use groupby
Original file line number Diff line number Diff line change @@ -559,11 +559,11 @@ def test_resample_median_bug_1688(self):
559
559
result = df .resample ("T" , how = lambda x : x .mean ())
560
560
exp = df .asfreq ('T' )
561
561
tm .assert_frame_equal (result , exp )
562
-
562
+
563
563
result = df .resample ("T" , how = "median" )
564
564
exp = df .asfreq ('T' )
565
565
tm .assert_frame_equal (result , exp )
566
-
566
+
567
567
def test_how_lambda_functions (self ):
568
568
ts = _simple_ts ('1/1/2000' , '4/1/2000' )
569
569
@@ -983,6 +983,14 @@ def test_all_values_single_bin(self):
983
983
result = s .resample ("A" , how = 'mean' )
984
984
tm .assert_almost_equal (result [0 ], s .mean ())
985
985
986
+ def test_resample_doesnt_truncate (self ):
987
+ """Test for issue #3020"""
988
+ import pandas as pd
989
+ dates = pd .date_range ('01-Jan-2014' ,'05-Jan-2014' , freq = 'D' )
990
+ series = Series (1 , index = dates )
991
+
992
+ result = series .resample ('D' )
993
+ self .assertEquals (result .index [0 ], dates [0 ])
986
994
987
995
class TestTimeGrouper (unittest .TestCase ):
988
996
You can’t perform that action at this time.
0 commit comments