1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Ë
oñúh(ãób—dZddlmZddlZddlZddlZddlZejjd«ddl
Z ddl Z ddl m Z mZmZmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1d„Z2d„Z3d    „Z4d
„Z5d „Z6d „Z7d „Z8e9dk(re8«yy)a˜
self-contained to write legacy storage pickle files
 
To use this script. Create an environment where you want
generate pickles, say its for 0.20.3, with your pandas clone
in ~/pandas
 
. activate pandas_0.20.3
cd ~/pandas/pandas
 
$ python -m tests.io.generate_legacy_storage_files     tests/io/data/legacy_pickle/0.20.3/ pickle
 
This script generates a storage file for the current arch, system,
and python version
  pandas version: 0.20.3
  output dir    : pandas/pandas/tests/io/data/legacy_pickle/0.20.3/
  storage format: pickle
created pickle file: 0.20.3_x86_64_darwin_3.5.2.pickle
 
The idea here is you are using the *current* version of the
generate_legacy_storage_files with an *older* version of pandas to
generate a pickle file. We will then check this file into a current
branch, and test using test_pickle.py. This will load the *older*
pickles and test versus the current data that is generated
(with main). These are then compared.
 
If we have cases where we changed the signature (e.g. we renamed
offset -> freq in Timestamp). Then we have to conditionally execute
in the generate_legacy_storage_files.py to make it
run under the older AND the newer version.
 
é)Ú    timedeltaN)Ú CategoricalÚ    DataFrameÚIndexÚ
MultiIndexÚNaTÚPeriodÚ
RangeIndexÚSeriesÚ    TimestampÚ bdate_rangeÚ
date_rangeÚinterval_rangeÚ period_rangeÚtimedelta_range)Ú SparseArray)ÚFY5253Ú BusinessDayÚ BusinessHourÚCustomBusinessDayÚ
DateOffsetÚDayÚEasterÚHourÚLastWeekOfMonthÚMinuteÚ
MonthBeginÚMonthEndÚ QuarterBeginÚ
QuarterEndÚSemiMonthBeginÚ SemiMonthEndÚWeekÚ WeekOfMonthÚ    YearBeginÚYearEndcó¾—tj}tjdtj¬«}||dd||ddt    t |d¬««}d|_|S)    Né©Údtypeéé éÿÿÿÿÚblock©ÚkindÚbseries)ÚnpÚnanÚarangeÚfloat64r rÚname)r3Úarrr1s   ú`H:\Change_password\venv_build\Lib\site-packages\pandas/tests/io/generate_legacy_storage_files.pyÚ_create_sp_seriesr9ZsT€Ü
&‰&€Cô )‰)BœbŸj™jÔ
)€CØ€Cˆˆ"€IØ€Cˆˆ€Hä”[ ¨7Ô3Ó4€GØ€G„LØ €Nócóî—tj}tjdtj¬«}||dd||ddt    dt |«¬«}t t|d¬    «|¬
«}d |_|S) Nr(r)r+r,r-ú1/1/2011©Úperiodsr.r/©ÚindexÚ    btsseries)    r2r3r4r5r Úlenr rr6)r3r7Ú
date_indexr1s    r8Ú_create_sp_tsseriesrDgsf€Ü
&‰&€Cô )‰)BœbŸj™jÔ
)€CØ€Cˆˆ"€IØ€Cˆˆ€Hä˜Z´°S³Ô:€JÜ”[ ¨7Ô3¸:ÔF€GØ€G„LØ €Nr:c ó&—tj}|||dddddddg
ddd|||ddddg
tjd«jtj«dddddd||||g
d    œ}t d
d¬ «}t ||¬ «jt«S) Nrééééééé
©ÚAÚBÚCÚDr<r=r?)    r2r3r4ÚastypeÚint64r rÚapplyr)r3ÚdataÚdatess   r8Ú_create_sp_framerWusœ€Ü
&‰&€Cð3˜˜Q  1 a¨¨A¨qÐ 1ؐAs˜C  a¨¨A¨qÐ 1Ü Y‰Yr‹]× !Ñ !¤"§(¡(Ó +ؐAq˜!˜Q  S¨#¨sÐ 3ñ     €Dô ˜
¨BÔ /€EÜ T Ô '× -Ñ -¬kÓ :Ð:r:cóŠ —ddddtjggd¢gd¢tdd¬    «dd
td «d dgd œ}td«t    dd«dœ}t tj d««tdd¬    «tddd¬«t tj dtj¬««t tj dtj¬««tddd¬«t gd¢d¬«dœ}td«|d<tdd¬    «|d<dtjtt!gd¢gd ¢gŽ«d!d"g¬#«i}t#|d$«t#|d%«t#|d&«t#tj d«j%tj&«tdd¬    «¬'«t#tj d«j%tj«tjtt!gd(¢gd)¢gŽ«d*d+g¬#«¬'«t#tj d«j%tj«gd,¢¬'«t#t)gd-¢««t#tdd¬    ««t#tddd.¬/««t#t    d0«gdz«t#gd¢d¬«d1œ }t+|«}t-d2«|_t+|d3|d3d
zd4œ«t+|d5|d5d
zd4œ«t+d6Dcic]}|||“Œ
c}«t+tj d«j%tj«tj d«j%tj&«d4œtjtt!gd7¢gd8¢gŽ«d!d"g¬#«¬'«t+tj d9«j1dd:«j%tj«gd;¢¬<«t+d$t)d d=g«i«t+t)gd-¢«tj d:«j%tj&«d4œ«|t+td>d.¬?«td@dA¬?«d4œt3d«¬'«t+td>d.¬?«td@dA¬?«td@dB¬?«dCœt3d«¬'«t+t#gd¢d¬«t#gd8¢d¬«d4œ«dDœ }t)t-dE««t)tj dF««t)tj dG««dHœ}tdI«t4tdId.¬?«dJœ}    idKt7d
¬L«“dMt7dNdO¬P«“dQt9t;dR¬S«¬T«“dUt=dVdNdW¬X«“dYt?dZ¬[«“d\tAdR¬]«“d^tCd_¬]«“d`tEd
«“datGd
«“dbtId
«“dctKd
«“ddtMd
«“detOd
«“dftQd
«“dgtSd
«“dhtSdidjd
¬k«“dltUd:dm¬n«“tWd
d:¬o«tYdidNdpdq¬r«t[«t]d
«t_d
«dsœ¥}
|||||ta«tc«dtœd3te«i||    |
duœ
Scc}w)vzcreate the pickle dataggð?g@g@)rrFrrFr)Úfoo1Úfoo2Úfoo3Úfoo4Úfoo5z1/1/2009rJr=rFÚ20100101Úfoo)rNrOrPrQÚEÚ20130101Ú2012ÚM)Ú    timestampÚperiodrLz
2013-01-01)Úfreqr>r)z00:00:00Ú30min)r_ÚbarÚbazÚquxÚquuxÚstring)ÚintÚdatereÚfloatÚuintrrlÚrangerÚintervalÚreg2)rhrhririr_r_rjrj)ÚoneÚtwortrurtrurtruÚfirstÚsecond)ÚnamesrNrOr`r?)rFrFrGrGrG)rHrIrHrIrJrtru)rNrOrPrQrN)r_rhriz
US/Eastern)r>ÚtzÚ2000Q1) rormÚmixedÚtsÚmiÚdupÚcatÚdtÚdt_tzrerlÚABCDAro)rNrOrmrM)rhrhririri)rtrurtruÚthreer(rH)rNrOrN)ÚcolumnsrhÚ20130102)ryÚ20130603ÚCETÚUTC)rNrOrP) rormr{r}r~Ú
cat_onecolÚ cat_and_floatÚ    mixed_dupÚ dt_mixed_tzsÚ dt_mixed2_tzsrlÚabcdefgièi')Úint8Úint16Úint32z
2011-01-01)ÚnormalÚnatryr)ÚyearsÚDateOffset_h_nsrKiÀ)ÚhourÚ nanosecondsré    )Úseconds)ÚoffsetrTz15:14)Ú    normalizeÚnÚendrzMon Fri)Úweekmaskr!)Ú day_of_monthr"érrrr rr%r&r#Ú    Week_TuesrGF)r›Úweekdayr$rI)Úweekr¢)rœr¢r+Úlast)rœr¢Ú startingMonthÚ    variation)rrrrr)ror|)
ÚseriesÚframer@Úscalarsr}Ú    sp_seriesÚsp_framerrdÚoffsets)3r2r3rr r    rr4rr5Úuint64rr
rrÚ from_tuplesÚtupleÚzipr rRrSrrÚlistr„Úreshaperqrrrrrrr!r"rrrr rr%r&r#r$rrrrrr9rDrW) rUr©r@r}r§Ú mixed_dup_dfÚkr¨rrdÚoffs            r8Úcreate_pickle_datar¶ƒs€ð3˜˜S¤"§&¡&Ð )Ú Ú 5Ü ˜
¨AÔ .ؐ1”i 
Ó+¨U°CÐ 8ñ  €Dô& jÓ1¼VÀFÈCÓ=PÑQ€Gô”R—Y‘Y˜r“]Ó#ܘ:¨rÔ2ܘ|°#¸rÔBÜ”r—y‘y ¬2¯:©:Ô6Ó7Ü”b—i‘i ¬"¯)©)Ô4Ó5Ü$ Z°gÀrÔJÜÒ<ÀHÔMñ €Eô  “^€Eˆ'Nä& q°"Ô5€Eˆ*Ñð    ”
×&Ñ&Ü ÜâPÚPððó ð˜HÐ%ô
 
ð
€Bô˜˜S™    Ó"ܐd˜3‘iӠܘ˜S™    Ó"ÜÜ I‰Ib‹M×  Ñ  ¤§¡Ó *´*¸ZÐQSÔ2Tô
ôÜ I‰Ia‹L× Ñ ¤§
¡
Ó +Ü×(Ñ(Ü”cšOª_Ð=Ð>Ó?ÈÈuÀ~ôô
ô ”b—i‘i “l×)Ñ)¬"¯*©*Ó5Ò=VÔWÜ”kÒ"7Ó8Ó9Ü”Z 
°AÔ6Ó7Üœ
 :°q¸\ÔJÓKÜœ& Ó*Ð+¨aÑ/Ó0ÜÒ=ÀXÔNñ%€Fô*˜T“?€LÜ ›=€LÔä ¨¡°v¸g±ÈÑ7JÑKÓLܘv e™}°6¸%±=À1Ñ3DÑEÓFÜÐ0DÖE¨1˜A˜t A™w™JÒEÓFÜÜ—)‘)˜A“,×%Ñ%¤b§j¡jÓ1¼¿    ¹    À!» ×8KÑ8KÌBÏHÉHÓ8UÑ VÜ×(Ñ(ÜÜâ?ÚAððóð Ð)ô
ô 
ôÜ I‰Ib‹M× !Ñ ! ! QÓ '× .Ñ .¬r¯z©zÓ :ÂOô
ô  ¤k°5¸%°.Ó&AРBÓCÜ"ä Ò!6Ó7Ü—Y‘Y˜q“\×(Ñ(¬¯©Ó2ñ ó
ð "Ü!ä˜z¨lÔ;ܘz¨eÔ4ñ ô˜“(ô 
ô#ä˜z¨lÔ;ܘz¨eÔ4ܘz¨eÔ4ñ ô
˜“(ô 
ôäÒ@ÈÔQÜÒAÈÔRñ ó
ñY2 €EôjœD ›OÓ,ÜœRŸY™Y t›_Ó-ÜœRŸY™Y uÓ-Ó.ñ €Cô˜LÓ)Üܘ ¨Ô6ñ€Ið  Ø”j qÔ)ð àœ:¨1¸$Ô?ð ð    ”{¬)¸AÔ*>Ô?ð ð    œ ¨t°q¸gÔFð     ð
    Ô.¸    ÔBð  ð     œ.°aÔ8ð  ð    œ °"Ô5ð ð    ”j “mð ð    ”H˜Q“Kð ð    œ  Q›ð ð    ”j “mð ð    Œs1‹vð ð    ”Y˜q“\ð ð    ”7˜1“:ð ð    ”Q“ð ð     ”T˜! u°aÔ8ð! ð"    ”{¨°1Ô5ð# ô$+¨Q¸Ô:ܘ1 a°qÀFÔKÜ“(ܐQ“ܘ“)ò- €Cð4ØØØØÜ0Ó2Ô:MÓ:OÑPØÔ.Ó0Ð1ØØØñ ð ùòmFsÌ [ c    ó—djttj«tt    j
««tt    j «j««tt    j««g«S)NÚ_)    ÚjoinÚstrÚpandasÚ __version__ÚplÚmachineÚsystemÚlowerÚpython_version©r:r8Ú platform_namerÃ)s\€Ø 8‰8ä ”×"Ñ"Ó #Ü ”—
‘
“ Ó Ü ”—    ‘    “ ×!Ñ!Ó#Ó $Ü ”×!Ñ!Ó#Ó $ð        
ó ðr:có–—tj}td«td|›«td|›«td«t«›d}t    t
j j||«d«5}tjt«|tj«ddd«td|›«y#1swYŒxYw)NzUThis script generates a storage file for the current arch, system, and python versionz  pandas version: z  output dir    : z  storage format: picklez.pickleÚwbzcreated pickle file: ) r»r¼ÚprintrÃÚopenÚosÚpathr¹ÚpickleÚdumpr¶ÚDEFAULT_PROTOCOL)Ú
output_dirÚversionÚpthÚfhs    r8Úwrite_legacy_picklesrÑ4s´€Ü× Ñ €Gä    ð    ôô
Ð ˜w˜iÐ
(Ô)Ü    Ð ˜z˜lÐ
+Ô,Ü    Ð
$Ô%ä ‹_Ð ˜WÐ
%€Cä     Œbg‰gl‰l˜: sÓ+¨TÓ    2ðG°b܏ ‰ Ô&Ó(¨"¬f×.EÑ.EÔF÷Gô
Ð ! # Ð
'Õ(÷GðGús Á:.B?Â?CcóÜ—tjjdd«dttj«cxkrdksntj
d«t tjd«}t tjd«}tjj|«stj|«|dk(r t|¬    «ytj
d
«y) NrÚrHrIzhSpecify output directory and storage type: generate_legacy_storage_files.py <output_dir> <storage_type> rFrGrÊ)rÍz&storage_type must be one of {'pickle'}) ÚsysrÉÚinsertrBÚargvÚexitrºrÈÚexistsÚmkdirrÑ)rÍÚ storage_types  r8Úwrite_legacy_filerÛGs™€ä‡HH‡OOArÔà ””C—H‘H“ Ô " Ô "Ü ‰ð <ô    
ô
”S—X‘X˜a‘[Ó!€JÜ”s—x‘x ‘{Ó#€Lä 7‰7>‰>˜*Ô %Ü
‰ÔàxÒܨ
Ö3ä ‰Ð9Õ:r:Ú__main__):Ú__doc__ÚdatetimerrÈrÊÚplatformr½rÔrÉÚpopÚnumpyr2r»rrrrrr    r
r r r rrrrÚ pandas.arraysrÚpandas.tseries.offsetsrrrrrrrrrrrrrr r!r"r#r$r%r&r9rDrWr¶rÃrÑrÛÚ__name__rÂr:r8ú<module>rås¤ðñ õDÛ    Û ÛÛ
ð‡‡  ˆQ„ãã ÷÷÷÷õ &÷÷÷÷÷óò0
ò ò ;òcòLò)ò&;ð, ˆzÒÙÕðr: