@@ -133,7 +133,8 @@ def create_pickle_data():
133133 data = {
134134 "A" : [0.0 , 1.0 , 2.0 , 3.0 , np .nan ],
135135 "B" : [0 , 1 , 0 , 1 , 0 ],
136- "C" : ["foo1" , "foo2" , "foo3" , "foo4" , "foo5" ],
136+ # "C": ["foo1", "foo2", "foo3", "foo4", "foo5"],
137+ "C" : Series (["foo1" , "foo2" , "foo3" , "foo4" , "foo5" ], dtype = object ),
137138 "D" : date_range ("1/1/2009" , periods = 5 ),
138139 "E" : [0.0 , 1 , Timestamp ("20100101" ), "foo" , 2.0 ],
139140 }
@@ -180,8 +181,16 @@ def create_pickle_data():
180181 tuple (zip (* [[1 , 1 , 2 , 2 , 2 ], [3 , 4 , 3 , 4 , 5 ]])), names = ["one" , "two" ]
181182 ),
182183 ),
183- "dup" : Series (np .arange (5 ).astype (np .float64 ), index = ["A" , "B" , "C" , "D" , "A" ]),
184- "cat" : Series (Categorical (["foo" , "bar" , "baz" ])),
184+ "dup" : Series (
185+ np .arange (5 ).astype (np .float64 ),
186+ index = Index (["A" , "B" , "C" , "D" , "A" ], dtype = object ),
187+ ),
188+ # "cat": Series(Categorical(["foo", "bar", "baz"])),
189+ "cat" : Series (
190+ Categorical .from_codes (
191+ [2 , 0 , 1 ], categories = Index (["bar" , "baz" , "foo" ], dtype = "object" )
192+ )
193+ ),
185194 "dt" : Series (date_range ("20130101" , periods = 5 )),
186195 "dt_tz" : Series (date_range ("20130101" , periods = 5 , tz = "US/Eastern" )),
187196 "period" : Series ([Period ("2000Q1" )] * 5 ),
@@ -210,26 +219,36 @@ def create_pickle_data():
210219 "dup" : DataFrame (
211220 np .arange (15 ).reshape (5 , 3 ).astype (np .float64 ), columns = ["A" , "B" , "A" ]
212221 ),
213- "cat_onecol" : DataFrame ({"A" : Categorical (["foo" , "bar" ])}),
222+ # "cat_onecol": DataFrame({"A": Categorical(["foo", "bar"])}),
223+ "cat_onecol" : DataFrame (
224+ {
225+ "A" : Categorical .from_codes (
226+ [1 , 0 ], categories = Index (["bar" , "foo" ], dtype = "object" )
227+ )
228+ }
229+ ),
214230 "cat_and_float" : DataFrame (
215231 {
216- "A" : Categorical (["foo" , "bar" , "baz" ]),
232+ # "A": Categorical(["foo", "bar", "baz"]),
233+ "A" : Categorical .from_codes (
234+ [2 , 0 , 1 ], categories = Index (["bar" , "baz" , "foo" ], dtype = "object" )
235+ ),
217236 "B" : np .arange (3 ).astype (np .int64 ),
218237 }
219238 ),
220239 "mixed_dup" : mixed_dup_df ,
221240 "dt_mixed_tzs" : DataFrame (
222241 {
223- "A" : Timestamp ("20130102" , tz = "US/Eastern" ),
224- "B" : Timestamp ("20130603" , tz = "CET" ),
242+ "A" : Timestamp ("20130102" , tz = "US/Eastern" ). as_unit ( "ns" ) ,
243+ "B" : Timestamp ("20130603" , tz = "CET" ). as_unit ( "ns" ) ,
225244 },
226245 index = range (5 ),
227246 ),
228247 "dt_mixed2_tzs" : DataFrame (
229248 {
230- "A" : Timestamp ("20130102" , tz = "US/Eastern" ),
231- "B" : Timestamp ("20130603" , tz = "CET" ),
232- "C" : Timestamp ("20130603" , tz = "UTC" ),
249+ "A" : Timestamp ("20130102" , tz = "US/Eastern" ). as_unit ( "ns" ) ,
250+ "B" : Timestamp ("20130603" , tz = "CET" ). as_unit ( "ns" ) ,
251+ "C" : Timestamp ("20130603" , tz = "UTC" ). as_unit ( "ns" ) ,
233252 },
234253 index = range (5 ),
235254 ),
@@ -245,6 +264,9 @@ def create_pickle_data():
245264 "normal" : Timestamp ("2011-01-01" ),
246265 "nat" : NaT ,
247266 "tz" : Timestamp ("2011-01-01" , tz = "US/Eastern" ),
267+ # kept because those are present in the legacy pickles (<= 1.4)
268+ "freq" : Timestamp ("2011-01-01" ),
269+ "both" : Timestamp ("2011-01-01" , tz = "Asia/Tokyo" ),
248270 }
249271
250272 off = {
0 commit comments