@@ -1608,11 +1608,12 @@ def setUp(self):
1608
1608
self .factor = Categorical (['a' , 'b' , 'b' , 'a' , 'a' , 'c' , 'c' , 'c' ])
1609
1609
1610
1610
df = DataFrame ({'value' : np .random .randint (0 , 10000 , 100 )})
1611
- labels = [ "{0} - {1}" .format (i , i + 499 ) for i in range (0 , 10000 , 500 ) ]
1611
+ labels = ["{0} - {1}" .format (i , i + 499 ) for i in range (0 , 10000 , 500 )]
1612
1612
cat_labels = Categorical (labels , labels )
1613
1613
1614
1614
df = df .sort_values (by = ['value' ], ascending = True )
1615
- df ['value_group' ] = pd .cut (df .value , range (0 , 10500 , 500 ), right = False , labels = cat_labels )
1615
+ df ['value_group' ] = pd .cut (df .value , range (0 , 10500 , 500 ),
1616
+ right = False , labels = cat_labels )
1616
1617
self .cat = df
1617
1618
1618
1619
def test_dtypes (self ):
@@ -2019,8 +2020,10 @@ def test_series_functions_no_warnings(self):
2019
2020
2020
2021
def test_assignment_to_dataframe (self ):
2021
2022
# assignment
2022
- df = DataFrame ({'value' : np .array (np .random .randint (0 , 10000 , 100 ),dtype = 'int32' )})
2023
- labels = Categorical (["{0} - {1}" .format (i , i + 499 ) for i in range (0 , 10000 , 500 )])
2023
+ df = DataFrame ({'value' : np .array (
2024
+ np .random .randint (0 , 10000 , 100 ), dtype = 'int32' )})
2025
+ labels = Categorical (["{0} - {1}" .format (i , i + 499 )
2026
+ for i in range (0 , 10000 , 500 )])
2024
2027
2025
2028
df = df .sort_values (by = ['value' ], ascending = True )
2026
2029
s = pd .cut (df .value , range (0 , 10500 , 500 ), right = False , labels = labels )
@@ -3134,7 +3137,7 @@ def test_slicing(self):
3134
3137
df = DataFrame ({'value' : (np .arange (100 ) + 1 ).astype ('int64' )})
3135
3138
df ['D' ] = pd .cut (df .value , bins = [0 , 25 , 50 , 75 , 100 ])
3136
3139
3137
- expected = Series ([11 , Interval (0 , 25 )], index = ['value' ,'D' ], name = 10 )
3140
+ expected = Series ([11 , Interval (0 , 25 )], index = ['value' , 'D' ], name = 10 )
3138
3141
result = df .iloc [10 ]
3139
3142
tm .assert_series_equal (result , expected )
3140
3143
@@ -3144,7 +3147,7 @@ def test_slicing(self):
3144
3147
result = df .iloc [10 :20 ]
3145
3148
tm .assert_frame_equal (result , expected )
3146
3149
3147
- expected = Series ([9 , Interval (0 , 25 )],index = ['value' , 'D' ], name = 8 )
3150
+ expected = Series ([9 , Interval (0 , 25 )], index = ['value' , 'D' ], name = 8 )
3148
3151
result = df .loc [8 ]
3149
3152
tm .assert_series_equal (result , expected )
3150
3153
0 commit comments