@@ -3186,7 +3186,7 @@ def test_all(self):
3186
3186
3187
3187
class TestTimedelta64Formatter :
3188
3188
def test_days (self ):
3189
- x = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "D" )
3189
+ x = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "D" ). _values
3190
3190
result = fmt ._Timedelta64Formatter (x , box = True ).get_result ()
3191
3191
assert result [0 ].strip () == "'0 days'"
3192
3192
assert result [1 ].strip () == "'1 days'"
@@ -3202,48 +3202,48 @@ def test_days(self):
3202
3202
assert result [0 ].strip () == "1 days"
3203
3203
3204
3204
def test_days_neg (self ):
3205
- x = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "D" )
3205
+ x = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "D" ). _values
3206
3206
result = fmt ._Timedelta64Formatter (- x , box = True ).get_result ()
3207
3207
assert result [0 ].strip () == "'0 days'"
3208
3208
assert result [1 ].strip () == "'-1 days'"
3209
3209
3210
3210
def test_subdays (self ):
3211
- y = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "s" )
3211
+ y = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "s" ). _values
3212
3212
result = fmt ._Timedelta64Formatter (y , box = True ).get_result ()
3213
3213
assert result [0 ].strip () == "'0 days 00:00:00'"
3214
3214
assert result [1 ].strip () == "'0 days 00:00:01'"
3215
3215
3216
3216
def test_subdays_neg (self ):
3217
- y = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "s" )
3217
+ y = pd .to_timedelta (list (range (5 )) + [NaT ], unit = "s" ). _values
3218
3218
result = fmt ._Timedelta64Formatter (- y , box = True ).get_result ()
3219
3219
assert result [0 ].strip () == "'0 days 00:00:00'"
3220
3220
assert result [1 ].strip () == "'-1 days +23:59:59'"
3221
3221
3222
3222
def test_zero (self ):
3223
- x = pd .to_timedelta (list (range (1 )) + [NaT ], unit = "D" )
3223
+ x = pd .to_timedelta (list (range (1 )) + [NaT ], unit = "D" ). _values
3224
3224
result = fmt ._Timedelta64Formatter (x , box = True ).get_result ()
3225
3225
assert result [0 ].strip () == "'0 days'"
3226
3226
3227
- x = pd .to_timedelta (list (range (1 )), unit = "D" )
3227
+ x = pd .to_timedelta (list (range (1 )), unit = "D" ). _values
3228
3228
result = fmt ._Timedelta64Formatter (x , box = True ).get_result ()
3229
3229
assert result [0 ].strip () == "'0 days'"
3230
3230
3231
3231
3232
3232
class Test_Datetime64Formatter :
3233
3233
def test_mixed (self ):
3234
- x = Series ([datetime (2013 , 1 , 1 ), datetime (2013 , 1 , 1 , 12 ), NaT ])
3234
+ x = Series ([datetime (2013 , 1 , 1 ), datetime (2013 , 1 , 1 , 12 ), NaT ]). _values
3235
3235
result = fmt ._Datetime64Formatter (x ).get_result ()
3236
3236
assert result [0 ].strip () == "2013-01-01 00:00:00"
3237
3237
assert result [1 ].strip () == "2013-01-01 12:00:00"
3238
3238
3239
3239
def test_dates (self ):
3240
- x = Series ([datetime (2013 , 1 , 1 ), datetime (2013 , 1 , 2 ), NaT ])
3240
+ x = Series ([datetime (2013 , 1 , 1 ), datetime (2013 , 1 , 2 ), NaT ]). _values
3241
3241
result = fmt ._Datetime64Formatter (x ).get_result ()
3242
3242
assert result [0 ].strip () == "2013-01-01"
3243
3243
assert result [1 ].strip () == "2013-01-02"
3244
3244
3245
3245
def test_date_nanos (self ):
3246
- x = Series ([Timestamp (200 )])
3246
+ x = Series ([Timestamp (200 )]). _values
3247
3247
result = fmt ._Datetime64Formatter (x ).get_result ()
3248
3248
assert result [0 ].strip () == "1970-01-01 00:00:00.000000200"
3249
3249
@@ -3252,41 +3252,41 @@ def test_dates_display(self):
3252
3252
# make sure that we are consistently display date formatting
3253
3253
x = Series (date_range ("20130101 09:00:00" , periods = 5 , freq = "D" ))
3254
3254
x .iloc [1 ] = np .nan
3255
- result = fmt ._Datetime64Formatter (x ).get_result ()
3255
+ result = fmt ._Datetime64Formatter (x . _values ).get_result ()
3256
3256
assert result [0 ].strip () == "2013-01-01 09:00:00"
3257
3257
assert result [1 ].strip () == "NaT"
3258
3258
assert result [4 ].strip () == "2013-01-05 09:00:00"
3259
3259
3260
3260
x = Series (date_range ("20130101 09:00:00" , periods = 5 , freq = "s" ))
3261
3261
x .iloc [1 ] = np .nan
3262
- result = fmt ._Datetime64Formatter (x ).get_result ()
3262
+ result = fmt ._Datetime64Formatter (x . _values ).get_result ()
3263
3263
assert result [0 ].strip () == "2013-01-01 09:00:00"
3264
3264
assert result [1 ].strip () == "NaT"
3265
3265
assert result [4 ].strip () == "2013-01-01 09:00:04"
3266
3266
3267
3267
x = Series (date_range ("20130101 09:00:00" , periods = 5 , freq = "ms" ))
3268
3268
x .iloc [1 ] = np .nan
3269
- result = fmt ._Datetime64Formatter (x ).get_result ()
3269
+ result = fmt ._Datetime64Formatter (x . _values ).get_result ()
3270
3270
assert result [0 ].strip () == "2013-01-01 09:00:00.000"
3271
3271
assert result [1 ].strip () == "NaT"
3272
3272
assert result [4 ].strip () == "2013-01-01 09:00:00.004"
3273
3273
3274
3274
x = Series (date_range ("20130101 09:00:00" , periods = 5 , freq = "us" ))
3275
3275
x .iloc [1 ] = np .nan
3276
- result = fmt ._Datetime64Formatter (x ).get_result ()
3276
+ result = fmt ._Datetime64Formatter (x . _values ).get_result ()
3277
3277
assert result [0 ].strip () == "2013-01-01 09:00:00.000000"
3278
3278
assert result [1 ].strip () == "NaT"
3279
3279
assert result [4 ].strip () == "2013-01-01 09:00:00.000004"
3280
3280
3281
3281
x = Series (date_range ("20130101 09:00:00" , periods = 5 , freq = "ns" ))
3282
3282
x .iloc [1 ] = np .nan
3283
- result = fmt ._Datetime64Formatter (x ).get_result ()
3283
+ result = fmt ._Datetime64Formatter (x . _values ).get_result ()
3284
3284
assert result [0 ].strip () == "2013-01-01 09:00:00.000000000"
3285
3285
assert result [1 ].strip () == "NaT"
3286
3286
assert result [4 ].strip () == "2013-01-01 09:00:00.000000004"
3287
3287
3288
3288
def test_datetime64formatter_yearmonth (self ):
3289
- x = Series ([datetime (2016 , 1 , 1 ), datetime (2016 , 2 , 2 )])
3289
+ x = Series ([datetime (2016 , 1 , 1 ), datetime (2016 , 2 , 2 )]). _values
3290
3290
3291
3291
def format_func (x ):
3292
3292
return x .strftime ("%Y-%m" )
@@ -3298,7 +3298,7 @@ def format_func(x):
3298
3298
def test_datetime64formatter_hoursecond (self ):
3299
3299
x = Series (
3300
3300
pd .to_datetime (["10:10:10.100" , "12:12:12.120" ], format = "%H:%M:%S.%f" )
3301
- )
3301
+ ). _values
3302
3302
3303
3303
def format_func (x ):
3304
3304
return x .strftime ("%H:%M" )
0 commit comments