@@ -52,6 +52,11 @@ def test_variable_type():
52
52
assert variable_type (s , boolean_type = "categorical" ) == "categorical"
53
53
assert variable_type (s , boolean_type = "boolean" ) == "boolean"
54
54
55
+ # This should arguably be datmetime, but we don't currently handle it correctly
56
+ # Test is mainly asserting that this doesn't fail on the boolean check.
57
+ s = pd .timedelta_range (1 , periods = 3 , freq = "D" ).to_series ()
58
+ assert variable_type (s ) == "categorical"
59
+
55
60
s_cat = s .astype ("category" )
56
61
assert variable_type (s_cat , boolean_type = "categorical" ) == "categorical"
57
62
assert variable_type (s_cat , boolean_type = "numeric" ) == "categorical"
@@ -61,6 +66,9 @@ def test_variable_type():
61
66
assert variable_type (s , boolean_type = "boolean" ) == "boolean"
62
67
assert variable_type (s , boolean_type = "boolean" , strict_boolean = True ) == "numeric"
63
68
69
+ s = pd .Series ([1 , 0 , 0 ])
70
+ assert variable_type (s , boolean_type = "boolean" ) == "boolean"
71
+
64
72
s = pd .Series ([pd .Timestamp (1 ), pd .Timestamp (2 )])
65
73
assert variable_type (s ) == "datetime"
66
74
assert variable_type (s .astype (object )) == "datetime"
0 commit comments