File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,21 +102,24 @@ def test_get_data_pandas(self):
102102 assert isinstance (data , pd .DataFrame )
103103 assert data .shape [1 ] == len (self .titanic .features )
104104 assert data .shape [0 ] == 1309
105+ # Dynamically detect what this version of Pandas calls string columns.
106+ str_dtype = data ["name" ].dtype .name
107+
105108 col_dtype = {
106109 "pclass" : "uint8" ,
107110 "survived" : "category" ,
108- "name" : "str" ,
111+ "name" : str_dtype ,
109112 "sex" : "category" ,
110113 "age" : "float64" ,
111114 "sibsp" : "uint8" ,
112115 "parch" : "uint8" ,
113- "ticket" : "str" ,
116+ "ticket" : str_dtype ,
114117 "fare" : "float64" ,
115- "cabin" : "str" ,
118+ "cabin" : str_dtype ,
116119 "embarked" : "category" ,
117- "boat" : "str" ,
120+ "boat" : str_dtype ,
118121 "body" : "float64" ,
119- "home.dest" : "str" ,
122+ "home.dest" : str_dtype ,
120123 }
121124 for col_name in data .columns :
122125 assert data [col_name ].dtype .name == col_dtype [col_name ]
You can’t perform that action at this time.
0 commit comments