@@ -1131,12 +1131,12 @@ def test_dropna(self):
1131
1131
)
1132
1132
1133
1133
tm .assert_series_equal (
1134
- Series ([True , True , False , None ]).value_counts (dropna = True ),
1135
- Series ([2 , 1 ], index = [True , False ]),
1134
+ Series ([True ] * 3 + [ False ] * 2 + [ None ] * 5 ).value_counts (dropna = True ),
1135
+ Series ([3 , 2 ], index = [True , False ]),
1136
1136
)
1137
1137
tm .assert_series_equal (
1138
- Series ([True , True , False , None ]).value_counts (dropna = False ),
1139
- Series ([2 , 1 , 1 ], index = [True , False , np .nan ]),
1138
+ Series ([True ] * 5 + [ False ] * 3 + [ None ] * 2 ).value_counts (dropna = False ),
1139
+ Series ([5 , 3 , 2 ], index = [True , False , np .nan ]),
1140
1140
)
1141
1141
tm .assert_series_equal (
1142
1142
Series ([10.3 , 5.0 , 5.0 ]).value_counts (dropna = True ),
@@ -1152,26 +1152,24 @@ def test_dropna(self):
1152
1152
Series ([2 , 1 ], index = [5.0 , 10.3 ]),
1153
1153
)
1154
1154
1155
- # 32-bit linux has a different ordering
1156
- if IS64 :
1157
- result = Series ([10.3 , 5.0 , 5.0 , None ]).value_counts (dropna = False )
1158
- expected = Series ([2 , 1 , 1 ], index = [5.0 , 10.3 , np .nan ])
1159
- tm .assert_series_equal (result , expected )
1155
+ result = Series ([10.3 , 10.3 , 5.0 , 5.0 , 5.0 , None ]).value_counts (dropna = False )
1156
+ expected = Series ([3 , 2 , 1 ], index = [5.0 , 10.3 , np .nan ])
1157
+ tm .assert_series_equal (result , expected )
1160
1158
1161
1159
def test_value_counts_normalized (self ):
1162
1160
# GH12558
1163
- s = Series ([1 , 2 , np . nan , np . nan , np .nan ])
1161
+ s = Series ([1 ] * 2 + [ 2 ] * 3 + [ np .nan ] * 5 )
1164
1162
dtypes = (np .float64 , object , "M8[ns]" )
1165
1163
for t in dtypes :
1166
1164
s_typed = s .astype (t )
1167
1165
result = s_typed .value_counts (normalize = True , dropna = False )
1168
1166
expected = Series (
1169
- [0.6 , 0.2 , 0.2 ], index = Series ([np .nan , 2.0 , 1.0 ], dtype = t )
1167
+ [0.5 , 0.3 , 0.2 ], index = Series ([np .nan , 2.0 , 1.0 ], dtype = t )
1170
1168
)
1171
1169
tm .assert_series_equal (result , expected )
1172
1170
1173
1171
result = s_typed .value_counts (normalize = True , dropna = True )
1174
- expected = Series ([0.5 , 0.5 ], index = Series ([2.0 , 1.0 ], dtype = t ))
1172
+ expected = Series ([0.6 , 0.4 ], index = Series ([2.0 , 1.0 ], dtype = t ))
1175
1173
tm .assert_series_equal (result , expected )
1176
1174
1177
1175
def test_value_counts_uint64 (self ):
0 commit comments