@@ -1335,7 +1335,8 @@ def test_groupby_bins(self):
1335
1335
# http://pandas.pydata.org/pandas-docs/stable/generated/pandas.cut.html
1336
1336
bins = [0 ,1.5 ,5 ]
1337
1337
bin_coords = ['(0, 1.5]' , '(1.5, 5]' ]
1338
- expected = DataArray ([1 ,5 ], dims = 'dim_0' , coords = {'dim_0' : bin_coords })
1338
+ expected = DataArray ([1 ,5 ], dims = 'dim_0_bins' ,
1339
+ coords = {'dim_0_bins' : bin_coords })
1339
1340
# the problem with this is that it overwrites the dimensions of array!
1340
1341
#actual = array.groupby('dim_0', bins=bins).sum()
1341
1342
actual = array .groupby_bins ('dim_0' , bins ).apply (
@@ -1349,13 +1350,15 @@ def test_groupby_bins_multidim(self):
1349
1350
array = self .make_groupby_multidim_example_array ()
1350
1351
bins = [0 ,15 ,20 ]
1351
1352
bin_coords = ['(0, 15]' , '(15, 20]' ]
1352
- expected = DataArray ([16 , 40 ], dims = 'lat' , coords = {'lat' : bin_coords })
1353
+ expected = DataArray ([16 , 40 ], dims = 'lat_bins' ,
1354
+ coords = {'lat_bins' : bin_coords })
1353
1355
actual = array .groupby_bins ('lat' , bins ).apply (
1354
1356
lambda x : x .sum (), shortcut = False )
1355
1357
self .assertDataArrayIdentical (expected , actual )
1356
1358
# modify the array coordinates to be non-monotonic after unstacking
1357
1359
array ['lat' ].data = np .array ([[10. , 20. ], [20. , 10. ]])
1358
- expected = DataArray ([28 , 28 ], dims = 'lat' , coords = {'lat' : bin_coords })
1360
+ expected = DataArray ([28 , 28 ], dims = 'lat_bins' ,
1361
+ coords = {'lat_bins' : bin_coords })
1359
1362
actual = array .groupby_bins ('lat' , bins ).apply (
1360
1363
lambda x : x .sum (), shortcut = False )
1361
1364
self .assertDataArrayIdentical (expected , actual )
0 commit comments