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