400 KB
/srv/reproducible-results/rbuild-debian/r-b-build.CPQD7Kdd/b1/pandas_2.2.3+dfsg-9_i386.changes vs.
/srv/reproducible-results/rbuild-debian/r-b-build.CPQD7Kdd/b2/pandas_2.2.3+dfsg-9_i386.changes
522 B
Files
    
Offset 1, 5 lines modifiedOffset 1, 5 lines modified
  
1 ·39f30fe22772d4b07a6d835e9f71373d·10795276·doc·optional·python-pandas-doc_2.2.3+dfsg-9_all.deb1 ·926cd03e08958cb2271d3a7c4015e91a·10795400·doc·optional·python-pandas-doc_2.2.3+dfsg-9_all.deb
2 ·ff4af08d5d4be9b6503081ef9dc78c9f·34673412·debug·optional·python3-pandas-lib-dbgsym_2.2.3+dfsg-9_i386.deb2 ·ff4af08d5d4be9b6503081ef9dc78c9f·34673412·debug·optional·python3-pandas-lib-dbgsym_2.2.3+dfsg-9_i386.deb
3 ·9fa8e6a808a40e70629057e4c8befb8e·4409080·python·optional·python3-pandas-lib_2.2.3+dfsg-9_i386.deb3 ·9fa8e6a808a40e70629057e4c8befb8e·4409080·python·optional·python3-pandas-lib_2.2.3+dfsg-9_i386.deb
4 ·6f05a87b66230b056112f4c7c394692b·3096828·python·optional·python3-pandas_2.2.3+dfsg-9_all.deb4 ·6f05a87b66230b056112f4c7c394692b·3096828·python·optional·python3-pandas_2.2.3+dfsg-9_all.deb
399 KB
python-pandas-doc_2.2.3+dfsg-9_all.deb
452 B
file list
    
Offset 1, 3 lines modifiedOffset 1, 3 lines modified
1 -rw-r--r--···0········0········0········4·2025-03-29·13:01:52.000000·debian-binary1 -rw-r--r--···0········0········0········4·2025-03-29·13:01:52.000000·debian-binary
2 -rw-r--r--···0········0········0···147376·2025-03-29·13:01:52.000000·control.tar.xz2 -rw-r--r--···0········0········0···147392·2025-03-29·13:01:52.000000·control.tar.xz
3 -rw-r--r--···0········0········0·10647708·2025-03-29·13:01:52.000000·data.tar.xz3 -rw-r--r--···0········0········0·10647816·2025-03-29·13:01:52.000000·data.tar.xz
604 B
control.tar.xz
576 B
control.tar
506 B
./control
    
Offset 1, 13 lines modifiedOffset 1, 13 lines modified
1 Package:·python-pandas-doc1 Package:·python-pandas-doc
2 Source:·pandas2 Source:·pandas
3 Version:·2.2.3+dfsg-93 Version:·2.2.3+dfsg-9
4 Architecture:·all4 Architecture:·all
5 Maintainer:·Debian·Science·Team·<debian-science-maintainers@lists.alioth.debian.org>5 Maintainer:·Debian·Science·Team·<debian-science-maintainers@lists.alioth.debian.org>
6 Installed-Size:·2099066 Installed-Size:·209904
7 Depends:·libjs-sphinxdoc·(>=·8.1),·libjs-mathjax7 Depends:·libjs-sphinxdoc·(>=·8.1),·libjs-mathjax
8 Suggests:·python3-pandas8 Suggests:·python3-pandas
9 Section:·doc9 Section:·doc
10 Priority:·optional10 Priority:·optional
11 Multi-Arch:·foreign11 Multi-Arch:·foreign
12 Homepage:·https://pandas.pydata.org/12 Homepage:·https://pandas.pydata.org/
13 Description:·data·structures·for·"relational"·or·"labeled"·data·-·documentation13 Description:·data·structures·for·"relational"·or·"labeled"·data·-·documentation
48.0 B
./md5sums
30.0 B
./md5sums
Files differ
398 KB
data.tar.xz
398 KB
data.tar
12.2 KB
file list
    
Offset 6256, 74 lines modifiedOffset 6256, 74 lines modified
6256 -rw-r--r--···0·root·········(0)·root·········(0)···210184·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/series.html6256 -rw-r--r--···0·root·········(0)·root·········(0)···210184·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/series.html
6257 -rw-r--r--···0·root·········(0)·root·········(0)····48665·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/style.html6257 -rw-r--r--···0·root·········(0)·root·········(0)····48665·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/style.html
6258 -rw-r--r--···0·root·········(0)·root·········(0)····48657·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/testing.html6258 -rw-r--r--···0·root·········(0)·root·········(0)····48657·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/testing.html
6259 -rw-r--r--···0·root·········(0)·root·········(0)····53295·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/window.html6259 -rw-r--r--···0·root·········(0)·root·········(0)····53295·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reference/window.html
6260 -rw-r--r--···0·root·········(0)·root·········(0)······244·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/release.html6260 -rw-r--r--···0·root·········(0)·root·········(0)······244·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/release.html
6261 -rw-r--r--···0·root·········(0)·root·········(0)······269·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reshaping.html6261 -rw-r--r--···0·root·········(0)·root·········(0)······269·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/reshaping.html
6262 -rw-r--r--···0·root·········(0)·root·········(0)····17010·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/search.html6262 -rw-r--r--···0·root·········(0)·root·········(0)····17010·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/search.html
6263 -rw-r--r--···0·root·········(0)·root·········(0)··2359369·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/searchindex.js6263 -rw-r--r--···0·root·········(0)·root·········(0)··2359162·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/searchindex.js
6264 -rw-r--r--···0·root·········(0)·root·········(0)······259·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/sparse.html6264 -rw-r--r--···0·root·········(0)·root·········(0)······259·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/sparse.html
6265 -rw-r--r--···0·root·········(0)·root·········(0)······244·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/style.html6265 -rw-r--r--···0·root·········(0)·root·········(0)······244·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/style.html
6266 -rw-r--r--···0·root·········(0)·root·········(0)······255·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/text.html6266 -rw-r--r--···0·root·········(0)·root·········(0)······255·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/text.html
6267 -rw-r--r--···0·root·········(0)·root·········(0)······256·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/timedeltas.html6267 -rw-r--r--···0·root·········(0)·root·········(0)······256·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/timedeltas.html
6268 -rw-r--r--···0·root·········(0)·root·········(0)······277·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/timeseries.html6268 -rw-r--r--···0·root·········(0)·root·········(0)······277·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/timeseries.html
6269 -rw-r--r--···0·root·········(0)·root·········(0)······272·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/tutorials.html6269 -rw-r--r--···0·root·········(0)·root·········(0)······272·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/tutorials.html
6270 drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/6270 drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/
6271 -rw-r--r--···0·root·········(0)·root·········(0)···171380·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/10min.html6271 -rw-r--r--···0·root·········(0)·root·········(0)···171380·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/10min.html
6272 -rw-r--r--···0·root·········(0)·root·········(0)···283833·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/advanced.html6272 -rw-r--r--···0·root·········(0)·root·········(0)···283834·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/advanced.html
6273 -rw-r--r--···0·root·········(0)·root·········(0)···435940·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/basics.html6273 -rw-r--r--···0·root·········(0)·root·········(0)···435940·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/basics.html
6274 -rw-r--r--···0·root·········(0)·root·········(0)····36646·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/boolean.html6274 -rw-r--r--···0·root·········(0)·root·········(0)····36646·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/boolean.html
6275 -rw-r--r--···0·root·········(0)·root·········(0)···217513·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/categorical.html6275 -rw-r--r--···0·root·········(0)·root·········(0)···217513·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/categorical.html
6276 -rw-r--r--···0·root·········(0)·root·········(0)····18313·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/cookbook.html6276 -rw-r--r--···0·root·········(0)·root·········(0)····18313·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/cookbook.html
6277 -rw-r--r--···0·root·········(0)·root·········(0)····66164·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/copy_on_write.html6277 -rw-r--r--···0·root·········(0)·root·········(0)····66164·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/copy_on_write.html
6278 -rw-r--r--···0·root·········(0)·root·········(0)···160414·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/dsintro.html6278 -rw-r--r--···0·root·········(0)·root·········(0)···160414·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/dsintro.html
6279 -rw-r--r--···0·root·········(0)·root·········(0)····81376·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/duplicates.html6279 -rw-r--r--···0·root·········(0)·root·········(0)····81376·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/duplicates.html
6280 -rw-r--r--···0·root·········(0)·root·········(0)···121090·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/enhancingperf.html6280 -rw-r--r--···0·root·········(0)·root·········(0)···121051·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/enhancingperf.html
6281 -rw-r--r--···0·root·········(0)·root·········(0)···107882·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/gotchas.html6281 -rw-r--r--···0·root·········(0)·root·········(0)···107882·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/gotchas.html
6282 -rw-r--r--···0·root·········(0)·root·········(0)···300850·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/groupby.html6282 -rw-r--r--···0·root·········(0)·root·········(0)···300850·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/groupby.html
6283 -rw-r--r--···0·root·········(0)·root·········(0)····59715·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/index.html6283 -rw-r--r--···0·root·········(0)·root·········(0)····59715·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/index.html
6284 -rw-r--r--···0·root·········(0)·root·········(0)···395486·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/indexing.html6284 -rw-r--r--···0·root·········(0)·root·········(0)···395486·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/indexing.html
6285 -rw-r--r--···0·root·········(0)·root·········(0)····41778·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/integer_na.html6285 -rw-r--r--···0·root·········(0)·root·········(0)····41778·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/integer_na.html
6286 -rw-r--r--···0·root·········(0)·root·········(0)··1145820·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/io.html6286 -rw-r--r--···0·root·········(0)·root·········(0)··1145820·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/io.html
6287 -rw-r--r--···0·root·········(0)·root·········(0)···208885·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/merging.html6287 -rw-r--r--···0·root·········(0)·root·········(0)···208885·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/merging.html
6288 -rw-r--r--···0·root·········(0)·root·········(0)···178690·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/missing_data.html6288 -rw-r--r--···0·root·········(0)·root·········(0)···178690·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/missing_data.html
6289 -rw-r--r--···0·root·········(0)·root·········(0)···112153·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/options.html6289 -rw-r--r--···0·root·········(0)·root·········(0)···112153·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/options.html
6290 -rw-r--r--···0·root·········(0)·root·········(0)···147524·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/pyarrow.html6290 -rw-r--r--···0·root·········(0)·root·········(0)···146148·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/pyarrow.html
6291 -rw-r--r--···0·root·········(0)·root·········(0)···162660·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/reshaping.html6291 -rw-r--r--···0·root·········(0)·root·········(0)···162660·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/reshaping.html
6292 -rw-r--r--···0·root·········(0)·root·········(0)···115581·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/scale.html6292 -rw-r--r--···0·root·········(0)·root·········(0)···115581·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/scale.html
6293 -rw-r--r--···0·root·········(0)·root·········(0)····65811·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/sparse.html6293 -rw-r--r--···0·root·········(0)·root·········(0)····65811·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/sparse.html
6294 -rw-r--r--···0·root·········(0)·root·········(0)···698240·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.html6294 -rw-r--r--···0·root·········(0)·root·········(0)···698240·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.html
6295 -rw-r--r--···0·root·········(0)·root·········(0)····87843·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.ipynb.gz6295 -rw-r--r--···0·root·········(0)·root·········(0)····87800·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.ipynb.gz
6296 -rw-r--r--···0·root·········(0)·root·········(0)···165302·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/text.html6296 -rw-r--r--···0·root·········(0)·root·········(0)···165302·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/text.html
6297 -rw-r--r--···0·root·········(0)·root·········(0)···100947·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timedeltas.html6297 -rw-r--r--···0·root·········(0)·root·········(0)···100947·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timedeltas.html
6298 -rw-r--r--···0·root·········(0)·root·········(0)···486621·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timeseries.html6298 -rw-r--r--···0·root·········(0)·root·········(0)···486621·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timeseries.html
6299 -rw-r--r--···0·root·········(0)·root·········(0)···204461·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/visualization.html6299 -rw-r--r--···0·root·········(0)·root·········(0)···204461·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/visualization.html
6300 -rw-r--r--···0·root·········(0)·root·········(0)···141947·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/window.html6300 -rw-r--r--···0·root·········(0)·root·········(0)···141947·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/user_guide/window.html
6301 -rw-r--r--···0·root·········(0)·root·········(0)······270·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/visualization.html6301 -rw-r--r--···0·root·········(0)·root·········(0)······270·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/visualization.html
6302 drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/6302 drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/
6303 -rw-r--r--···0·root·········(0)·root·········(0)···107681·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html6303 -rw-r--r--···0·root·········(0)·root·········(0)···107681·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html
6304 -rw-r--r--···0·root·········(0)·root·········(0)····10569·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html.gz6304 -rw-r--r--···0·root·········(0)·root·········(0)····10569·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html.gz
6305 -rw-r--r--···0·root·········(0)·root·········(0)····83987·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.0.html6305 -rw-r--r--···0·root·········(0)·root·········(0)····83987·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.0.html
6306 -rw-r--r--···0·root·········(0)·root·········(0)····66492·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.1.html6306 -rw-r--r--···0·root·········(0)·root·········(0)····66492·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.1.html
6307 -rw-r--r--···0·root·········(0)·root·········(0)····82312·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.11.0.html6307 -rw-r--r--···0·root·········(0)·root·········(0)····82312·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.11.0.html
6308 -rw-r--r--···0·root·········(0)·root·········(0)···104316·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.12.0.html6308 -rw-r--r--···0·root·········(0)·root·········(0)···104316·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.12.0.html
6309 -rw-r--r--···0·root·········(0)·root·········(0)···222537·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.0.html6309 -rw-r--r--···0·root·········(0)·root·········(0)···222535·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.0.html
6310 -rw-r--r--···0·root·········(0)·root·········(0)····89385·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.1.html6310 -rw-r--r--···0·root·········(0)·root·········(0)····89385·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.1.html
6311 -rw-r--r--···0·root·········(0)·root·········(0)···243730·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.0.html6311 -rw-r--r--···0·root·········(0)·root·········(0)···243730·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.0.html
6312 -rw-r--r--···0·root·········(0)·root·········(0)····83262·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.1.html6312 -rw-r--r--···0·root·········(0)·root·········(0)····83262·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.1.html
6313 -rw-r--r--···0·root·········(0)·root·········(0)···252303·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.0.html6313 -rw-r--r--···0·root·········(0)·root·········(0)···252303·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.0.html
6314 -rw-r--r--···0·root·········(0)·root·········(0)····68280·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.1.html6314 -rw-r--r--···0·root·········(0)·root·········(0)····68280·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.1.html
6315 -rw-r--r--···0·root·········(0)·root·········(0)····75128·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.2.html6315 -rw-r--r--···0·root·········(0)·root·········(0)····75128·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.2.html
6316 -rw-r--r--···0·root·········(0)·root·········(0)···145199·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.0.html6316 -rw-r--r--···0·root·········(0)·root·········(0)···145199·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.0.html
6317 -rw-r--r--···0·root·········(0)·root·········(0)···115292·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.1.html6317 -rw-r--r--···0·root·········(0)·root·········(0)···115518·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.1.html
6318 -rw-r--r--···0·root·········(0)·root·········(0)····64656·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.2.html6318 -rw-r--r--···0·root·········(0)·root·········(0)····64656·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.2.html
6319 -rw-r--r--···0·root·········(0)·root·········(0)···230436·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.0.html6319 -rw-r--r--···0·root·········(0)·root·········(0)···231394·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.0.html
6320 -rw-r--r--···0·root·········(0)·root·········(0)····94984·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.1.html6320 -rw-r--r--···0·root·········(0)·root·········(0)····95028·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.1.html
6321 -rw-r--r--···0·root·········(0)·root·········(0)···222566·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.0.html6321 -rw-r--r--···0·root·········(0)·root·········(0)···224090·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.0.html
6322 -rw-r--r--···0·root·········(0)·root·········(0)···171419·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.1.html6322 -rw-r--r--···0·root·········(0)·root·········(0)···171888·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.1.html
6323 -rw-r--r--···0·root·········(0)·root·········(0)···349334·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.0.html6323 -rw-r--r--···0·root·········(0)·root·········(0)···349334·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.0.html
6324 -rw-r--r--···0·root·········(0)·root·········(0)····45179·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.1.html6324 -rw-r--r--···0·root·········(0)·root·········(0)····45179·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.1.html
6325 -rw-r--r--···0·root·········(0)·root·········(0)····48525·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.2.html6325 -rw-r--r--···0·root·········(0)·root·········(0)····48525·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.19.2.html
6326 -rw-r--r--···0·root·········(0)·root·········(0)···406224·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.0.html6326 -rw-r--r--···0·root·········(0)·root·········(0)···406224·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.0.html
6327 -rw-r--r--···0·root·········(0)·root·········(0)····52898·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.2.html6327 -rw-r--r--···0·root·········(0)·root·········(0)····52898·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.2.html
6328 -rw-r--r--···0·root·········(0)·root·········(0)····43404·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.3.html6328 -rw-r--r--···0·root·········(0)·root·········(0)····43404·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.20.3.html
6329 -rw-r--r--···0·root·········(0)·root·········(0)···255124·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.21.0.html6329 -rw-r--r--···0·root·········(0)·root·········(0)···255124·2025-03-29·13:01:52.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.21.0.html
69.8 KB
./usr/share/doc/python-pandas-doc/html/searchindex.js
69.7 KB
js-beautify {}
    
Offset 21485, 24 lines modifiedOffset 21485, 24 lines modified
21485 ········"000830":·2214,21485 ········"000830":·2214,
21486 ········"000895":·2195,21486 ········"000895":·2195,
21487 ········"000951":·2186,21487 ········"000951":·2186,
21488 ········"000k":·1489,21488 ········"000k":·1489,
21489 ········"000m":·1489,21489 ········"000m":·1489,
21490 ········"000n":·1489,21490 ········"000n":·1489,
21491 ········"000z":·2294,21491 ········"000z":·2294,
21492 ········"001":·[532,·874,·1467,·2193,·2232,·2264],21492 ········"001":·[532,·874,·1467,·2232,·2264],
21493 ········"001000":·[917,·919,·922,·929,·1876,·2209],21493 ········"001000":·[917,·919,·922,·929,·1876,·2209],
21494 ········"001294":·2210,21494 ········"001294":·2210,
21495 ········"001372":·2207,21495 ········"001372":·2207,
21496 ········"001376":·2207,21496 ········"001376":·2207,
21497 ········"001427":·2214,21497 ········"001427":·2214,
21498 ········"001438":·2195,21498 ········"001438":·2195,
21499 ········"001486":·[102,·1158],21499 ········"001486":·[102,·1158],
21500 ········"00180":·2294,21500 ········"00180":·2294,
21501 ········"002":·[2193,·2264],21501 ········"002":·2264,
21502 ········"002000":·2232,21502 ········"002000":·2232,
21503 ········"002040":·2235,21503 ········"002040":·2235,
21504 ········"002118":·[2230,·2231],21504 ········"002118":·[2230,·2231],
21505 ········"002653":·2207,21505 ········"002653":·2207,
21506 ········"002846":·2229,21506 ········"002846":·2229,
21507 ········"003":·[2185,·2193,·2235],21507 ········"003":·[2185,·2193,·2235],
21508 ········"003144":·2210,21508 ········"003144":·2210,
Offset 21510, 15 lines modifiedOffset 21510, 15 lines modified
21510 ········"003494":·15,21510 ········"003494":·15,
21511 ········"003507":·[2209,·2218],21511 ········"003507":·[2209,·2218],
21512 ········"003556":·2207,21512 ········"003556":·2207,
21513 ········"00360":·2294,21513 ········"00360":·2294,
21514 ········"003733":·2207,21514 ········"003733":·2207,
21515 ········"003932":·2216,21515 ········"003932":·2216,
21516 ········"003945":·2210,21516 ········"003945":·2210,
21517 ········"004":·[2186,·2227],21517 ········"004":·[2186,·2193,·2227],
21518 ········"004000":·2232,21518 ········"004000":·2232,
21519 ········"004005006":·[287,·939],21519 ········"004005006":·[287,·939],
21520 ········"004054":·2229,21520 ········"004054":·2229,
21521 ········"004091":·[2204,·2257],21521 ········"004091":·[2204,·2257],
21522 ········"004127":·2207,21522 ········"004127":·2207,
21523 ········"004194":·2186,21523 ········"004194":·2186,
21524 ········"004201":·2186,21524 ········"004201":·2186,
Offset 21531, 32 lines modifiedOffset 21531, 35 lines modified
21531 ········"005000":·2218,21531 ········"005000":·2218,
21532 ········"005361":·2207,21532 ········"005361":·2207,
21533 ········"005383":·2220,21533 ········"005383":·2220,
21534 ········"005446":·2219,21534 ········"005446":·2219,
21535 ········"005462":·2191,21535 ········"005462":·2191,
21536 ········"005977":·2199,21536 ········"005977":·2199,
21537 ········"005979":·2186,21537 ········"005979":·2186,
 21538 ········"006":·2193,
21538 ········"006123":·2207,21539 ········"006123":·2207,
21539 ········"006154":·[2185,·2197,·2199,·2202,·2204,·2215,·2257],21540 ········"006154":·[2185,·2197,·2199,·2202,·2204,·2215,·2257],
21540 ········"0062":·2191,21541 ········"0062":·2191,
21541 ········"006349":·2195,21542 ········"006349":·2195,
21542 ········"006438":·2215,21543 ········"006438":·2215,
21543 ········"006549":·[182,·760],21544 ········"006549":·[182,·760],
21544 ········"006695":·2186,21545 ········"006695":·2186,
21545 ········"006747":·[2185,·2197,·2199,·2202,·2204,·2215],21546 ········"006747":·[2185,·2197,·2199,·2202,·2204,·2215],
21546 ········"006871":·2212,21547 ········"006871":·2212,
21547 ········"006888":·2220,21548 ········"006888":·2220,
21548 ········"006938":·2207,21549 ········"006938":·2207,
 21550 ········"007":·2193,
21549 ········"007200":·2184,21551 ········"007200":·2184,
21550 ········"007207":·[2184,·2214],21552 ········"007207":·[2184,·2214],
21551 ········"007717":·2199,21553 ········"007717":·2199,
21552 ········"007824":·15,21554 ········"007824":·15,
21553 ········"007952":·2207,21555 ········"007952":·2207,
21554 ········"007996":·2186,21556 ········"007996":·2186,
21555 ········"007f":·203,21557 ········"007f":·203,
 21558 ········"008":·2193,
21556 ········"008182":·2204,21559 ········"008182":·2204,
21557 ········"008298":·2186,21560 ········"008298":·2186,
21558 ········"008344":·2207,21561 ········"008344":·2207,
21559 ········"008358":·2207,21562 ········"008358":·2207,
21560 ········"008500":·15,21563 ········"008500":·15,
21561 ········"008543":·[102,·1158],21564 ········"008543":·[102,·1158],
21562 ········"008943":·[102,·1158],21565 ········"008943":·[102,·1158],
Offset 21569, 54 lines modifiedOffset 21572, 54 lines modified
21569 ········"009783":·2207,21572 ········"009783":·2207,
21570 ········"009797":·2186,21573 ········"009797":·2186,
21571 ········"009826":·[102,·1158,·2205],21574 ········"009826":·[102,·1158,·2205],
21572 ········"009920":·[2184,·2195,·2214],21575 ········"009920":·[2184,·2195,·2214],
21573 ········"00am":·2230,21576 ········"00am":·2230,
21574 ········"00index":·2218,21577 ········"00index":·2218,
21575 ········"01":·[3,·15,·16,·17,·19,·29,·30,·31,·79,·80,·82,·88,·107,·121,·182,·187,·207,·213,·218,·219,·230,·242,·261,·270,·271,·276,·277,·278,·283,·286,·287,·288,·289,·290,·291,·292,·293,·294,·295,·296,·298,·299,·301,·302,·303,·304,·305,·306,·307,·308,·309,·310,·311,·312,·313,·314,·315,·316,·317,·318,·319,·320,·321,·322,·323,·324,·326,·329,·330,·331,·332,·333,·345,·362,·363,·423,·445,·510,·511,·513,·514,·515,·516,·517,·519,·521,·523,·525,·529,·531,·532,·533,·534,·535,·536,·537,·541,·542,·543,·544,·545,·546,·547,·548,·549,·551,·554,·556,·557,·558,·560,·561,·562,·563,·564,·565,·566,·575,·591,·592,·593,·600,·629,·637,·639,·640,·641,·642,·643,·644,·645,·646,·647,·649,·650,·651,·652,·654,·655,·656,·657,·658,·659,·660,·661,·662,·663,·665,·666,·667,·668,·670,·671,·673,·674,·675,·676,·677,·678,·679,·680,·684,·685,·686,·688,·689,·696,·760,·763,·781,·788,·793,·804,·817,·874,·893,·898,·899,·902,·903,·904,·905,·909,·910,·917,·919,·922,·929,·934,·939,·940,·943,·944,·945,·948,·949,·953,·954,·957,·959,·960,·969,·972,·982,·984,·997,·1000,·1001,·1003,·1004,·1005,·1011,·1014,·1016,·1017,·1020,·1021,·1024,·1051,·1075,·1078,·1106,·1118,·1122,·1141,·1144,·1145,·1147,·1157,·1164,·1170,·1171,·1176,·1180,·1185,·1192,·1195,·1197,·1206,·1214,·1221,·1227,·1228,·1233,·1239,·1245,·1246,·1253,·1256,·1258,·1268,·1269,·1270,·1271,·1272,·1273,·1274,·1275,·1277,·1278,·1279,·1280,·1282,·1283,·1284,·1285,·1286,·1287,·1288,·1290,·1291,·1292,·1293,·1294,·1295,·1296,·1297,·1344,·1345,·1367,·1391,·1392,·1393,·1436,·1447,·1452,·1475,·1488,·1490,·1498,·1500,·1501,·1506,·1524,·1542,·1560,·1620,·1699,·1720,·1741,·1793,·1815,·1857,·1930,·1947,·1982,·2036,·2054,·2090,·2108,·2127,·2163,·2184,·2185,·2186,·2188,·2191,·2195,·2197,·2198,·2199,·2200,·2201,·2202,·2204,·2205,·2206,·2207,·2209,·2210,·2212,·2214,·2215,·2216,·2217,·2218,·2219,·2220,·2221,·2222,·2223,·2225,·2226,·2228,·2229,·2230,·2231,·2232,·2235,·2238,·2240,·2241,·2246,·2249,·2261,·2264,·2265,·2271,·2283,·2289,·2294,·2298,·2302,·2307],21578 ········"01":·[3,·15,·16,·17,·19,·29,·30,·31,·79,·80,·82,·88,·107,·121,·182,·187,·207,·213,·218,·219,·230,·242,·261,·270,·271,·276,·277,·278,·283,·286,·287,·288,·289,·290,·291,·292,·293,·294,·295,·296,·298,·299,·301,·302,·303,·304,·305,·306,·307,·308,·309,·310,·311,·312,·313,·314,·315,·316,·317,·318,·319,·320,·321,·322,·323,·324,·326,·329,·330,·331,·332,·333,·345,·362,·363,·423,·445,·510,·511,·513,·514,·515,·516,·517,·519,·521,·523,·525,·529,·531,·532,·533,·534,·535,·536,·537,·541,·542,·543,·544,·545,·546,·547,·548,·549,·551,·554,·556,·557,·558,·560,·561,·562,·563,·564,·565,·566,·575,·591,·592,·593,·600,·629,·637,·639,·640,·641,·642,·643,·644,·645,·646,·647,·649,·650,·651,·652,·654,·655,·656,·657,·658,·659,·660,·661,·662,·663,·665,·666,·667,·668,·670,·671,·673,·674,·675,·676,·677,·678,·679,·680,·684,·685,·686,·688,·689,·696,·760,·763,·781,·788,·793,·804,·817,·874,·893,·898,·899,·902,·903,·904,·905,·909,·910,·917,·919,·922,·929,·934,·939,·940,·943,·944,·945,·948,·949,·953,·954,·957,·959,·960,·969,·972,·982,·984,·997,·1000,·1001,·1003,·1004,·1005,·1011,·1014,·1016,·1017,·1020,·1021,·1024,·1051,·1075,·1078,·1106,·1118,·1122,·1141,·1144,·1145,·1147,·1157,·1164,·1170,·1171,·1176,·1180,·1185,·1192,·1195,·1197,·1206,·1214,·1221,·1227,·1228,·1233,·1239,·1245,·1246,·1253,·1256,·1258,·1268,·1269,·1270,·1271,·1272,·1273,·1274,·1275,·1277,·1278,·1279,·1280,·1282,·1283,·1284,·1285,·1286,·1287,·1288,·1290,·1291,·1292,·1293,·1294,·1295,·1296,·1297,·1344,·1345,·1367,·1391,·1392,·1393,·1436,·1447,·1452,·1475,·1488,·1490,·1498,·1500,·1501,·1506,·1524,·1542,·1560,·1620,·1699,·1720,·1741,·1793,·1815,·1857,·1930,·1947,·1982,·2036,·2054,·2090,·2108,·2127,·2163,·2184,·2185,·2186,·2188,·2191,·2195,·2197,·2198,·2199,·2200,·2201,·2202,·2204,·2205,·2206,·2207,·2209,·2210,·2212,·2214,·2215,·2216,·2217,·2218,·2219,·2220,·2221,·2222,·2223,·2225,·2226,·2228,·2229,·2230,·2231,·2232,·2235,·2238,·2240,·2241,·2246,·2249,·2261,·2264,·2265,·2271,·2283,·2289,·2294,·2298,·2302,·2307],
 21579 ········"010":·2193,
21576 ········"0100":·[575,·893,·957,·970,·997,·1004,·1014,·1016,·1020,·1021,·1498,·2186,·2199,·2210,·2246,·2271],21580 ········"0100":·[575,·893,·957,·970,·997,·1004,·1014,·1016,·1020,·1021,·1498,·2186,·2199,·2210,·2246,·2271],
21577 ········"010000":·[954,·1894],21581 ········"010000":·[954,·1894],
21578 ········"010010012":·[923,·2209],21582 ········"010010012":·[923,·2209],
21579 ········"010026":·2191,21583 ········"010026":·2191,
21580 ········"010081":·15,21584 ········"010081":·15,
21581 ········"010165":·2199,21585 ········"010165":·2199,
21582 ········"010589":·2193,21586 ········"010589":·2193,
21583 ········"010670":·[102,·1158],21587 ········"010670":·[102,·1158],
21584 ········"0108":·2257,21588 ········"0108":·2257,
21585 ········"010903":·2207,21589 ········"010903":·2207,
 21590 ········"011":·2193,
21586 ········"011111":·[182,·760],21591 ········"011111":·[182,·760],
21587 ········"011342":·2207,21592 ········"011342":·2207,
21588 ········"011351":·2207,21593 ········"011351":·2207,
21589 ········"011374":·2195,21594 ········"011374":·2195,
21590 ········"011470":·2207,21595 ········"011470":·2207,
21591 ········"011736":·2186,21596 ········"011736":·2186,
21592 ········"011829":·2207,21597 ········"011829":·2207,
21593 ········"01183":·2229,21598 ········"01183":·2229,
21594 ········"011860":·[182,·760],21599 ········"011860":·[182,·760],
21595 ········"011975":·2207,21600 ········"011975":·2207,
21596 ········"012":·2193, 
21597 ········"012108":·2207,21601 ········"012108":·2207,
21598 ········"012299":·2207,21602 ········"012299":·2207,
21599 ········"0123456789123456":·[2164,·2165],21603 ········"0123456789123456":·[2164,·2165],
21600 ········"012549":·2207,21604 ········"012549":·2207,
21601 ········"012694":·2199,21605 ········"012694":·2199,
21602 ········"012922":·2219,21606 ········"012922":·2219,
21603 ········"013":·2193, 
21604 ········"013086":·15,21607 ········"013086":·15,
21605 ········"0133":·2202,21608 ········"0133":·2202,
21606 ········"013448":·2207,21609 ········"013448":·2207,
21607 ········"013605":·2207,21610 ········"013605":·2207,
21608 ········"013684":·[182,·760],21611 ········"013684":·[182,·760],
21609 ········"013692":·[102,·1158],21612 ········"013692":·[102,·1158],
21610 ········"013747":·2199,21613 ········"013747":·2199,
21611 ········"013768":·2230,21614 ········"013768":·2230,
21612 ········"013810":·[182,·760],21615 ········"013810":·[182,·760],
21613 ········"013863":·2199,21616 ········"013863":·2199,
21614 ········"013960":·[2185,·2197,·2199,·2202,·2204,·2215,·2257],21617 ········"013960":·[2185,·2197,·2199,·2202,·2204,·2215,·2257],
21615 ········"014":·[2191,·2193],21618 ········"014":·2191,
21616 ········"014061":·2207,21619 ········"014061":·2207,
Max diff block lines reached; 65630/71332 bytes (92.01%) of diff not shown.
4.37 KB
./usr/share/doc/python-pandas-doc/html/user_guide/advanced.html
    
Offset 1847, 25 lines modifiedOffset 1847, 25 lines modified
1847 <span·class="gp">In·[141]:·</span><span·class="n">indexer</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">arange</span><span·class="p">(</span><span·class="mi">10000</span><span·class="p">)</span>1847 <span·class="gp">In·[141]:·</span><span·class="n">indexer</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">arange</span><span·class="p">(</span><span·class="mi">10000</span><span·class="p">)</span>
  
1848 <span·class="gp">In·[142]:·</span><span·class="n">random</span><span·class="o">.</span><span·class="n">shuffle</span><span·class="p">(</span><span·class="n">indexer</span><span·class="p">)</span>1848 <span·class="gp">In·[142]:·</span><span·class="n">random</span><span·class="o">.</span><span·class="n">shuffle</span><span·class="p">(</span><span·class="n">indexer</span><span·class="p">)</span>
  
1849 <span·class="gp">In·[143]:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr[indexer]1849 <span·class="gp">In·[143]:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr[indexer]
1850 <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr.take(indexer,·axis=0)1850 <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr.take(indexer,·axis=0)
1851 <span·class="gp">···.....:·</span>1851 <span·class="gp">···.....:·</span>
1852 <span·class="go">499·us·+-·2.13·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span>1852 <span·class="go">305·us·+-·59.8·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span>
1853 <span·class="go">217·us·+-·7.17·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span>1853 <span·class="go">124·us·+-·177·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each)</span>
1854 </pre></div>1854 </pre></div>
1855 </div>1855 </div>
1856 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[144]:·</span><span·class="n">ser</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">arr</span><span·class="p">[:,</span>·<span·class="mi">0</span><span·class="p">])</span>1856 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[144]:·</span><span·class="n">ser</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">arr</span><span·class="p">[:,</span>·<span·class="mi">0</span><span·class="p">])</span>
  
1857 <span·class="gp">In·[145]:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.iloc[indexer]1857 <span·class="gp">In·[145]:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.iloc[indexer]
1858 <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.take(indexer)1858 <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.take(indexer)
1859 <span·class="gp">···.....:·</span>1859 <span·class="gp">···.....:·</span>
 1860 <span·class="go">199·us·+-·52.1·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each)</span>
1860 <span·class="go">269·us·+-·1.29·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span>1861 <span·class="go">369·us·+-·63.9·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span>
1861 <span·class="go">259·us·+-·2.03·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> 
1862 </pre></div>1862 </pre></div>
1863 </div>1863 </div>
1864 </section>1864 </section>
1865 <section·id="index-types">1865 <section·id="index-types">
1866 <span·id="advanced-index-types"></span><h2>Index·types<a·class="headerlink"·href="#index-types"·title="Link·to·this·heading">#</a></h2>1866 <span·id="advanced-index-types"></span><h2>Index·types<a·class="headerlink"·href="#index-types"·title="Link·to·this·heading">#</a></h2>
1867 <p>We·have·discussed·<code·class="docutils·literal·notranslate"><span·class="pre">MultiIndex</span></code>·in·the·previous·sections·pretty·extensively.1867 <p>We·have·discussed·<code·class="docutils·literal·notranslate"><span·class="pre">MultiIndex</span></code>·in·the·previous·sections·pretty·extensively.
1868 Documentation·about·<code·class="docutils·literal·notranslate"><span·class="pre">DatetimeIndex</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex</span></code>·are·shown·<a·class="reference·internal"·href="timeseries.html#timeseries-overview"><span·class="std·std-ref">here</span></a>,1868 Documentation·about·<code·class="docutils·literal·notranslate"><span·class="pre">DatetimeIndex</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex</span></code>·are·shown·<a·class="reference·internal"·href="timeseries.html#timeseries-overview"><span·class="std·std-ref">here</span></a>,
1.46 KB
html2text {}
    
Offset 1245, 23 lines modifiedOffset 1245, 23 lines modified
1245 In·[141]:·indexer·=·np.arange(10000)1245 In·[141]:·indexer·=·np.arange(10000)
  
1246 In·[142]:·random.shuffle(indexer)1246 In·[142]:·random.shuffle(indexer)
  
1247 In·[143]:·%timeit·arr[indexer]1247 In·[143]:·%timeit·arr[indexer]
1248 ···.....:·%timeit·arr.take(indexer,·axis=0)1248 ···.....:·%timeit·arr.take(indexer,·axis=0)
1249 ···.....:1249 ···.....:
1250 499·us·+-·2.13·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)1250 305·us·+-·59.8·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)
1251 217·us·+-·7.17·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)1251 124·us·+-·177·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each)
1252 In·[144]:·ser·=·pd.Series(arr[:,·0])1252 In·[144]:·ser·=·pd.Series(arr[:,·0])
  
1253 In·[145]:·%timeit·ser.iloc[indexer]1253 In·[145]:·%timeit·ser.iloc[indexer]
1254 ···.....:·%timeit·ser.take(indexer)1254 ···.....:·%timeit·ser.take(indexer)
1255 ···.....:1255 ···.....:
 1256 199·us·+-·52.1·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each)
1256 269·us·+-·1.29·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)1257 369·us·+-·63.9·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)
1257 259·us·+-·2.03·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) 
1258 *\x8**\x8**\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8x·t\x8ty\x8yp\x8pe\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8**\x8*1258 *\x8**\x8**\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8x·t\x8ty\x8yp\x8pe\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8**\x8*
1259 We·have·discussed·MultiIndex·in·the·previous·sections·pretty·extensively.1259 We·have·discussed·MultiIndex·in·the·previous·sections·pretty·extensively.
1260 Documentation·about·DatetimeIndex·and·PeriodIndex·are·shown·_\x8h_\x8e_\x8r_\x8e,·and1260 Documentation·about·DatetimeIndex·and·PeriodIndex·are·shown·_\x8h_\x8e_\x8r_\x8e,·and
1261 documentation·about·TimedeltaIndex·is·found·_\x8h_\x8e_\x8r_\x8e.1261 documentation·about·TimedeltaIndex·is·found·_\x8h_\x8e_\x8r_\x8e.
1262 In·the·following·sub-sections·we·will·highlight·some·other·index·types.1262 In·the·following·sub-sections·we·will·highlight·some·other·index·types.
1263 *\x8**\x8**\x8**\x8*·C\x8Ca\x8at\x8te\x8eg\x8go\x8or\x8ri\x8ic\x8ca\x8al\x8lI\x8In\x8nd\x8de\x8ex\x8x_\x8#\x8#·*\x8**\x8**\x8**\x8*1263 *\x8**\x8**\x8**\x8*·C\x8Ca\x8at\x8te\x8eg\x8go\x8or\x8ri\x8ic\x8ca\x8al\x8lI\x8In\x8nd\x8de\x8ex\x8x_\x8#\x8#·*\x8**\x8**\x8**\x8*
1264 _\x8C_\x8a_\x8t_\x8e_\x8g_\x8o_\x8r_\x8i_\x8c_\x8a_\x8l_\x8I_\x8n_\x8d_\x8e_\x8x·is·a·type·of·index·that·is·useful·for·supporting·indexing·with1264 _\x8C_\x8a_\x8t_\x8e_\x8g_\x8o_\x8r_\x8i_\x8c_\x8a_\x8l_\x8I_\x8n_\x8d_\x8e_\x8x·is·a·type·of·index·that·is·useful·for·supporting·indexing·with
30.4 KB
./usr/share/doc/python-pandas-doc/html/user_guide/enhancingperf.html
    
Offset 592, 31 lines modifiedOffset 592, 31 lines modified
592 <span·class="gp">···...:·</span>········<span·class="n">s</span>·<span·class="o">+=</span>·<span·class="n">f</span><span·class="p">(</span><span·class="n">a</span>·<span·class="o">+</span>·<span·class="n">i</span>·<span·class="o">*</span>·<span·class="n">dx</span><span·class="p">)</span>592 <span·class="gp">···...:·</span>········<span·class="n">s</span>·<span·class="o">+=</span>·<span·class="n">f</span><span·class="p">(</span><span·class="n">a</span>·<span·class="o">+</span>·<span·class="n">i</span>·<span·class="o">*</span>·<span·class="n">dx</span><span·class="p">)</span>
593 <span·class="gp">···...:·</span>····<span·class="k">return</span>·<span·class="n">s</span>·<span·class="o">*</span>·<span·class="n">dx</span>593 <span·class="gp">···...:·</span>····<span·class="k">return</span>·<span·class="n">s</span>·<span·class="o">*</span>·<span·class="n">dx</span>
594 <span·class="gp">···...:·</span>594 <span·class="gp">···...:·</span>
595 </pre></div>595 </pre></div>
596 </div>596 </div>
597 <p>We·achieve·our·result·by·using·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply"·title="pandas.DataFrame.apply"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">DataFrame.apply()</span></code></a>·(row-wise):</p>597 <p>We·achieve·our·result·by·using·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply"·title="pandas.DataFrame.apply"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">DataFrame.apply()</span></code></a>·(row-wise):</p>
598 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)598 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)
599 <span·class="go">150·ms·+-·5.27·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>599 <span·class="go">177·ms·+-·20.7·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>
600 </pre></div>600 </pre></div>
601 </div>601 </div>
602 <p>Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation602 <p>Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation
603 using·the·<a·class="reference·external"·href="https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun">prun·ipython·magic·function</a>:</p>603 using·the·<a·class="reference·external"·href="https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun">prun·ipython·magic·function</a>:</p>
604 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·most·time·consuming·4·calls</span>604 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·most·time·consuming·4·calls</span>
605 <span·class="gp">In·[6]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)··#·noqa·E999605 <span·class="gp">In·[6]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)··#·noqa·E999
606 <span·class="go">·········605946·function·calls·(605928·primitive·calls)·in·1.021·seconds</span>606 <span·class="go">·········605946·function·calls·(605928·primitive·calls)·in·0.296·seconds</span>
  
607 <span·class="go">···Ordered·by:·internal·time</span>607 <span·class="go">···Ordered·by:·internal·time</span>
608 <span·class="go">···List·reduced·from·159·to·4·due·to·restriction·&lt;4&gt;</span>608 <span·class="go">···List·reduced·from·159·to·4·due·to·restriction·&lt;4&gt;</span>
  
609 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>609 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>
610 <span·class="go">·····1000····0.531····0.001····0.905····0.001·&lt;ipython-input-4-c2a74e076cf0&gt;:1(integrate_f)</span>610 <span·class="go">·····1000····0.178····0.000····0.259····0.000·&lt;ipython-input-4-c2a74e076cf0&gt;:1(integrate_f)</span>
611 <span·class="go">···552423····0.374····0.000····0.374····0.000·&lt;ipython-input-3-c138bdd570e3&gt;:1(f)</span>611 <span·class="go">···552423····0.080····0.000····0.080····0.000·&lt;ipython-input-3-c138bdd570e3&gt;:1(f)</span>
612 <span·class="go">·····3000····0.019····0.000····0.082····0.000·series.py:1095(__getitem__)</span>612 <span·class="go">·····3000····0.006····0.000····0.025····0.000·series.py:1095(__getitem__)</span>
613 <span·class="go">····16098····0.014····0.000····0.018····0.000·{built-in·method·builtins.isinstance}</span>613 <span·class="go">·····3000····0.004····0.000····0.011····0.000·series.py:1220(_get_value)</span>
614 </pre></div>614 </pre></div>
615 </div>615 </div>
616 <p>By·far·the·majority·of·time·is·spend·inside·either·<code·class="docutils·literal·notranslate"><span·class="pre">integrate_f</span></code>·or·<code·class="docutils·literal·notranslate"><span·class="pre">f</span></code>,616 <p>By·far·the·majority·of·time·is·spend·inside·either·<code·class="docutils·literal·notranslate"><span·class="pre">integrate_f</span></code>·or·<code·class="docutils·literal·notranslate"><span·class="pre">f</span></code>,
617 hence·we’ll·concentrate·our·efforts·cythonizing·these·two·functions.</p>617 hence·we’ll·concentrate·our·efforts·cythonizing·these·two·functions.</p>
618 </section>618 </section>
619 <section·id="plain-cython">619 <section·id="plain-cython">
620 <span·id="enhancingperf-plain"></span><h3>Plain·Cython<a·class="headerlink"·href="#plain-cython"·title="Link·to·this·heading">#</a></h3>620 <span·id="enhancingperf-plain"></span><h3>Plain·Cython<a·class="headerlink"·href="#plain-cython"·title="Link·to·this·heading">#</a></h3>
Offset 634, 15 lines modifiedOffset 634, 15 lines modified
634 <span·class="gp">···...:·</span>····for·i·in·range(N):634 <span·class="gp">···...:·</span>····for·i·in·range(N):
635 <span·class="gp">···...:·</span>········s·+=·f_plain(a·+·i·*·dx)635 <span·class="gp">···...:·</span>········s·+=·f_plain(a·+·i·*·dx)
636 <span·class="gp">···...:·</span>····return·s·*·dx636 <span·class="gp">···...:·</span>····return·s·*·dx
637 <span·class="gp">···...:·</span>637 <span·class="gp">···...:·</span>
638 </pre></div>638 </pre></div>
639 </div>639 </div>
640 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[9]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f_plain(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)640 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[9]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f_plain(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)
641 <span·class="go">130·ms·+-·359·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>641 <span·class="go">182·ms·+-·21.5·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>
642 </pre></div>642 </pre></div>
643 </div>643 </div>
644 <p>This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-third.</p>644 <p>This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-third.</p>
645 </section>645 </section>
646 <section·id="declaring-c-types">646 <section·id="declaring-c-types">
647 <span·id="enhancingperf-type"></span><h3>Declaring·C·types<a·class="headerlink"·href="#declaring-c-types"·title="Link·to·this·heading">#</a></h3>647 <span·id="enhancingperf-type"></span><h3>Declaring·C·types<a·class="headerlink"·href="#declaring-c-types"·title="Link·to·this·heading">#</a></h3>
648 <p>We·can·annotate·the·function·variables·and·return·types·as·well·as·use·<code·class="docutils·literal·notranslate"><span·class="pre">cdef</span></code>648 <p>We·can·annotate·the·function·variables·and·return·types·as·well·as·use·<code·class="docutils·literal·notranslate"><span·class="pre">cdef</span></code>
Offset 658, 36 lines modifiedOffset 658, 36 lines modified
658 <span·class="gp">···....:·</span>····for·i·in·range(N):658 <span·class="gp">···....:·</span>····for·i·in·range(N):
659 <span·class="gp">···....:·</span>········s·+=·f_typed(a·+·i·*·dx)659 <span·class="gp">···....:·</span>········s·+=·f_typed(a·+·i·*·dx)
660 <span·class="gp">···....:·</span>····return·s·*·dx660 <span·class="gp">···....:·</span>····return·s·*·dx
661 <span·class="gp">···....:·</span>661 <span·class="gp">···....:·</span>
662 </pre></div>662 </pre></div>
663 </div>663 </div>
664 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[11]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f_typed(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)664 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[11]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df.apply(lambda·x:·integrate_f_typed(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)
665 <span·class="go">22.8·ms·+-·148·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>665 <span·class="go">20.3·ms·+-·93.9·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span>
666 </pre></div>666 </pre></div>
667 </div>667 </div>
668 <p>Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance·improvement·compared·to668 <p>Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance·improvement·compared·to
669 the·original·Python·implementation.</p>669 the·original·Python·implementation.</p>
670 </section>670 </section>
671 <section·id="using-ndarray">671 <section·id="using-ndarray">
672 <span·id="enhancingperf-ndarray"></span><h3>Using·ndarray<a·class="headerlink"·href="#using-ndarray"·title="Link·to·this·heading">#</a></h3>672 <span·id="enhancingperf-ndarray"></span><h3>Using·ndarray<a·class="headerlink"·href="#using-ndarray"·title="Link·to·this·heading">#</a></h3>
673 <p>When·re-profiling,·time·is·spent·creating·a·<a·class="reference·internal"·href="../reference/api/pandas.Series.html#pandas.Series"·title="pandas.Series"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">Series</span></code></a>·from·each·row,·and·calling·<code·class="docutils·literal·notranslate"><span·class="pre">__getitem__</span></code>·from·both673 <p>When·re-profiling,·time·is·spent·creating·a·<a·class="reference·internal"·href="../reference/api/pandas.Series.html#pandas.Series"·title="pandas.Series"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">Series</span></code></a>·from·each·row,·and·calling·<code·class="docutils·literal·notranslate"><span·class="pre">__getitem__</span></code>·from·both
674 the·index·and·the·series·(three·times·for·each·row).·These·Python·function·calls·are·expensive·and674 the·index·and·the·series·(three·times·for·each·row).·These·Python·function·calls·are·expensive·and
675 can·be·improved·by·passing·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>.</p>675 can·be·improved·by·passing·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>.</p>
676 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[12]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f_typed(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)676 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[12]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f_typed(x[&quot;a&quot;],·x[&quot;b&quot;],·x[&quot;N&quot;]),·axis=1)
677 <span·class="go">·········52523·function·calls·(52505·primitive·calls)·in·0.119·seconds</span>677 <span·class="go">·········52523·function·calls·(52505·primitive·calls)·in·0.066·seconds</span>
  
678 <span·class="go">···Ordered·by:·internal·time</span>678 <span·class="go">···Ordered·by:·internal·time</span>
679 <span·class="go">···List·reduced·from·157·to·4·due·to·restriction·&lt;4&gt;</span>679 <span·class="go">···List·reduced·from·157·to·4·due·to·restriction·&lt;4&gt;</span>
  
680 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>680 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>
681 <span·class="go">·····3000····0.019····0.000····0.084····0.000·series.py:1095(__getitem__)</span>681 <span·class="go">·····3000····0.010····0.000····0.042····0.000·series.py:1095(__getitem__)</span>
 682 <span·class="go">·····3000····0.007····0.000····0.019····0.000·series.py:1220(_get_value)</span>
 683 <span·class="go">·····3000····0.007····0.000····0.008····0.000·base.py:3777(get_loc)</span>
682 <span·class="go">····16098····0.014····0.000····0.018····0.000·{built-in·method·builtins.isinstance}</span>684 <span·class="go">····16098····0.006····0.000····0.008····0.000·{built-in·method·builtins.isinstance}</span>
683 <span·class="go">·····3000····0.013····0.000····0.034····0.000·series.py:1220(_get_value)</span> 
684 <span·class="go">·····3000····0.012····0.000····0.021····0.000·indexing.py:2765(check_dict_or_set_indexers)</span> 
685 </pre></div>685 </pre></div>
686 </div>686 </div>
687 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[13]:·</span><span·class="o">%%</span><span·class="k">cython</span>687 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[13]:·</span><span·class="o">%%</span><span·class="k">cython</span>
688 <span·class="gp">···....:·</span>cimport·numpy·as·np688 <span·class="gp">···....:·</span>cimport·numpy·as·np
689 <span·class="gp">···....:·</span>import·numpy·as·np689 <span·class="gp">···....:·</span>import·numpy·as·np
690 <span·class="gp">···....:·</span>cdef·double·f_typed(double·x)·except?·-2:690 <span·class="gp">···....:·</span>cdef·double·f_typed(double·x)·except?·-2:
691 <span·class="gp">···....:·</span>····return·x·*·(x·-·1)691 <span·class="gp">···....:·</span>····return·x·*·(x·-·1)
Offset 722, 33 lines modifiedOffset 722, 33 lines modified
722 </div>722 </div>
723 <p>This·implementation·creates·an·array·of·zeros·and·inserts·the·result723 <p>This·implementation·creates·an·array·of·zeros·and·inserts·the·result
724 of·<code·class="docutils·literal·notranslate"><span·class="pre">integrate_f_typed</span></code>·applied·over·each·row.·Looping·over·an·<code·class="docutils·literal·notranslate"><span·class="pre">ndarray</span></code>·is·faster724 of·<code·class="docutils·literal·notranslate"><span·class="pre">integrate_f_typed</span></code>·applied·over·each·row.·Looping·over·an·<code·class="docutils·literal·notranslate"><span·class="pre">ndarray</span></code>·is·faster
725 in·Cython·than·looping·over·a·<a·class="reference·internal"·href="../reference/api/pandas.Series.html#pandas.Series"·title="pandas.Series"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">Series</span></code></a>·object.</p>725 in·Cython·than·looping·over·a·<a·class="reference·internal"·href="../reference/api/pandas.Series.html#pandas.Series"·title="pandas.Series"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">Series</span></code></a>·object.</p>
726 <p>Since·<code·class="docutils·literal·notranslate"><span·class="pre">apply_integrate_f</span></code>·is·typed·to·accept·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>,·<a·class="reference·internal"·href="../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy"·title="pandas.Series.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Series.to_numpy()</span></code></a>726 <p>Since·<code·class="docutils·literal·notranslate"><span·class="pre">apply_integrate_f</span></code>·is·typed·to·accept·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>,·<a·class="reference·internal"·href="../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy"·title="pandas.Series.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Series.to_numpy()</span></code></a>
727 calls·are·needed·to·utilize·this·function.</p>727 calls·are·needed·to·utilize·this·function.</p>
728 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[14]:·</span><span·class="o">%</span><span·class="k">timeit</span>·apply_integrate_f(df[&quot;a&quot;].to_numpy(),·df[&quot;b&quot;].to_numpy(),·df[&quot;N&quot;].to_numpy())728 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[14]:·</span><span·class="o">%</span><span·class="k">timeit</span>·apply_integrate_f(df[&quot;a&quot;].to_numpy(),·df[&quot;b&quot;].to_numpy(),·df[&quot;N&quot;].to_numpy())
729 <span·class="go">2.42·ms·+-·2.27·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each)</span>729 <span·class="go">3.42·ms·+-·20·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each)</span>
730 </pre></div>730 </pre></div>
731 </div>731 </div>
732 <p>Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.</p>732 <p>Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.</p>
733 </section>733 </section>
734 <section·id="disabling-compiler-directives">734 <section·id="disabling-compiler-directives">
735 <span·id="enhancingperf-boundswrap"></span><h3>Disabling·compiler·directives<a·class="headerlink"·href="#disabling-compiler-directives"·title="Link·to·this·heading">#</a></h3>735 <span·id="enhancingperf-boundswrap"></span><h3>Disabling·compiler·directives<a·class="headerlink"·href="#disabling-compiler-directives"·title="Link·to·this·heading">#</a></h3>
736 <p>The·majority·of·the·time·is·now·spent·in·<code·class="docutils·literal·notranslate"><span·class="pre">apply_integrate_f</span></code>.·Disabling·Cython’s·<code·class="docutils·literal·notranslate"><span·class="pre">boundscheck</span></code>736 <p>The·majority·of·the·time·is·now·spent·in·<code·class="docutils·literal·notranslate"><span·class="pre">apply_integrate_f</span></code>.·Disabling·Cython’s·<code·class="docutils·literal·notranslate"><span·class="pre">boundscheck</span></code>
737 and·<code·class="docutils·literal·notranslate"><span·class="pre">wraparound</span></code>·checks·can·yield·more·performance.</p>737 and·<code·class="docutils·literal·notranslate"><span·class="pre">wraparound</span></code>·checks·can·yield·more·performance.</p>
738 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[15]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·apply_integrate_f(df[&quot;a&quot;].to_numpy(),·df[&quot;b&quot;].to_numpy(),·df[&quot;N&quot;].to_numpy())738 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[15]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·apply_integrate_f(df[&quot;a&quot;].to_numpy(),·df[&quot;b&quot;].to_numpy(),·df[&quot;N&quot;].to_numpy())
739 <span·class="go">·········78·function·calls·in·0.003·seconds</span>739 <span·class="go">·········78·function·calls·in·0.004·seconds</span>
  
740 <span·class="go">···Ordered·by:·internal·time</span>740 <span·class="go">···Ordered·by:·internal·time</span>
741 <span·class="go">···List·reduced·from·21·to·4·due·to·restriction·&lt;4&gt;</span>741 <span·class="go">···List·reduced·from·21·to·4·due·to·restriction·&lt;4&gt;</span>
  
742 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>742 <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span>
743 <span·class="go">········1····0.002····0.002····0.003····0.003·&lt;string&gt;:1(&lt;module&gt;)</span>743 <span·class="go">········1····0.003····0.003····0.004····0.004·&lt;string&gt;:1(&lt;module&gt;)</span>
744 <span·class="go">········1····0.000····0.000····0.000····0.000·{method·&#39;disable&#39;·of·&#39;_lsprof.Profiler&#39;·objects}</span>744 <span·class="go">········1····0.000····0.000····0.000····0.000·{method·&#39;disable&#39;·of·&#39;_lsprof.Profiler&#39;·objects}</span>
745 <span·class="go">········1····0.000····0.000····0.003····0.003·{built-in·method·builtins.exec}</span>745 <span·class="go">········1····0.000····0.000····0.004····0.004·{built-in·method·builtins.exec}</span>
746 <span·class="go">········3····0.000····0.000····0.000····0.000·frame.py:4062(__getitem__)</span>746 <span·class="go">········3····0.000····0.000····0.000····0.000·frame.py:4062(__getitem__)</span>
747 </pre></div>747 </pre></div>
748 </div>748 </div>
749 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[16]:·</span><span·class="o">%%</span><span·class="k">cython</span>749 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[16]:·</span><span·class="o">%%</span><span·class="k">cython</span>
750 <span·class="gp">···....:·</span>cimport·cython750 <span·class="gp">···....:·</span>cimport·cython
751 <span·class="gp">···....:·</span>cimport·numpy·as·np751 <span·class="gp">···....:·</span>cimport·numpy·as·np
752 <span·class="gp">···....:·</span>import·numpy·as·np752 <span·class="gp">···....:·</span>import·numpy·as·np
Offset 1180, 19 lines modifiedOffset 1180, 19 lines modified
1180 compared·to·standard·Python·syntax·for·large·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.html#pandas.DataFrame"·title="pandas.DataFrame"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">DataFrame</span></code></a>.·This·engine·requires·the1180 compared·to·standard·Python·syntax·for·large·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.html#pandas.DataFrame"·title="pandas.DataFrame"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">DataFrame</span></code></a>.·This·engine·requires·the
1181 optional·dependency·<code·class="docutils·literal·notranslate"><span·class="pre">numexpr</span></code>·to·be·installed.</p>1181 optional·dependency·<code·class="docutils·literal·notranslate"><span·class="pre">numexpr</span></code>·to·be·installed.</p>
1182 <p>The·<code·class="docutils·literal·notranslate"><span·class="pre">'python'</span></code>·engine·is·generally·<em>not</em>·useful·except·for·testing1182 <p>The·<code·class="docutils·literal·notranslate"><span·class="pre">'python'</span></code>·engine·is·generally·<em>not</em>·useful·except·for·testing
1183 other·evaluation·engines·against·it.·You·will·achieve·<strong>no</strong>·performance1183 other·evaluation·engines·against·it.·You·will·achieve·<strong>no</strong>·performance
1184 benefits·using·<a·class="reference·internal"·href="../reference/api/pandas.eval.html#pandas.eval"·title="pandas.eval"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">eval()</span></code></a>·with·<code·class="docutils·literal·notranslate"><span·class="pre">engine='python'</span></code>·and·may1184 benefits·using·<a·class="reference·internal"·href="../reference/api/pandas.eval.html#pandas.eval"·title="pandas.eval"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">eval()</span></code></a>·with·<code·class="docutils·literal·notranslate"><span·class="pre">engine='python'</span></code>·and·may
1185 incur·a·performance·hit.</p>1185 incur·a·performance·hit.</p>
Max diff block lines reached; 7041/20712 bytes (33.99%) of diff not shown.
10.0 KB
html2text {}
    
Offset 110, 33 lines modifiedOffset 110, 32 lines modified
110 ···...:·····dx·=·(b·-·a)·/·N110 ···...:·····dx·=·(b·-·a)·/·N
111 ···...:·····for·i·in·range(N):111 ···...:·····for·i·in·range(N):
112 ···...:·········s·+=·f(a·+·i·*·dx)112 ···...:·········s·+=·f(a·+·i·*·dx)
113 ···...:·····return·s·*·dx113 ···...:·····return·s·*·dx
114 ···...:114 ···...:
115 We·achieve·our·result·by·using·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e_\x8._\x8a_\x8p_\x8p_\x8l_\x8y_\x8(_\x8)·(row-wise):115 We·achieve·our·result·by·using·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e_\x8._\x8a_\x8p_\x8p_\x8l_\x8y_\x8(_\x8)·(row-wise):
116 In·[5]:·%timeit·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1)116 In·[5]:·%timeit·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1)
117 150·ms·+-·5.27·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)117 177·ms·+-·20.7·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)
118 Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation·using118 Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation·using
119 the·_\x8p_\x8r_\x8u_\x8n_\x8·_\x8i_\x8p_\x8y_\x8t_\x8h_\x8o_\x8n_\x8·_\x8m_\x8a_\x8g_\x8i_\x8c_\x8·_\x8f_\x8u_\x8n_\x8c_\x8t_\x8i_\x8o_\x8n:119 the·_\x8p_\x8r_\x8u_\x8n_\x8·_\x8i_\x8p_\x8y_\x8t_\x8h_\x8o_\x8n_\x8·_\x8m_\x8a_\x8g_\x8i_\x8c_\x8·_\x8f_\x8u_\x8n_\x8c_\x8t_\x8i_\x8o_\x8n:
120 #·most·time·consuming·4·calls120 #·most·time·consuming·4·calls
121 In·[6]:·%prun·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),121 In·[6]:·%prun·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),
122 axis=1)··#·noqa·E999122 axis=1)··#·noqa·E999
123 ·········605946·function·calls·(605928·primitive·calls)·in·1.021·seconds123 ·········605946·function·calls·(605928·primitive·calls)·in·0.296·seconds
  
124 ···Ordered·by:·internal·time124 ···Ordered·by:·internal·time
125 ···List·reduced·from·159·to·4·due·to·restriction·<4>125 ···List·reduced·from·159·to·4·due·to·restriction·<4>
  
126 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)126 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)
127 ·····1000····0.531····0.001····0.905····0.001·<ipython-input-4-c2a74e076cf0>:1127 ·····1000····0.178····0.000····0.259····0.000·<ipython-input-4-c2a74e076cf0>:1
128 (integrate_f)128 (integrate_f)
129 ···552423····0.374····0.000····0.374····0.000·<ipython-input-3-c138bdd570e3>:1129 ···552423····0.080····0.000····0.080····0.000·<ipython-input-3-c138bdd570e3>:1
130 (f)130 (f)
131 ·····3000····0.019····0.000····0.082····0.000·series.py:1095(__getitem__)131 ·····3000····0.006····0.000····0.025····0.000·series.py:1095(__getitem__)
 132 ·····3000····0.004····0.000····0.011····0.000·series.py:1220(_get_value)
132 ····16098····0.014····0.000····0.018····0.000·{built-in·method 
133 builtins.isinstance} 
134 By·far·the·majority·of·time·is·spend·inside·either·integrate_f·or·f,·hence133 By·far·the·majority·of·time·is·spend·inside·either·integrate_f·or·f,·hence
135 we’ll·concentrate·our·efforts·cythonizing·these·two·functions.134 we’ll·concentrate·our·efforts·cythonizing·these·two·functions.
136 *\x8**\x8**\x8**\x8*·P\x8Pl\x8la\x8ai\x8in\x8n·C\x8Cy\x8yt\x8th\x8ho\x8on\x8n_\x8#\x8#·*\x8**\x8**\x8**\x8*135 *\x8**\x8**\x8**\x8*·P\x8Pl\x8la\x8ai\x8in\x8n·C\x8Cy\x8yt\x8th\x8ho\x8on\x8n_\x8#\x8#·*\x8**\x8**\x8**\x8*
137 First·we’re·going·to·need·to·import·the·Cython·magic·function·to·IPython:136 First·we’re·going·to·need·to·import·the·Cython·magic·function·to·IPython:
138 In·[7]:·%load_ext·Cython137 In·[7]:·%load_ext·Cython
139 Now,·let’s·simply·copy·our·functions·over·to·Cython:138 Now,·let’s·simply·copy·our·functions·over·to·Cython:
140 In·[8]:·%%cython139 In·[8]:·%%cython
Offset 147, 15 lines modifiedOffset 146, 15 lines modified
147 ···...:·····dx·=·(b·-·a)·/·N146 ···...:·····dx·=·(b·-·a)·/·N
148 ···...:·····for·i·in·range(N):147 ···...:·····for·i·in·range(N):
149 ···...:·········s·+=·f_plain(a·+·i·*·dx)148 ···...:·········s·+=·f_plain(a·+·i·*·dx)
150 ···...:·····return·s·*·dx149 ···...:·····return·s·*·dx
151 ···...:150 ···...:
152 In·[9]:·%timeit·df.apply(lambda·x:·integrate_f_plain(x["a"],·x["b"],·x["N"]),151 In·[9]:·%timeit·df.apply(lambda·x:·integrate_f_plain(x["a"],·x["b"],·x["N"]),
153 axis=1)152 axis=1)
154 130·ms·+-·359·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)153 182·ms·+-·21.5·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)
155 This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-154 This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-
156 third.155 third.
157 *\x8**\x8**\x8**\x8*·D\x8De\x8ec\x8cl\x8la\x8ar\x8ri\x8in\x8ng\x8g·C\x8C·t\x8ty\x8yp\x8pe\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*156 *\x8**\x8**\x8**\x8*·D\x8De\x8ec\x8cl\x8la\x8ar\x8ri\x8in\x8ng\x8g·C\x8C·t\x8ty\x8yp\x8pe\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*
158 We·can·annotate·the·function·variables·and·return·types·as·well·as·use·cdef·and157 We·can·annotate·the·function·variables·and·return·types·as·well·as·use·cdef·and
159 cpdef·to·improve·performance:158 cpdef·to·improve·performance:
160 In·[10]:·%%cython159 In·[10]:·%%cython
161 ···....:·cdef·double·f_typed(double·x)·except?·-2:160 ···....:·cdef·double·f_typed(double·x)·except?·-2:
Offset 167, 36 lines modifiedOffset 166, 35 lines modified
167 ···....:·····dx·=·(b·-·a)·/·N166 ···....:·····dx·=·(b·-·a)·/·N
168 ···....:·····for·i·in·range(N):167 ···....:·····for·i·in·range(N):
169 ···....:·········s·+=·f_typed(a·+·i·*·dx)168 ···....:·········s·+=·f_typed(a·+·i·*·dx)
170 ···....:·····return·s·*·dx169 ···....:·····return·s·*·dx
171 ···....:170 ···....:
172 In·[11]:·%timeit·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x["N"]),171 In·[11]:·%timeit·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x["N"]),
173 axis=1)172 axis=1)
174 22.8·ms·+-·148·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)173 20.3·ms·+-·93.9·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)
175 Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance174 Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance
176 improvement·compared·to·the·original·Python·implementation.175 improvement·compared·to·the·original·Python·implementation.
177 *\x8**\x8**\x8**\x8*·U\x8Us\x8si\x8in\x8ng\x8g·n\x8nd\x8da\x8ar\x8rr\x8ra\x8ay\x8y_\x8#\x8#·*\x8**\x8**\x8**\x8*176 *\x8**\x8**\x8**\x8*·U\x8Us\x8si\x8in\x8ng\x8g·n\x8nd\x8da\x8ar\x8rr\x8ra\x8ay\x8y_\x8#\x8#·*\x8**\x8**\x8**\x8*
178 When·re-profiling,·time·is·spent·creating·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·from·each·row,·and·calling177 When·re-profiling,·time·is·spent·creating·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·from·each·row,·and·calling
179 __getitem__·from·both·the·index·and·the·series·(three·times·for·each·row).178 __getitem__·from·both·the·index·and·the·series·(three·times·for·each·row).
180 These·Python·function·calls·are·expensive·and·can·be·improved·by·passing·an179 These·Python·function·calls·are·expensive·and·can·be·improved·by·passing·an
181 np.ndarray.180 np.ndarray.
182 In·[12]:·%prun·-l·4·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x181 In·[12]:·%prun·-l·4·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x
183 ["N"]),·axis=1)182 ["N"]),·axis=1)
184 ·········52523·function·calls·(52505·primitive·calls)·in·0.119·seconds183 ·········52523·function·calls·(52505·primitive·calls)·in·0.066·seconds
  
185 ···Ordered·by:·internal·time184 ···Ordered·by:·internal·time
186 ···List·reduced·from·157·to·4·due·to·restriction·<4>185 ···List·reduced·from·157·to·4·due·to·restriction·<4>
  
187 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)186 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)
188 ·····3000····0.019····0.000····0.084····0.000·series.py:1095(__getitem__)187 ·····3000····0.010····0.000····0.042····0.000·series.py:1095(__getitem__)
 188 ·····3000····0.007····0.000····0.019····0.000·series.py:1220(_get_value)
 189 ·····3000····0.007····0.000····0.008····0.000·base.py:3777(get_loc)
189 ····16098····0.014····0.000····0.018····0.000·{built-in·method190 ····16098····0.006····0.000····0.008····0.000·{built-in·method
190 builtins.isinstance}191 builtins.isinstance}
191 ·····3000····0.013····0.000····0.034····0.000·series.py:1220(_get_value) 
192 ·····3000····0.012····0.000····0.021····0.000·indexing.py:2765 
193 (check_dict_or_set_indexers) 
194 In·[13]:·%%cython192 In·[13]:·%%cython
195 ···....:·cimport·numpy·as·np193 ···....:·cimport·numpy·as·np
196 ···....:·import·numpy·as·np194 ···....:·import·numpy·as·np
197 ···....:·cdef·double·f_typed(double·x)·except?·-2:195 ···....:·cdef·double·f_typed(double·x)·except?·-2:
198 ···....:·····return·x·*·(x·-·1)196 ···....:·····return·x·*·(x·-·1)
199 ···....:·cpdef·double·integrate_f_typed(double·a,·double·b,·int·N):197 ···....:·cpdef·double·integrate_f_typed(double·a,·double·b,·int·N):
200 ···....:·····cdef·int·i198 ···....:·····cdef·int·i
Offset 237, 31 lines modifiedOffset 235, 31 lines modified
237 This·implementation·creates·an·array·of·zeros·and·inserts·the·result·of235 This·implementation·creates·an·array·of·zeros·and·inserts·the·result·of
238 integrate_f_typed·applied·over·each·row.·Looping·over·an·ndarray·is·faster·in236 integrate_f_typed·applied·over·each·row.·Looping·over·an·ndarray·is·faster·in
239 Cython·than·looping·over·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·object.237 Cython·than·looping·over·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·object.
240 Since·apply_integrate_f·is·typed·to·accept·an·np.ndarray,·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8)238 Since·apply_integrate_f·is·typed·to·accept·an·np.ndarray,·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8)
241 calls·are·needed·to·utilize·this·function.239 calls·are·needed·to·utilize·this·function.
242 In·[14]:·%timeit·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),·df240 In·[14]:·%timeit·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),·df
243 ["N"].to_numpy())241 ["N"].to_numpy())
244 2.42·ms·+-·2.27·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each)242 3.42·ms·+-·20·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each)
245 Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.243 Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.
246 *\x8**\x8**\x8**\x8*·D\x8Di\x8is\x8sa\x8ab\x8bl\x8li\x8in\x8ng\x8g·c\x8co\x8om\x8mp\x8pi\x8il\x8le\x8er\x8r·d\x8di\x8ir\x8re\x8ec\x8ct\x8ti\x8iv\x8ve\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*244 *\x8**\x8**\x8**\x8*·D\x8Di\x8is\x8sa\x8ab\x8bl\x8li\x8in\x8ng\x8g·c\x8co\x8om\x8mp\x8pi\x8il\x8le\x8er\x8r·d\x8di\x8ir\x8re\x8ec\x8ct\x8ti\x8iv\x8ve\x8es\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*
247 The·majority·of·the·time·is·now·spent·in·apply_integrate_f.·Disabling·Cython’s245 The·majority·of·the·time·is·now·spent·in·apply_integrate_f.·Disabling·Cython’s
248 boundscheck·and·wraparound·checks·can·yield·more·performance.246 boundscheck·and·wraparound·checks·can·yield·more·performance.
249 In·[15]:·%prun·-l·4·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),247 In·[15]:·%prun·-l·4·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),
250 df["N"].to_numpy())248 df["N"].to_numpy())
251 ·········78·function·calls·in·0.003·seconds249 ·········78·function·calls·in·0.004·seconds
  
252 ···Ordered·by:·internal·time250 ···Ordered·by:·internal·time
253 ···List·reduced·from·21·to·4·due·to·restriction·<4>251 ···List·reduced·from·21·to·4·due·to·restriction·<4>
  
254 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)252 ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)
255 ········1····0.002····0.002····0.003····0.003·<string>:1(<module>)253 ········1····0.003····0.003····0.004····0.004·<string>:1(<module>)
256 ········1····0.000····0.000····0.000····0.000·{method·'disable'·of254 ········1····0.000····0.000····0.000····0.000·{method·'disable'·of
257 '_lsprof.Profiler'·objects}255 '_lsprof.Profiler'·objects}
258 ········1····0.000····0.000····0.003····0.003·{built-in·method·builtins.exec}256 ········1····0.000····0.000····0.004····0.004·{built-in·method·builtins.exec}
259 ········3····0.000····0.000····0.000····0.000·frame.py:4062(__getitem__)257 ········3····0.000····0.000····0.000····0.000·frame.py:4062(__getitem__)
260 In·[16]:·%%cython258 In·[16]:·%%cython
261 ···....:·cimport·cython259 ···....:·cimport·cython
262 ···....:·cimport·numpy·as·np260 ···....:·cimport·numpy·as·np
263 ···....:·import·numpy·as·np261 ···....:·import·numpy·as·np
264 ···....:·cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2:262 ···....:·cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2:
265 ···....:·····return·x·*·(x·-·1)263 ···....:·····return·x·*·(x·-·1)
Offset 648, 17 lines modifiedOffset 646, 17 lines modified
648 The·'numexpr'·engine·is·the·more·performant·engine·that·can·yield·performance646 The·'numexpr'·engine·is·the·more·performant·engine·that·can·yield·performance
649 improvements·compared·to·standard·Python·syntax·for·large·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e.·This647 improvements·compared·to·standard·Python·syntax·for·large·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e.·This
650 engine·requires·the·optional·dependency·numexpr·to·be·installed.648 engine·requires·the·optional·dependency·numexpr·to·be·installed.
651 The·'python'·engine·is·generally·n\x8no\x8ot\x8t·useful·except·for·testing·other·evaluation649 The·'python'·engine·is·generally·n\x8no\x8ot\x8t·useful·except·for·testing·other·evaluation
652 engines·against·it.·You·will·achieve·n\x8no\x8o·performance·benefits·using·_\x8e_\x8v_\x8a_\x8l_\x8(_\x8)·with650 engines·against·it.·You·will·achieve·n\x8no\x8o·performance·benefits·using·_\x8e_\x8v_\x8a_\x8l_\x8(_\x8)·with
Max diff block lines reached; 2789/10256 bytes (27.19%) of diff not shown.
5.37 KB
./usr/share/doc/python-pandas-doc/html/user_guide/pyarrow.html
    
Offset 986, 26 lines modifiedOffset 986, 19 lines modified
986 <span·class="n">Cell</span>·<span·class="n">In</span><span·class="p">[</span><span·class="mi">33</span><span·class="p">],</span>·<span·class="n">line</span>·<span·class="mi">1</span>986 <span·class="n">Cell</span>·<span·class="n">In</span><span·class="p">[</span><span·class="mi">33</span><span·class="p">],</span>·<span·class="n">line</span>·<span·class="mi">1</span>
987 <span·class="ne">----&gt;·</span><span·class="mi">1</span>·<span·class="n">table</span>·<span·class="o">=</span>·<span·class="n">pa</span><span·class="o">.</span><span·class="n">table</span><span·class="p">([</span><span·class="n">pa</span><span·class="o">.</span><span·class="n">array</span><span·class="p">([</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="mi">3</span><span·class="p">],</span>·<span·class="nb">type</span><span·class="o">=</span><span·class="n">pa</span><span·class="o">.</span><span·class="n">int64</span><span·class="p">())],</span>·<span·class="n">names</span><span·class="o">=</span><span·class="p">[</span><span·class="s2">&quot;a&quot;</span><span·class="p">])</span>987 <span·class="ne">----&gt;·</span><span·class="mi">1</span>·<span·class="n">table</span>·<span·class="o">=</span>·<span·class="n">pa</span><span·class="o">.</span><span·class="n">table</span><span·class="p">([</span><span·class="n">pa</span><span·class="o">.</span><span·class="n">array</span><span·class="p">([</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="mi">3</span><span·class="p">],</span>·<span·class="nb">type</span><span·class="o">=</span><span·class="n">pa</span><span·class="o">.</span><span·class="n">int64</span><span·class="p">())],</span>·<span·class="n">names</span><span·class="o">=</span><span·class="p">[</span><span·class="s2">&quot;a&quot;</span><span·class="p">])</span>
  
988 <span·class="ne">NameError</span>:·name·&#39;pa&#39;·is·not·defined988 <span·class="ne">NameError</span>:·name·&#39;pa&#39;·is·not·defined
  
989 <span·class="gp">In·[34]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">table</span><span·class="o">.</span><span·class="n">to_pandas</span><span·class="p">(</span><span·class="n">types_mapper</span><span·class="o">=</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">ArrowDtype</span><span·class="p">)</span>989 <span·class="gp">In·[34]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">table</span><span·class="o">.</span><span·class="n">to_pandas</span><span·class="p">(</span><span·class="n">types_mapper</span><span·class="o">=</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">ArrowDtype</span><span·class="p">)</span>
990 <span·class="gt">---------------------------------------------------------------------------</span>990 <span·class="gt">---------------------------------------------------------------------------</span>
991 <span·class="ne">AttributeError</span><span·class="g·g-Whitespace">····························</span>Traceback·(most·recent·call·last)991 <span·class="ne">NameError</span><span·class="g·g-Whitespace">·································</span>Traceback·(most·recent·call·last)
992 <span·class="nn">&lt;ipython-input-34-64ec62289cb4&gt;</span>·in·<span·class="ni">?</span><span·class="nt">()</span>992 <span·class="n">Cell</span>·<span·class="n">In</span><span·class="p">[</span><span·class="mi">34</span><span·class="p">],</span>·<span·class="n">line</span>·<span·class="mi">1</span>
993 <span·class="ne">----&gt;·</span><span·class="mi">1</span>·<span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">table</span><span·class="o">.</span><span·class="n">to_pandas</span><span·class="p">(</span><span·class="n">types_mapper</span><span·class="o">=</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">ArrowDtype</span><span·class="p">)</span>993 <span·class="ne">----&gt;·</span><span·class="mi">1</span>·<span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">table</span><span·class="o">.</span><span·class="n">to_pandas</span><span·class="p">(</span><span·class="n">types_mapper</span><span·class="o">=</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">ArrowDtype</span><span·class="p">)</span>
  
 994 <span·class="ne">NameError</span>:·name·&#39;table&#39;·is·not·defined
994 <span·class="nn">/usr/lib/python3/dist-packages/pandas/core/generic.py</span>·in·<span·class="ni">?</span><span·class="nt">(self,·name)</span> 
995 <span·class="g·g-Whitespace">···</span><span·class="mi">6295</span>·············<span·class="ow">and</span>·<span·class="n">name</span>·<span·class="ow">not</span>·<span·class="ow">in</span>·<span·class="bp">self</span><span·class="o">.</span><span·class="n">_accessors</span> 
996 <span·class="g·g-Whitespace">···</span><span·class="mi">6296</span>·············<span·class="ow">and</span>·<span·class="bp">self</span><span·class="o">.</span><span·class="n">_info_axis</span><span·class="o">.</span><span·class="n">_can_hold_identifiers_and_holds_name</span><span·class="p">(</span><span·class="n">name</span><span·class="p">)</span> 
997 <span·class="g·g-Whitespace">···</span><span·class="mi">6297</span>·········<span·class="p">):</span> 
998 <span·class="g·g-Whitespace">···</span><span·class="mi">6298</span>·············<span·class="k">return</span>·<span·class="bp">self</span><span·class="p">[</span><span·class="n">name</span><span·class="p">]</span> 
999 <span·class="ne">-&gt;·</span><span·class="mi">6299</span>·········<span·class="k">return</span>·<span·class="nb">object</span><span·class="o">.</span><span·class="fm">__getattribute__</span><span·class="p">(</span><span·class="bp">self</span><span·class="p">,</span>·<span·class="n">name</span><span·class="p">)</span> 
  
1000 <span·class="ne">AttributeError</span>:·&#39;DataFrame&#39;·object·has·no·attribute·&#39;to_pandas&#39; 
  
1001 <span·class="gp">In·[35]:·</span><span·class="n">df</span>995 <span·class="gp">In·[35]:·</span><span·class="n">df</span>
1002 <span·class="gh">Out[35]:·</span>996 <span·class="gh">Out[35]:·</span>
1003 <span·class="go">·····a····b</span>997 <span·class="go">·····a····b</span>
1004 <span·class="go">0··xxx··yyy</span>998 <span·class="go">0··xxx··yyy</span>
1005 <span·class="go">1···¡¡···¡¡</span>999 <span·class="go">1···¡¡···¡¡</span>
  
1.08 KB
html2text {}
    
Offset 526, 27 lines modifiedOffset 526, 19 lines modified
526 Cell·In[33],·line·1526 Cell·In[33],·line·1
527 ---->·1·table·=·pa.table([pa.array([1,·2,·3],·type=pa.int64())],·names=["a"])527 ---->·1·table·=·pa.table([pa.array([1,·2,·3],·type=pa.int64())],·names=["a"])
  
528 NameError:·name·'pa'·is·not·defined528 NameError:·name·'pa'·is·not·defined
  
529 In·[34]:·df·=·table.to_pandas(types_mapper=pd.ArrowDtype)529 In·[34]:·df·=·table.to_pandas(types_mapper=pd.ArrowDtype)
530 ---------------------------------------------------------------------------530 ---------------------------------------------------------------------------
531 AttributeError····························Traceback·(most·recent·call·last)531 NameError·································Traceback·(most·recent·call·last)
532 <ipython-input-34-64ec62289cb4>·in·?()532 Cell·In[34],·line·1
533 ---->·1·df·=·table.to_pandas(types_mapper=pd.ArrowDtype)533 ---->·1·df·=·table.to_pandas(types_mapper=pd.ArrowDtype)
  
 534 NameError:·name·'table'·is·not·defined
534 /usr/lib/python3/dist-packages/pandas/core/generic.py·in·?(self,·name) 
535 ···6295·············and·name·not·in·self._accessors 
536 ···6296·············and·self._info_axis._can_hold_identifiers_and_holds_name 
537 (name) 
538 ···6297·········): 
539 ···6298·············return·self[name] 
540 ->·6299·········return·object.__getattribute__(self,·name) 
  
541 AttributeError:·'DataFrame'·object·has·no·attribute·'to_pandas' 
  
542 In·[35]:·df535 In·[35]:·df
543 Out[35]:536 Out[35]:
544 ·····a····b537 ·····a····b
545 0··xxx··yyy538 0··xxx··yyy
546 1···¡¡···¡¡539 1···¡¡···¡¡
  
4.07 KB
./usr/share/doc/python-pandas-doc/html/user_guide/scale.html
    
Offset 1086, 16 lines modifiedOffset 1086, 16 lines modified
1086 <span·class="gp">···....:·</span><span·class="n">files</span>·<span·class="o">=</span>·<span·class="n">pathlib</span><span·class="o">.</span><span·class="n">Path</span><span·class="p">(</span><span·class="s2">&quot;data/timeseries/&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">glob</span><span·class="p">(</span><span·class="s2">&quot;ts*.parquet&quot;</span><span·class="p">)</span>1086 <span·class="gp">···....:·</span><span·class="n">files</span>·<span·class="o">=</span>·<span·class="n">pathlib</span><span·class="o">.</span><span·class="n">Path</span><span·class="p">(</span><span·class="s2">&quot;data/timeseries/&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">glob</span><span·class="p">(</span><span·class="s2">&quot;ts*.parquet&quot;</span><span·class="p">)</span>
1087 <span·class="gp">···....:·</span><span·class="n">counts</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">dtype</span><span·class="o">=</span><span·class="nb">int</span><span·class="p">)</span>1087 <span·class="gp">···....:·</span><span·class="n">counts</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">dtype</span><span·class="o">=</span><span·class="nb">int</span><span·class="p">)</span>
1088 <span·class="gp">···....:·</span><span·class="k">for</span>·<span·class="n">path</span>·<span·class="ow">in</span>·<span·class="n">files</span><span·class="p">:</span>1088 <span·class="gp">···....:·</span><span·class="k">for</span>·<span·class="n">path</span>·<span·class="ow">in</span>·<span·class="n">files</span><span·class="p">:</span>
1089 <span·class="gp">···....:·</span>····<span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_parquet</span><span·class="p">(</span><span·class="n">path</span><span·class="p">)</span>1089 <span·class="gp">···....:·</span>····<span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_parquet</span><span·class="p">(</span><span·class="n">path</span><span·class="p">)</span>
1090 <span·class="gp">···....:·</span>····<span·class="n">counts</span>·<span·class="o">=</span>·<span·class="n">counts</span><span·class="o">.</span><span·class="n">add</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;name&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">value_counts</span><span·class="p">(),</span>·<span·class="n">fill_value</span><span·class="o">=</span><span·class="mi">0</span><span·class="p">)</span>1090 <span·class="gp">···....:·</span>····<span·class="n">counts</span>·<span·class="o">=</span>·<span·class="n">counts</span><span·class="o">.</span><span·class="n">add</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;name&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">value_counts</span><span·class="p">(),</span>·<span·class="n">fill_value</span><span·class="o">=</span><span·class="mi">0</span><span·class="p">)</span>
1091 <span·class="gp">···....:·</span><span·class="n">counts</span><span·class="o">.</span><span·class="n">astype</span><span·class="p">(</span><span·class="nb">int</span><span·class="p">)</span>1091 <span·class="gp">···....:·</span><span·class="n">counts</span><span·class="o">.</span><span·class="n">astype</span><span·class="p">(</span><span·class="nb">int</span><span·class="p">)</span>
1092 <span·class="gp">···....:·</span>1092 <span·class="gp">···....:·</span>
1093 <span·class="go">CPU·times:·user·162·us,·sys:·460·us,·total:·622·us</span>1093 <span·class="go">CPU·times:·user·271·us,·sys:·259·us,·total:·530·us</span>
1094 <span·class="go">Wall·time:·630·us</span>1094 <span·class="go">Wall·time:·538·us</span>
1095 <span·class="gh">Out[32]:·</span><span·class="go">Series([],·dtype:·int32)</span>1095 <span·class="gh">Out[32]:·</span><span·class="go">Series([],·dtype:·int32)</span>
1096 </pre></div>1096 </pre></div>
1097 </div>1097 </div>
1098 <p>Some·readers,·like·<a·class="reference·internal"·href="../reference/api/pandas.read_csv.html#pandas.read_csv"·title="pandas.read_csv"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">pandas.read_csv()</span></code></a>,·offer·parameters·to·control·the1098 <p>Some·readers,·like·<a·class="reference·internal"·href="../reference/api/pandas.read_csv.html#pandas.read_csv"·title="pandas.read_csv"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">pandas.read_csv()</span></code></a>,·offer·parameters·to·control·the
1099 <code·class="docutils·literal·notranslate"><span·class="pre">chunksize</span></code>·when·reading·a·single·file.</p>1099 <code·class="docutils·literal·notranslate"><span·class="pre">chunksize</span></code>·when·reading·a·single·file.</p>
1100 <p>Manually·chunking·is·an·OK·option·for·workflows·that·don’t1100 <p>Manually·chunking·is·an·OK·option·for·workflows·that·don’t
1101 require·too·sophisticated·of·operations.·Some·operations,·like·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby"·title="pandas.DataFrame.groupby"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">pandas.DataFrame.groupby()</span></code></a>,·are1101 require·too·sophisticated·of·operations.·Some·operations,·like·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby"·title="pandas.DataFrame.groupby"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">pandas.DataFrame.groupby()</span></code></a>,·are
1020 B
html2text {}
    
Offset 644, 16 lines modifiedOffset 644, 16 lines modified
644 ···....:·files·=·pathlib.Path("data/timeseries/").glob("ts*.parquet")644 ···....:·files·=·pathlib.Path("data/timeseries/").glob("ts*.parquet")
645 ···....:·counts·=·pd.Series(dtype=int)645 ···....:·counts·=·pd.Series(dtype=int)
646 ···....:·for·path·in·files:646 ···....:·for·path·in·files:
647 ···....:·····df·=·pd.read_parquet(path)647 ···....:·····df·=·pd.read_parquet(path)
648 ···....:·····counts·=·counts.add(df["name"].value_counts(),·fill_value=0)648 ···....:·····counts·=·counts.add(df["name"].value_counts(),·fill_value=0)
649 ···....:·counts.astype(int)649 ···....:·counts.astype(int)
650 ···....:650 ···....:
651 CPU·times:·user·162·us,·sys:·460·us,·total:·622·us651 CPU·times:·user·271·us,·sys:·259·us,·total:·530·us
652 Wall·time:·630·us652 Wall·time:·538·us
653 Out[32]:·Series([],·dtype:·int32)653 Out[32]:·Series([],·dtype:·int32)
654 Some·readers,·like·_\x8p_\x8a_\x8n_\x8d_\x8a_\x8s_\x8._\x8r_\x8e_\x8a_\x8d_\x8__\x8c_\x8s_\x8v_\x8(_\x8),·offer·parameters·to·control·the·chunksize654 Some·readers,·like·_\x8p_\x8a_\x8n_\x8d_\x8a_\x8s_\x8._\x8r_\x8e_\x8a_\x8d_\x8__\x8c_\x8s_\x8v_\x8(_\x8),·offer·parameters·to·control·the·chunksize
655 when·reading·a·single·file.655 when·reading·a·single·file.
656 Manually·chunking·is·an·OK·option·for·workflows·that·don’t·require·too656 Manually·chunking·is·an·OK·option·for·workflows·that·don’t·require·too
657 sophisticated·of·operations.·Some·operations,·like·_\x8p_\x8a_\x8n_\x8d_\x8a_\x8s_\x8._\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e_\x8._\x8g_\x8r_\x8o_\x8u_\x8p_\x8b_\x8y_\x8(_\x8),657 sophisticated·of·operations.·Some·operations,·like·_\x8p_\x8a_\x8n_\x8d_\x8a_\x8s_\x8._\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e_\x8._\x8g_\x8r_\x8o_\x8u_\x8p_\x8b_\x8y_\x8(_\x8),
658 are·much·harder·to·do·chunkwise.·In·these·cases,·you·may·be·better·switching·to658 are·much·harder·to·do·chunkwise.·In·these·cases,·you·may·be·better·switching·to
659 a·different·library·that·implements·these·out-of-core·algorithms·for·you.659 a·different·library·that·implements·these·out-of-core·algorithms·for·you.
89.1 KB
./usr/share/doc/python-pandas-doc/html/user_guide/style.ipynb.gz
88.9 KB
style.ipynb
88.9 KB
Pretty-printed
Similarity: 0.9985610875706213% Differences: {"'cells'": "{1: {'metadata': {'execution': {'iopub.execute_input': '2026-05-03T19:44:33.845345Z', " "'iopub.status.busy': '2026-05-03T19:44:33.845105Z', 'iopub.status.idle': " "'2026-05-03T19:44:34.235274Z', 'shell.execute_reply': " "'2026-05-03T19:44:34.234607Z'}}}, 3: {'metadata': {'execution': " "{'iopub.execute_input': '2026-05-03T19:44:34.237753Z', 'iopub.status.busy': " "'2026-05-03T19:44:34.237445Z', 'iopub.status.idle': '2026-05-03T19:44:3 […]
    
Offset 39, 18 lines modifiedOffset 39, 18 lines modified
39 ············]39 ············]
40 ········},40 ········},
41 ········{41 ········{
42 ············"cell_type":·"code",42 ············"cell_type":·"code",
43 ············"execution_count":·1,43 ············"execution_count":·1,
44 ············"metadata":·{44 ············"metadata":·{
45 ················"execution":·{45 ················"execution":·{
46 ····················"iopub.execute_input":·"2025-03-31T12:10:18.920313Z",46 ····················"iopub.execute_input":·"2026-05-03T19:44:33.845345Z",
47 ····················"iopub.status.busy":·"2025-03-31T12:10:18.920009Z",47 ····················"iopub.status.busy":·"2026-05-03T19:44:33.845105Z",
48 ····················"iopub.status.idle":·"2025-03-31T12:10:19.702226Z",48 ····················"iopub.status.idle":·"2026-05-03T19:44:34.235274Z",
49 ····················"shell.execute_reply":·"2025-03-31T12:10:19.701242Z"49 ····················"shell.execute_reply":·"2026-05-03T19:44:34.234607Z"
50 ················},50 ················},
51 ················"nbsphinx":·"hidden"51 ················"nbsphinx":·"hidden"
52 ············},52 ············},
53 ············"outputs":·[],53 ············"outputs":·[],
54 ············"source":·[54 ············"source":·[
55 ················"import·matplotlib.pyplot\n",55 ················"import·matplotlib.pyplot\n",
56 ················"#·We·have·this·here·to·trigger·matplotlib's·font·cache·stuff.\n",56 ················"#·We·have·this·here·to·trigger·matplotlib's·font·cache·stuff.\n",
Offset 77, 36 lines modifiedOffset 77, 36 lines modified
77 ············]77 ············]
78 ········},78 ········},
79 ········{79 ········{
80 ············"cell_type":·"code",80 ············"cell_type":·"code",
81 ············"execution_count":·2,81 ············"execution_count":·2,
82 ············"metadata":·{82 ············"metadata":·{
83 ················"execution":·{83 ················"execution":·{
84 ····················"iopub.execute_input":·"2025-03-31T12:10:19.705752Z",84 ····················"iopub.execute_input":·"2026-05-03T19:44:34.237753Z",
85 ····················"iopub.status.busy":·"2025-03-31T12:10:19.705364Z",85 ····················"iopub.status.busy":·"2026-05-03T19:44:34.237445Z",
86 ····················"iopub.status.idle":·"2025-03-31T12:10:20.318721Z",86 ····················"iopub.status.idle":·"2026-05-03T19:44:34.528179Z",
87 ····················"shell.execute_reply":·"2025-03-31T12:10:20.317763Z"87 ····················"shell.execute_reply":·"2026-05-03T19:44:34.527483Z"
88 ················}88 ················}
89 ············},89 ············},
90 ············"outputs":·[],90 ············"outputs":·[],
91 ············"source":·[91 ············"source":·[
92 ················"import·pandas·as·pd\n",92 ················"import·pandas·as·pd\n",
93 ················"import·numpy·as·np\n",93 ················"import·numpy·as·np\n",
94 ················"import·matplotlib·as·mpl\n"94 ················"import·matplotlib·as·mpl\n"
95 ············]95 ············]
96 ········},96 ········},
97 ········{97 ········{
98 ············"cell_type":·"code",98 ············"cell_type":·"code",
99 ············"execution_count":·3,99 ············"execution_count":·3,
100 ············"metadata":·{100 ············"metadata":·{
101 ················"execution":·{101 ················"execution":·{
102 ····················"iopub.execute_input":·"2025-03-31T12:10:20.322096Z",102 ····················"iopub.execute_input":·"2026-05-03T19:44:34.530470Z",
103 ····················"iopub.status.busy":·"2025-03-31T12:10:20.321680Z",103 ····················"iopub.status.busy":·"2026-05-03T19:44:34.530173Z",
104 ····················"iopub.status.idle":·"2025-03-31T12:10:20.425042Z",104 ····················"iopub.status.idle":·"2026-05-03T19:44:34.587165Z",
105 ····················"shell.execute_reply":·"2025-03-31T12:10:20.424082Z"105 ····················"shell.execute_reply":·"2026-05-03T19:44:34.586556Z"
106 ················},106 ················},
107 ················"nbsphinx":·"hidden"107 ················"nbsphinx":·"hidden"
108 ············},108 ············},
109 ············"outputs":·[],109 ············"outputs":·[],
110 ············"source":·[110 ············"source":·[
111 ················"#·For·reproducibility·-·this·doesn't·respect·uuid_len·or·positionally-passed·uuid·but·the·places·here·that·use·that·coincidentally·bypass·this·anyway\n",111 ················"#·For·reproducibility·-·this·doesn't·respect·uuid_len·or·positionally-passed·uuid·but·the·places·here·that·use·that·coincidentally·bypass·this·anyway\n",
112 ················"from·pandas.io.formats.style·import·Styler\n",112 ················"from·pandas.io.formats.style·import·Styler\n",
Offset 123, 18 lines modifiedOffset 123, 18 lines modified
123 ············]123 ············]
124 ········},124 ········},
125 ········{125 ········{
126 ············"cell_type":·"code",126 ············"cell_type":·"code",
127 ············"execution_count":·4,127 ············"execution_count":·4,
128 ············"metadata":·{128 ············"metadata":·{
129 ················"execution":·{129 ················"execution":·{
130 ····················"iopub.execute_input":·"2025-03-31T12:10:20.428297Z",130 ····················"iopub.execute_input":·"2026-05-03T19:44:34.589156Z",
131 ····················"iopub.status.busy":·"2025-03-31T12:10:20.427918Z",131 ····················"iopub.status.busy":·"2026-05-03T19:44:34.588867Z",
132 ····················"iopub.status.idle":·"2025-03-31T12:10:20.440991Z",132 ····················"iopub.status.idle":·"2026-05-03T19:44:34.597950Z",
133 ····················"shell.execute_reply":·"2025-03-31T12:10:20.440123Z"133 ····················"shell.execute_reply":·"2026-05-03T19:44:34.597355Z"
134 ················}134 ················}
135 ············},135 ············},
136 ············"outputs":·[136 ············"outputs":·[
137 ················{137 ················{
138 ····················"data":·{138 ····················"data":·{
139 ························"text/html":·[139 ························"text/html":·[
140 ····························"<style·type=\"text/css\">\n",140 ····························"<style·type=\"text/css\">\n",
Offset 193, 18 lines modifiedOffset 193, 18 lines modified
193 ············]193 ············]
194 ········},194 ········},
195 ········{195 ········{
196 ············"cell_type":·"code",196 ············"cell_type":·"code",
197 ············"execution_count":·5,197 ············"execution_count":·5,
198 ············"metadata":·{198 ············"metadata":·{
199 ················"execution":·{199 ················"execution":·{
200 ····················"iopub.execute_input":·"2025-03-31T12:10:20.499714Z",200 ····················"iopub.execute_input":·"2026-05-03T19:44:34.631970Z",
201 ····················"iopub.status.busy":·"2025-03-31T12:10:20.499332Z",201 ····················"iopub.status.busy":·"2026-05-03T19:44:34.631728Z",
202 ····················"iopub.status.idle":·"2025-03-31T12:10:20.514223Z",202 ····················"iopub.status.idle":·"2026-05-03T19:44:34.642471Z",
203 ····················"shell.execute_reply":·"2025-03-31T12:10:20.513357Z"203 ····················"shell.execute_reply":·"2026-05-03T19:44:34.641896Z"
204 ················}204 ················}
205 ············},205 ············},
206 ············"outputs":·[206 ············"outputs":·[
207 ················{207 ················{
208 ····················"data":·{208 ····················"data":·{
209 ························"text/html":·[209 ························"text/html":·[
210 ····························"<div>\n",210 ····························"<div>\n",
Offset 327, 18 lines modifiedOffset 327, 18 lines modified
327 ············]327 ············]
328 ········},328 ········},
329 ········{329 ········{
330 ············"cell_type":·"code",330 ············"cell_type":·"code",
331 ············"execution_count":·6,331 ············"execution_count":·6,
332 ············"metadata":·{332 ············"metadata":·{
333 ················"execution":·{333 ················"execution":·{
334 ····················"iopub.execute_input":·"2025-03-31T12:10:20.517181Z",334 ····················"iopub.execute_input":·"2026-05-03T19:44:34.644317Z",
335 ····················"iopub.status.busy":·"2025-03-31T12:10:20.516875Z",335 ····················"iopub.status.busy":·"2026-05-03T19:44:34.644077Z",
336 ····················"iopub.status.idle":·"2025-03-31T12:10:20.530662Z",336 ····················"iopub.status.idle":·"2026-05-03T19:44:34.654716Z",
337 ····················"shell.execute_reply":·"2025-03-31T12:10:20.529810Z"337 ····················"shell.execute_reply":·"2026-05-03T19:44:34.654140Z"
338 ················}338 ················}
339 ············},339 ············},
340 ············"outputs":·[340 ············"outputs":·[
341 ················{341 ················{
342 ····················"data":·{342 ····················"data":·{
343 ························"text/html":·[343 ························"text/html":·[
344 ····························"<style·type=\"text/css\">\n",344 ····························"<style·type=\"text/css\">\n",
Offset 448, 18 lines modifiedOffset 448, 18 lines modified
448 ············]448 ············]
449 ········},449 ········},
450 ········{450 ········{
451 ············"cell_type":·"code",451 ············"cell_type":·"code",
452 ············"execution_count":·7,452 ············"execution_count":·7,
453 ············"metadata":·{453 ············"metadata":·{
454 ················"execution":·{454 ················"execution":·{
455 ····················"iopub.execute_input":·"2025-03-31T12:10:20.533464Z",455 ····················"iopub.execute_input":·"2026-05-03T19:44:34.656598Z",
456 ····················"iopub.status.busy":·"2025-03-31T12:10:20.533160Z",456 ····················"iopub.status.busy":·"2026-05-03T19:44:34.656364Z",
457 ····················"iopub.status.idle":·"2025-03-31T12:10:20.543093Z",457 ····················"iopub.status.idle":·"2026-05-03T19:44:34.663708Z",
458 ····················"shell.execute_reply":·"2025-03-31T12:10:20.542248Z"458 ····················"shell.execute_reply":·"2026-05-03T19:44:34.663130Z"
459 ················}459 ················}
460 ············},460 ············},
461 ············"outputs":·[461 ············"outputs":·[
Max diff block lines reached; 83518/90470 bytes (92.32%) of diff not shown.
3.73 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.0.html
    
Offset 1613, 20 lines modifiedOffset 1613, 20 lines modified
1613 <span·class="gp">In·[94]:·</span><span·class="n">df1</span><span·class="p">,</span>·<span·class="n">df2</span><span·class="p">,</span>·<span·class="n">df3</span><span·class="p">,</span>·<span·class="n">df4</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">(</span><span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">randn</span><span·class="p">(</span><span·class="n">nrows</span><span·class="p">,</span>·<span·class="n">ncols</span><span·class="p">))</span>1613 <span·class="gp">In·[94]:·</span><span·class="n">df1</span><span·class="p">,</span>·<span·class="n">df2</span><span·class="p">,</span>·<span·class="n">df3</span><span·class="p">,</span>·<span·class="n">df4</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">(</span><span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">randn</span><span·class="p">(</span><span·class="n">nrows</span><span·class="p">,</span>·<span·class="n">ncols</span><span·class="p">))</span>
1614 <span·class="gp">···....:·</span>······················<span·class="k">for</span>·<span·class="n">_</span>·<span·class="ow">in</span>·<span·class="nb">range</span><span·class="p">(</span><span·class="mi">4</span><span·class="p">)]</span>1614 <span·class="gp">···....:·</span>······················<span·class="k">for</span>·<span·class="n">_</span>·<span·class="ow">in</span>·<span·class="nb">range</span><span·class="p">(</span><span·class="mi">4</span><span·class="p">)]</span>
1615 <span·class="gp">···....:·</span>1615 <span·class="gp">···....:·</span>
1616 </pre></div>1616 </pre></div>
1617 </div>1617 </div>
1618 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·eval·with·NumExpr·backend</span>1618 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·eval·with·NumExpr·backend</span>
1619 <span·class="gp">In·[95]:·</span><span·class="o">%</span><span·class="k">timeit</span>·pd.eval(&#39;df1·+·df2·+·df3·+·df4&#39;)1619 <span·class="gp">In·[95]:·</span><span·class="o">%</span><span·class="k">timeit</span>·pd.eval(&#39;df1·+·df2·+·df3·+·df4&#39;)
1620 <span·class="go">237·ms·+-·27.3·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span>1620 <span·class="go">219·ms·+-·38.5·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span>
1621 </pre></div>1621 </pre></div>
1622 </div>1622 </div>
1623 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·pure·Python·evaluation</span>1623 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·pure·Python·evaluation</span>
1624 <span·class="gp">In·[96]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df1·+·df2·+·df3·+·df41624 <span·class="gp">In·[96]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df1·+·df2·+·df3·+·df4
1625 <span·class="go">630·ms·+-·60.1·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span>1625 <span·class="go">690·ms·+-·38·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span>
1626 </pre></div>1626 </pre></div>
1627 </div>1627 </div>
1628 <p>For·more·details,·see·the·<a·class="reference·internal"·href="../user_guide/enhancingperf.html#enhancingperf-eval"><span·class="std·std-ref">the·docs</span></a></p>1628 <p>For·more·details,·see·the·<a·class="reference·internal"·href="../user_guide/enhancingperf.html#enhancingperf-eval"><span·class="std·std-ref">the·docs</span></a></p>
1629 </li>1629 </li>
1630 <li><p>Similar·to·<code·class="docutils·literal·notranslate"><span·class="pre">pandas.eval</span></code>,·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.html#pandas.DataFrame"·title="pandas.DataFrame"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">DataFrame</span></code></a>·has·a·new1630 <li><p>Similar·to·<code·class="docutils·literal·notranslate"><span·class="pre">pandas.eval</span></code>,·<a·class="reference·internal"·href="../reference/api/pandas.DataFrame.html#pandas.DataFrame"·title="pandas.DataFrame"><code·class="xref·py·py-class·docutils·literal·notranslate"><span·class="pre">DataFrame</span></code></a>·has·a·new
1631 <code·class="docutils·literal·notranslate"><span·class="pre">DataFrame.eval</span></code>·method·that·evaluates·an·expression·in·the·context·of1631 <code·class="docutils·literal·notranslate"><span·class="pre">DataFrame.eval</span></code>·method·that·evaluates·an·expression·in·the·context·of
1632 the·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>.·For·example,</p>1632 the·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>.·For·example,</p>
1.02 KB
html2text {}
    
Offset 965, 18 lines modifiedOffset 965, 18 lines modified
  
965 ······In·[94]:·df1,·df2,·df3,·df4·=·[pd.DataFrame(np.random.randn(nrows,965 ······In·[94]:·df1,·df2,·df3,·df4·=·[pd.DataFrame(np.random.randn(nrows,
966 ······ncols))966 ······ncols))
967 ·········....:·······················for·_·in·range(4)]967 ·········....:·······················for·_·in·range(4)]
968 ·········....:968 ·········....:
969 ······#·eval·with·NumExpr·backend969 ······#·eval·with·NumExpr·backend
970 ······In·[95]:·%timeit·pd.eval('df1·+·df2·+·df3·+·df4')970 ······In·[95]:·%timeit·pd.eval('df1·+·df2·+·df3·+·df4')
971 ······237·ms·+-·27.3·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)971 ······219·ms·+-·38.5·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)
972 ······#·pure·Python·evaluation972 ······#·pure·Python·evaluation
973 ······In·[96]:·%timeit·df1·+·df2·+·df3·+·df4973 ······In·[96]:·%timeit·df1·+·df2·+·df3·+·df4
974 ······630·ms·+-·60.1·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)974 ······690·ms·+-·38·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)
975 ······For·more·details,·see·the·_\x8t_\x8h_\x8e_\x8·_\x8d_\x8o_\x8c_\x8s975 ······For·more·details,·see·the·_\x8t_\x8h_\x8e_\x8·_\x8d_\x8o_\x8c_\x8s
976 ····*·Similar·to·pandas.eval,·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e·has·a·new·DataFrame.eval·method·that976 ····*·Similar·to·pandas.eval,·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e·has·a·new·DataFrame.eval·method·that
977 ······evaluates·an·expression·in·the·context·of·the·DataFrame.·For·example,977 ······evaluates·an·expression·in·the·context·of·the·DataFrame.·For·example,
978 ······In·[97]:·df·=·pd.DataFrame(np.random.randn(10,·2),·columns=['a',·'b'])978 ······In·[97]:·df·=·pd.DataFrame(np.random.randn(10,·2),·columns=['a',·'b'])
  
979 ······In·[98]:·df.eval('a·+·b')979 ······In·[98]:·df.eval('a·+·b')
980 ······Out[98]:980 ······Out[98]:
16.9 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.1.html
    
Offset 821, 62 lines modifiedOffset 821, 64 lines modified
821 facilitate·replication.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/2419">GH·2419</a>)</p>821 facilitate·replication.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/2419">GH·2419</a>)</p>
822 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[1]:·</span><span·class="n">example_series</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="mi">3</span><span·class="p">,</span>·<span·class="mi">4</span><span·class="p">,</span>·<span·class="mi">5</span><span·class="p">])</span>822 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[1]:·</span><span·class="n">example_series</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="mi">3</span><span·class="p">,</span>·<span·class="mi">4</span><span·class="p">,</span>·<span·class="mi">5</span><span·class="p">])</span>
  
823 <span·class="go">#·When·no·arguments·are·passed,·returns·1</span>823 <span·class="go">#·When·no·arguments·are·passed,·returns·1</span>
824 <span·class="gp">In·[2]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">()</span>824 <span·class="gp">In·[2]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">()</span>
825 <span·class="gh">Out[2]:·</span>825 <span·class="gh">Out[2]:·</span>
826 <span·class="go">3····3</span>826 <span·class="go">3····3</span>
827 <span·class="go">dtype:·int64</span>827 <span·class="go">Length:·1,·dtype:·int64</span>
  
828 <span·class="go">#·One·may·specify·either·a·number·of·rows:</span>828 <span·class="go">#·One·may·specify·either·a·number·of·rows:</span>
829 <span·class="gp">In·[3]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">)</span>829 <span·class="gp">In·[3]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">)</span>
830 <span·class="gh">Out[3]:·</span>830 <span·class="gh">Out[3]:·</span>
831 <span·class="go">2····2</span>831 <span·class="go">2····2</span>
832 <span·class="go">1····1</span>832 <span·class="go">1····1</span>
833 <span·class="go">0····0</span>833 <span·class="go">0····0</span>
834 <span·class="go">dtype:·int64</span>834 <span·class="go">Length:·3,·dtype:·int64</span>
  
835 <span·class="go">#·Or·a·fraction·of·the·rows:</span>835 <span·class="go">#·Or·a·fraction·of·the·rows:</span>
836 <span·class="gp">In·[4]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">frac</span><span·class="o">=</span><span·class="mf">0.5</span><span·class="p">)</span>836 <span·class="gp">In·[4]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">frac</span><span·class="o">=</span><span·class="mf">0.5</span><span·class="p">)</span>
837 <span·class="gh">Out[4]:·</span>837 <span·class="gh">Out[4]:·</span>
838 <span·class="go">1····1</span>838 <span·class="go">1····1</span>
839 <span·class="go">5····5</span>839 <span·class="go">5····5</span>
840 <span·class="go">3····3</span>840 <span·class="go">3····3</span>
841 <span·class="go">dtype:·int64</span>841 <span·class="go">Length:·3,·dtype:·int64</span>
  
842 <span·class="go">#·weights·are·accepted.</span>842 <span·class="go">#·weights·are·accepted.</span>
843 <span·class="gp">In·[5]:·</span><span·class="n">example_weights</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.4</span><span·class="p">]</span>843 <span·class="gp">In·[5]:·</span><span·class="n">example_weights</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.2</span><span·class="p">,</span>·<span·class="mf">0.4</span><span·class="p">]</span>
  
844 <span·class="gp">In·[6]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="n">example_weights</span><span·class="p">)</span>844 <span·class="gp">In·[6]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="n">example_weights</span><span·class="p">)</span>
845 <span·class="gh">Out[6]:·</span>845 <span·class="gh">Out[6]:·</span>
846 <span·class="go">2····2</span>846 <span·class="go">2····2</span>
847 <span·class="go">4····4</span>847 <span·class="go">4····4</span>
848 <span·class="go">3····3</span>848 <span·class="go">3····3</span>
849 <span·class="go">dtype:·int64</span>849 <span·class="go">Length:·3,·dtype:·int64</span>
  
850 <span·class="go">#·weights·will·also·be·normalized·if·they·do·not·sum·to·one,</span>850 <span·class="go">#·weights·will·also·be·normalized·if·they·do·not·sum·to·one,</span>
851 <span·class="go">#·and·missing·values·will·be·treated·as·zeros.</span>851 <span·class="go">#·and·missing·values·will·be·treated·as·zeros.</span>
852 <span·class="gp">In·[7]:·</span><span·class="n">example_weights2</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="mf">0.5</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="kc">None</span><span·class="p">,</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">nan</span><span·class="p">]</span>852 <span·class="gp">In·[7]:·</span><span·class="n">example_weights2</span>·<span·class="o">=</span>·<span·class="p">[</span><span·class="mf">0.5</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">,</span>·<span·class="kc">None</span><span·class="p">,</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">nan</span><span·class="p">]</span>
  
853 <span·class="gp">In·[8]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="n">example_weights2</span><span·class="p">)</span>853 <span·class="gp">In·[8]:·</span><span·class="n">example_series</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="n">example_weights2</span><span·class="p">)</span>
854 <span·class="gh">Out[8]:·</span>854 <span·class="gh">Out[8]:·</span>
855 <span·class="go">0····0</span>855 <span·class="go">0····0</span>
856 <span·class="go">dtype:·int64</span>856 <span·class="go">Length:·1,·dtype:·int64</span>
857 </pre></div>857 </pre></div>
858 </div>858 </div>
859 <p>When·applied·to·a·DataFrame,·one·may·pass·the·name·of·a·column·to·specify·sampling·weights859 <p>When·applied·to·a·DataFrame,·one·may·pass·the·name·of·a·column·to·specify·sampling·weights
860 when·sampling·from·rows.</p>860 when·sampling·from·rows.</p>
861 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[9]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">({</span><span·class="s2">&quot;col1&quot;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mi">9</span><span·class="p">,</span>·<span·class="mi">8</span><span·class="p">,</span>·<span·class="mi">7</span><span·class="p">,</span>·<span·class="mi">6</span><span·class="p">],</span>·<span·class="s2">&quot;weight_column&quot;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mf">0.5</span><span·class="p">,</span>·<span·class="mf">0.4</span><span·class="p">,</span>·<span·class="mf">0.1</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">]})</span>861 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[9]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">({</span><span·class="s2">&quot;col1&quot;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mi">9</span><span·class="p">,</span>·<span·class="mi">8</span><span·class="p">,</span>·<span·class="mi">7</span><span·class="p">,</span>·<span·class="mi">6</span><span·class="p">],</span>·<span·class="s2">&quot;weight_column&quot;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mf">0.5</span><span·class="p">,</span>·<span·class="mf">0.4</span><span·class="p">,</span>·<span·class="mf">0.1</span><span·class="p">,</span>·<span·class="mi">0</span><span·class="p">]})</span>
  
862 <span·class="gp">In·[10]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="s2">&quot;weight_column&quot;</span><span·class="p">)</span>862 <span·class="gp">In·[10]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">sample</span><span·class="p">(</span><span·class="n">n</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">weights</span><span·class="o">=</span><span·class="s2">&quot;weight_column&quot;</span><span·class="p">)</span>
863 <span·class="gh">Out[10]:·</span>863 <span·class="gh">Out[10]:·</span>
864 <span·class="go">···col1··weight_column</span>864 <span·class="go">···col1··weight_column</span>
865 <span·class="go">0·····9············0.5</span>865 <span·class="go">0·····9············0.5</span>
866 <span·class="go">1·····8············0.4</span>866 <span·class="go">1·····8············0.4</span>
867 <span·class="go">2·····7············0.1</span>867 <span·class="go">2·····7············0.1</span>
  
 868 <span·class="go">[3·rows·x·2·columns]</span>
868 </pre></div>869 </pre></div>
869 </div>870 </div>
870 </section>871 </section>
871 <section·id="string-methods-enhancements">872 <section·id="string-methods-enhancements">
872 <span·id="whatsnew-0161-enhancements-string"></span><h3>String·methods·enhancements<a·class="headerlink"·href="#string-methods-enhancements"·title="Link·to·this·heading">#</a></h3>873 <span·id="whatsnew-0161-enhancements-string"></span><h3>String·methods·enhancements<a·class="headerlink"·href="#string-methods-enhancements"·title="Link·to·this·heading">#</a></h3>
873 <p><a·class="reference·internal"·href="v0.16.0.html#whatsnew-0160-enhancements-string"><span·class="std·std-ref">Continuing·from·v0.16.0</span></a>,·the·following874 <p><a·class="reference·internal"·href="v0.16.0.html#whatsnew-0160-enhancements-string"><span·class="std·std-ref">Continuing·from·v0.16.0</span></a>,·the·following
874 enhancements·make·string·operations·easier·and·more·consistent·with·standard·python·string·operations.</p>875 enhancements·make·string·operations·easier·and·more·consistent·with·standard·python·string·operations.</p>
Offset 898, 24 lines modifiedOffset 900, 24 lines modified
  
898 <span·class="gp">In·[15]:·</span><span·class="n">s</span>900 <span·class="gp">In·[15]:·</span><span·class="n">s</span>
899 <span·class="gh">Out[15]:·</span>901 <span·class="gh">Out[15]:·</span>
900 <span·class="go">a1····0</span>902 <span·class="go">a1····0</span>
901 <span·class="go">a2····1</span>903 <span·class="go">a2····1</span>
902 <span·class="go">b1····2</span>904 <span·class="go">b1····2</span>
903 <span·class="go">b2····3</span>905 <span·class="go">b2····3</span>
904 <span·class="go">dtype:·int64</span>906 <span·class="go">Length:·4,·dtype:·int64</span>
  
905 <span·class="gp">In·[16]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">startswith</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)</span>907 <span·class="gp">In·[16]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">startswith</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)</span>
906 <span·class="gh">Out[16]:·</span><span·class="go">array([·True,··True,·False,·False])</span>908 <span·class="gh">Out[16]:·</span><span·class="go">array([·True,··True,·False,·False])</span>
  
907 <span·class="gp">In·[17]:·</span><span·class="n">s</span><span·class="p">[</span><span·class="n">s</span><span·class="o">.</span><span·class="n">index</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">startswith</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)]</span>909 <span·class="gp">In·[17]:·</span><span·class="n">s</span><span·class="p">[</span><span·class="n">s</span><span·class="o">.</span><span·class="n">index</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">startswith</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)]</span>
908 <span·class="gh">Out[17]:·</span>910 <span·class="gh">Out[17]:·</span>
909 <span·class="go">a1····0</span>911 <span·class="go">a1····0</span>
910 <span·class="go">a2····1</span>912 <span·class="go">a2····1</span>
911 <span·class="go">dtype:·int64</span>913 <span·class="go">Length:·2,·dtype:·int64</span>
912 </pre></div>914 </pre></div>
913 </div>915 </div>
914 </li>916 </li>
915 <li><p>The·following·new·methods·are·accessible·via·<code·class="docutils·literal·notranslate"><span·class="pre">.str</span></code>·accessor·to·apply·the·function·to·each·values.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9766">GH·9766</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9773">GH·9773</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10031">GH·10031</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10045">GH·10045</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10052">GH·10052</a>)</p>917 <li><p>The·following·new·methods·are·accessible·via·<code·class="docutils·literal·notranslate"><span·class="pre">.str</span></code>·accessor·to·apply·the·function·to·each·values.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9766">GH·9766</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9773">GH·9773</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10031">GH·10031</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10045">GH·10045</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10052">GH·10052</a>)</p>
916 <div·class="pst-scrollable-table-container"><table·class="table">918 <div·class="pst-scrollable-table-container"><table·class="table">
917 <thead>919 <thead>
918 <tr·class="row-odd"><th·class="head"></th>920 <tr·class="row-odd"><th·class="head"></th>
Offset 947, 24 lines modifiedOffset 949, 26 lines modified
  
947 <span·class="go">#·return·Series</span>949 <span·class="go">#·return·Series</span>
948 <span·class="gp">In·[19]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">)</span>950 <span·class="gp">In·[19]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">)</span>
949 <span·class="gh">Out[19]:·</span>951 <span·class="gh">Out[19]:·</span>
950 <span·class="go">0····[a,·b]</span>952 <span·class="go">0····[a,·b]</span>
951 <span·class="go">1····[a,·c]</span>953 <span·class="go">1····[a,·c]</span>
952 <span·class="go">2····[b,·c]</span>954 <span·class="go">2····[b,·c]</span>
953 <span·class="go">dtype:·object</span>955 <span·class="go">Length:·3,·dtype:·object</span>
  
954 <span·class="go">#·return·DataFrame</span>956 <span·class="go">#·return·DataFrame</span>
955 <span·class="gp">In·[20]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span>957 <span·class="gp">In·[20]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span>
956 <span·class="gh">Out[20]:·</span>958 <span·class="gh">Out[20]:·</span>
957 <span·class="go">···0··1</span>959 <span·class="go">···0··1</span>
958 <span·class="go">0··a··b</span>960 <span·class="go">0··a··b</span>
959 <span·class="go">1··a··c</span>961 <span·class="go">1··a··c</span>
960 <span·class="go">2··b··c</span>962 <span·class="go">2··b··c</span>
  
 963 <span·class="go">[3·rows·x·2·columns]</span>
  
961 <span·class="gp">In·[21]:·</span><span·class="n">idx</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Index</span><span·class="p">([</span><span·class="s2">&quot;a,b&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;a,c&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;b,c&quot;</span><span·class="p">])</span>964 <span·class="gp">In·[21]:·</span><span·class="n">idx</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Index</span><span·class="p">([</span><span·class="s2">&quot;a,b&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;a,c&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;b,c&quot;</span><span·class="p">])</span>
  
962 <span·class="go">#·return·Index</span>965 <span·class="go">#·return·Index</span>
963 <span·class="gp">In·[22]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">)</span>966 <span·class="gp">In·[22]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">split</span><span·class="p">(</span><span·class="s2">&quot;,&quot;</span><span·class="p">)</span>
964 <span·class="gh">Out[22]:·</span><span·class="go">Index([[&#39;a&#39;,·&#39;b&#39;],·[&#39;a&#39;,·&#39;c&#39;],·[&#39;b&#39;,·&#39;c&#39;]],·dtype=&#39;object&#39;)</span>967 <span·class="gh">Out[22]:·</span><span·class="go">Index([[&#39;a&#39;,·&#39;b&#39;],·[&#39;a&#39;,·&#39;c&#39;],·[&#39;b&#39;,·&#39;c&#39;]],·dtype=&#39;object&#39;)</span>
  
965 <span·class="go">#·return·MultiIndex</span>968 <span·class="go">#·return·MultiIndex</span>
Offset 1003, 14 lines modifiedOffset 1007, 16 lines modified
  
1003 <span·class="gp">In·[28]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">drop</span><span·class="p">([</span><span·class="s2">&quot;A&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;X&quot;</span><span·class="p">],</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">errors</span><span·class="o">=</span><span·class="s2">&quot;ignore&quot;</span><span·class="p">)</span>1007 <span·class="gp">In·[28]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">drop</span><span·class="p">([</span><span·class="s2">&quot;A&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;X&quot;</span><span·class="p">],</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">errors</span><span·class="o">=</span><span·class="s2">&quot;ignore&quot;</span><span·class="p">)</span>
1004 <span·class="gh">Out[28]:·</span>1008 <span·class="gh">Out[28]:·</span>
1005 <span·class="go">··········B·········C</span>1009 <span·class="go">··········B·········C</span>
1006 <span·class="go">0·-0.706771·-1.039575</span>1010 <span·class="go">0·-0.706771·-1.039575</span>
1007 <span·class="go">1·-0.424972··0.567020</span>1011 <span·class="go">1·-0.424972··0.567020</span>
1008 <span·class="go">2·-1.087401·-0.673690</span>1012 <span·class="go">2·-1.087401·-0.673690</span>
  
 1013 <span·class="go">[3·rows·x·2·columns]</span>
1009 </pre></div>1014 </pre></div>
Max diff block lines reached; 1296/12861 bytes (10.08%) of diff not shown.
4.22 KB
html2text {}
    
Offset 267, 61 lines modifiedOffset 267, 63 lines modified
267 sampling,·and·for·setting·seed·values·to·facilitate·replication.·(_\x8G_\x8H_\x8·_\x82_\x84_\x81_\x89)267 sampling,·and·for·setting·seed·values·to·facilitate·replication.·(_\x8G_\x8H_\x8·_\x82_\x84_\x81_\x89)
268 In·[1]:·example_series·=·pd.Series([0,·1,·2,·3,·4,·5])268 In·[1]:·example_series·=·pd.Series([0,·1,·2,·3,·4,·5])
  
269 #·When·no·arguments·are·passed,·returns·1269 #·When·no·arguments·are·passed,·returns·1
270 In·[2]:·example_series.sample()270 In·[2]:·example_series.sample()
271 Out[2]:271 Out[2]:
272 3····3272 3····3
273 dtype:·int64273 Length:·1,·dtype:·int64
  
274 #·One·may·specify·either·a·number·of·rows:274 #·One·may·specify·either·a·number·of·rows:
275 In·[3]:·example_series.sample(n=3)275 In·[3]:·example_series.sample(n=3)
276 Out[3]:276 Out[3]:
277 2····2277 2····2
278 1····1278 1····1
279 0····0279 0····0
280 dtype:·int64280 Length:·3,·dtype:·int64
  
281 #·Or·a·fraction·of·the·rows:281 #·Or·a·fraction·of·the·rows:
282 In·[4]:·example_series.sample(frac=0.5)282 In·[4]:·example_series.sample(frac=0.5)
283 Out[4]:283 Out[4]:
284 1····1284 1····1
285 5····5285 5····5
286 3····3286 3····3
287 dtype:·int64287 Length:·3,·dtype:·int64
  
288 #·weights·are·accepted.288 #·weights·are·accepted.
289 In·[5]:·example_weights·=·[0,·0,·0.2,·0.2,·0.2,·0.4]289 In·[5]:·example_weights·=·[0,·0,·0.2,·0.2,·0.2,·0.4]
  
290 In·[6]:·example_series.sample(n=3,·weights=example_weights)290 In·[6]:·example_series.sample(n=3,·weights=example_weights)
291 Out[6]:291 Out[6]:
292 2····2292 2····2
293 4····4293 4····4
294 3····3294 3····3
295 dtype:·int64295 Length:·3,·dtype:·int64
  
296 #·weights·will·also·be·normalized·if·they·do·not·sum·to·one,296 #·weights·will·also·be·normalized·if·they·do·not·sum·to·one,
297 #·and·missing·values·will·be·treated·as·zeros.297 #·and·missing·values·will·be·treated·as·zeros.
298 In·[7]:·example_weights2·=·[0.5,·0,·0,·0,·None,·np.nan]298 In·[7]:·example_weights2·=·[0.5,·0,·0,·0,·None,·np.nan]
  
299 In·[8]:·example_series.sample(n=1,·weights=example_weights2)299 In·[8]:·example_series.sample(n=1,·weights=example_weights2)
300 Out[8]:300 Out[8]:
301 0····0301 0····0
302 dtype:·int64302 Length:·1,·dtype:·int64
303 When·applied·to·a·DataFrame,·one·may·pass·the·name·of·a·column·to·specify303 When·applied·to·a·DataFrame,·one·may·pass·the·name·of·a·column·to·specify
304 sampling·weights·when·sampling·from·rows.304 sampling·weights·when·sampling·from·rows.
305 In·[9]:·df·=·pd.DataFrame({"col1":·[9,·8,·7,·6],·"weight_column":·[0.5,·0.4,305 In·[9]:·df·=·pd.DataFrame({"col1":·[9,·8,·7,·6],·"weight_column":·[0.5,·0.4,
306 0.1,·0]})306 0.1,·0]})
  
307 In·[10]:·df.sample(n=3,·weights="weight_column")307 In·[10]:·df.sample(n=3,·weights="weight_column")
308 Out[10]:308 Out[10]:
309 ···col1··weight_column309 ···col1··weight_column
310 0·····9············0.5310 0·····9············0.5
311 1·····8············0.4311 1·····8············0.4
312 2·····7············0.1312 2·····7············0.1
  
 313 [3·rows·x·2·columns]
313 *\x8**\x8**\x8**\x8*·S\x8St\x8tr\x8ri\x8in\x8ng\x8g·m\x8me\x8et\x8th\x8ho\x8od\x8ds\x8s·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8ts\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*314 *\x8**\x8**\x8**\x8*·S\x8St\x8tr\x8ri\x8in\x8ng\x8g·m\x8me\x8et\x8th\x8ho\x8od\x8ds\x8s·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8ts\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*
314 _\x8C_\x8o_\x8n_\x8t_\x8i_\x8n_\x8u_\x8i_\x8n_\x8g_\x8·_\x8f_\x8r_\x8o_\x8m_\x8·_\x8v_\x80_\x8._\x81_\x86_\x8._\x80,·the·following·enhancements·make·string·operations315 _\x8C_\x8o_\x8n_\x8t_\x8i_\x8n_\x8u_\x8i_\x8n_\x8g_\x8·_\x8f_\x8r_\x8o_\x8m_\x8·_\x8v_\x80_\x8._\x81_\x86_\x8._\x80,·the·following·enhancements·make·string·operations
315 easier·and·more·consistent·with·standard·python·string·operations.316 easier·and·more·consistent·with·standard·python·string·operations.
316 ····*·Added·StringMethods·(.str·accessor)·to·Index·(_\x8G_\x8H_\x8·_\x89_\x80_\x86_\x88)317 ····*·Added·StringMethods·(.str·accessor)·to·Index·(_\x8G_\x8H_\x8·_\x89_\x80_\x86_\x88)
317 ······The·.str·accessor·is·now·available·for·both·Series·and·Index.318 ······The·.str·accessor·is·now·available·for·both·Series·and·Index.
318 ······In·[11]:·idx·=·pd.Index(["·jack",·"jill·",·"·jesse·",·"frank"])319 ······In·[11]:·idx·=·pd.Index(["·jack",·"jill·",·"·jesse·",·"frank"])
  
Offset 337, 24 lines modifiedOffset 339, 24 lines modified
  
337 ······In·[15]:·s339 ······In·[15]:·s
338 ······Out[15]:340 ······Out[15]:
339 ······a1····0341 ······a1····0
340 ······a2····1342 ······a2····1
341 ······b1····2343 ······b1····2
342 ······b2····3344 ······b2····3
343 ······dtype:·int64345 ······Length:·4,·dtype:·int64
  
344 ······In·[16]:·idx.str.startswith("a")346 ······In·[16]:·idx.str.startswith("a")
345 ······Out[16]:·array([·True,··True,·False,·False])347 ······Out[16]:·array([·True,··True,·False,·False])
  
346 ······In·[17]:·s[s.index.str.startswith("a")]348 ······In·[17]:·s[s.index.str.startswith("a")]
347 ······Out[17]:349 ······Out[17]:
348 ······a1····0350 ······a1····0
349 ······a2····1351 ······a2····1
350 ······dtype:·int64352 ······Length:·2,·dtype:·int64
351 ····*·The·following·new·methods·are·accessible·via·.str·accessor·to·apply·the353 ····*·The·following·new·methods·are·accessible·via·.str·accessor·to·apply·the
352 ······function·to·each·values.·(_\x8G_\x8H_\x8·_\x89_\x87_\x86_\x86,·_\x8G_\x8H_\x8·_\x89_\x87_\x87_\x83,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x83_\x81,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x84_\x85,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x85_\x82)354 ······function·to·each·values.·(_\x8G_\x8H_\x8·_\x89_\x87_\x86_\x86,·_\x8G_\x8H_\x8·_\x89_\x87_\x87_\x83,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x83_\x81,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x84_\x85,·_\x8G_\x8H_\x8·_\x81_\x80_\x80_\x85_\x82)
353 ······························M\x8Me\x8et\x8th\x8ho\x8od\x8ds\x8s355 ······························M\x8Me\x8et\x8th\x8ho\x8od\x8ds\x8s
354 ······capitalize()·swapcase()·normalize()·partition()·rpartition()356 ······capitalize()·swapcase()·normalize()·partition()·rpartition()
355 ······index()······rindex()···translate()357 ······index()······rindex()···translate()
356 ····*·split·now·takes·expand·keyword·to·specify·whether·to·expand358 ····*·split·now·takes·expand·keyword·to·specify·whether·to·expand
357 ······dimensionality.·return_type·is·deprecated.·(_\x8G_\x8H_\x8·_\x89_\x88_\x84_\x87)359 ······dimensionality.·return_type·is·deprecated.·(_\x8G_\x8H_\x8·_\x89_\x88_\x84_\x87)
Offset 362, 24 lines modifiedOffset 364, 26 lines modified
  
362 ······#·return·Series364 ······#·return·Series
363 ······In·[19]:·s.str.split(",")365 ······In·[19]:·s.str.split(",")
364 ······Out[19]:366 ······Out[19]:
365 ······0····[a,·b]367 ······0····[a,·b]
366 ······1····[a,·c]368 ······1····[a,·c]
367 ······2····[b,·c]369 ······2····[b,·c]
368 ······dtype:·object370 ······Length:·3,·dtype:·object
  
369 ······#·return·DataFrame371 ······#·return·DataFrame
370 ······In·[20]:·s.str.split(",",·expand=True)372 ······In·[20]:·s.str.split(",",·expand=True)
371 ······Out[20]:373 ······Out[20]:
372 ·········0··1374 ·········0··1
373 ······0··a··b375 ······0··a··b
374 ······1··a··c376 ······1··a··c
375 ······2··b··c377 ······2··b··c
  
 378 ······[3·rows·x·2·columns]
  
376 ······In·[21]:·idx·=·pd.Index(["a,b",·"a,c",·"b,c"])379 ······In·[21]:·idx·=·pd.Index(["a,b",·"a,c",·"b,c"])
  
377 ······#·return·Index380 ······#·return·Index
378 ······In·[22]:·idx.str.split(",")381 ······In·[22]:·idx.str.split(",")
379 ······Out[22]:·Index([['a',·'b'],·['a',·'c'],·['b',·'c']],·dtype='object')382 ······Out[22]:·Index([['a',·'b'],·['a',·'c'],·['b',·'c']],·dtype='object')
  
380 ······#·return·MultiIndex383 ······#·return·MultiIndex
Offset 420, 14 lines modifiedOffset 424, 16 lines modified
  
420 ······In·[28]:·df.drop(["A",·"X"],·axis=1,·errors="ignore")424 ······In·[28]:·df.drop(["A",·"X"],·axis=1,·errors="ignore")
421 ······Out[28]:425 ······Out[28]:
422 ················B·········C426 ················B·········C
423 ······0·-0.706771·-1.039575427 ······0·-0.706771·-1.039575
424 ······1·-0.424972··0.567020428 ······1·-0.424972··0.567020
425 ······2·-1.087401·-0.673690429 ······2·-1.087401·-0.673690
  
 430 ······[3·rows·x·2·columns]
426 ····*·Add·support·for·separating·years·and·quarters·using·dashes,·for·example431 ····*·Add·support·for·separating·years·and·quarters·using·dashes,·for·example
427 ······2014-Q1.·(_\x8G_\x8H_\x8·_\x89_\x86_\x88_\x88)432 ······2014-Q1.·(_\x8G_\x8H_\x8·_\x89_\x86_\x88_\x88)
Max diff block lines reached; 291/4300 bytes (6.77%) of diff not shown.
53.9 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.0.html
    
Offset 769, 35 lines modifiedOffset 769, 37 lines modified
769 <span·class="gp">In·[2]:·</span><span·class="n">df</span>769 <span·class="gp">In·[2]:·</span><span·class="n">df</span>
770 <span·class="gh">Out[2]:·</span>770 <span·class="gh">Out[2]:·</span>
771 <span·class="go">···········A·························B·························C</span>771 <span·class="go">···········A·························B·························C</span>
772 <span·class="go">0·2013-01-01·2013-01-01·00:00:00-05:00·2013-01-01·00:00:00+01:00</span>772 <span·class="go">0·2013-01-01·2013-01-01·00:00:00-05:00·2013-01-01·00:00:00+01:00</span>
773 <span·class="go">1·2013-01-02·2013-01-02·00:00:00-05:00·2013-01-02·00:00:00+01:00</span>773 <span·class="go">1·2013-01-02·2013-01-02·00:00:00-05:00·2013-01-02·00:00:00+01:00</span>
774 <span·class="go">2·2013-01-03·2013-01-03·00:00:00-05:00·2013-01-03·00:00:00+01:00</span>774 <span·class="go">2·2013-01-03·2013-01-03·00:00:00-05:00·2013-01-03·00:00:00+01:00</span>
  
 775 <span·class="go">[3·rows·x·3·columns]</span>
  
775 <span·class="gp">In·[3]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">dtypes</span>776 <span·class="gp">In·[3]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">dtypes</span>
776 <span·class="gh">Out[3]:·</span>777 <span·class="gh">Out[3]:·</span>
777 <span·class="go">A················datetime64[ns]</span>778 <span·class="go">A················datetime64[ns]</span>
778 <span·class="go">B····datetime64[ns,·US/Eastern]</span>779 <span·class="go">B····datetime64[ns,·US/Eastern]</span>
779 <span·class="go">C···········datetime64[ns,·CET]</span>780 <span·class="go">C···········datetime64[ns,·CET]</span>
780 <span·class="go">dtype:·object</span>781 <span·class="go">Length:·3,·dtype:·object</span>
781 </pre></div>782 </pre></div>
782 </div>783 </div>
783 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">B</span>784 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">B</span>
784 <span·class="gh">Out[4]:·</span>785 <span·class="gh">Out[4]:·</span>
785 <span·class="go">0···2013-01-01·00:00:00-05:00</span>786 <span·class="go">0···2013-01-01·00:00:00-05:00</span>
786 <span·class="go">1···2013-01-02·00:00:00-05:00</span>787 <span·class="go">1···2013-01-02·00:00:00-05:00</span>
787 <span·class="go">2···2013-01-03·00:00:00-05:00</span>788 <span·class="go">2···2013-01-03·00:00:00-05:00</span>
788 <span·class="go">Name:·B,·dtype:·datetime64[ns,·US/Eastern]</span>789 <span·class="go">Name:·B,·Length:·3,·dtype:·datetime64[ns,·US/Eastern]</span>
  
789 <span·class="gp">In·[5]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">B</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">tz_localize</span><span·class="p">(</span><span·class="kc">None</span><span·class="p">)</span>790 <span·class="gp">In·[5]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">B</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">tz_localize</span><span·class="p">(</span><span·class="kc">None</span><span·class="p">)</span>
790 <span·class="gh">Out[5]:·</span>791 <span·class="gh">Out[5]:·</span>
791 <span·class="go">0···2013-01-01</span>792 <span·class="go">0···2013-01-01</span>
792 <span·class="go">1···2013-01-02</span>793 <span·class="go">1···2013-01-02</span>
793 <span·class="go">2···2013-01-03</span>794 <span·class="go">2···2013-01-03</span>
794 <span·class="go">Name:·B,·dtype:·datetime64[ns]</span>795 <span·class="go">Name:·B,·Length:·3,·dtype:·datetime64[ns]</span>
795 </pre></div>796 </pre></div>
796 </div>797 </div>
797 <p>This·uses·a·new-dtype·representation·as·well,·that·is·very·similar·in·look-and-feel·to·its·numpy·cousin·<code·class="docutils·literal·notranslate"><span·class="pre">datetime64[ns]</span></code></p>798 <p>This·uses·a·new-dtype·representation·as·well,·that·is·very·similar·in·look-and-feel·to·its·numpy·cousin·<code·class="docutils·literal·notranslate"><span·class="pre">datetime64[ns]</span></code></p>
798 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[6]:·</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;B&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">dtype</span>799 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[6]:·</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;B&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">dtype</span>
799 <span·class="gh">Out[6]:·</span><span·class="go">datetime64[ns,·US/Eastern]</span>800 <span·class="gh">Out[6]:·</span><span·class="go">datetime64[ns,·US/Eastern]</span>
  
800 <span·class="gp">In·[7]:·</span><span·class="nb">type</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;B&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">dtype</span><span·class="p">)</span>801 <span·class="gp">In·[7]:·</span><span·class="nb">type</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[</span><span·class="s2">&quot;B&quot;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">dtype</span><span·class="p">)</span>
Offset 876, 43 lines modifiedOffset 878, 43 lines modified
  
876 <span·class="gp">In·[14]:·</span><span·class="n">s</span>878 <span·class="gp">In·[14]:·</span><span·class="n">s</span>
877 <span·class="gh">Out[14]:·</span>879 <span·class="gh">Out[14]:·</span>
878 <span·class="go">0···2013-01-01</span>880 <span·class="go">0···2013-01-01</span>
879 <span·class="go">1···2013-01-02</span>881 <span·class="go">1···2013-01-02</span>
880 <span·class="go">2···2013-01-03</span>882 <span·class="go">2···2013-01-03</span>
881 <span·class="go">3···2013-01-04</span>883 <span·class="go">3···2013-01-04</span>
882 <span·class="go">dtype:·datetime64[ns]</span>884 <span·class="go">Length:·4,·dtype:·datetime64[ns]</span>
  
883 <span·class="gp">In·[15]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">strftime</span><span·class="p">(</span><span·class="s2">&quot;%Y/%m/</span><span·class="si">%d</span><span·class="s2">&quot;</span><span·class="p">)</span>885 <span·class="gp">In·[15]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">strftime</span><span·class="p">(</span><span·class="s2">&quot;%Y/%m/</span><span·class="si">%d</span><span·class="s2">&quot;</span><span·class="p">)</span>
884 <span·class="gh">Out[15]:·</span>886 <span·class="gh">Out[15]:·</span>
885 <span·class="go">0····2013/01/01</span>887 <span·class="go">0····2013/01/01</span>
886 <span·class="go">1····2013/01/02</span>888 <span·class="go">1····2013/01/02</span>
887 <span·class="go">2····2013/01/03</span>889 <span·class="go">2····2013/01/03</span>
888 <span·class="go">3····2013/01/04</span>890 <span·class="go">3····2013/01/04</span>
889 <span·class="go">dtype:·object</span>891 <span·class="go">Length:·4,·dtype:·object</span>
890 </pre></div>892 </pre></div>
891 </div>893 </div>
892 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·PeriodIndex</span>894 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·PeriodIndex</span>
893 <span·class="gp">In·[16]:·</span><span·class="n">s</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">period_range</span><span·class="p">(</span><span·class="s2">&quot;20130101&quot;</span><span·class="p">,</span>·<span·class="n">periods</span><span·class="o">=</span><span·class="mi">4</span><span·class="p">))</span>895 <span·class="gp">In·[16]:·</span><span·class="n">s</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">period_range</span><span·class="p">(</span><span·class="s2">&quot;20130101&quot;</span><span·class="p">,</span>·<span·class="n">periods</span><span·class="o">=</span><span·class="mi">4</span><span·class="p">))</span>
  
894 <span·class="gp">In·[17]:·</span><span·class="n">s</span>896 <span·class="gp">In·[17]:·</span><span·class="n">s</span>
895 <span·class="gh">Out[17]:·</span>897 <span·class="gh">Out[17]:·</span>
896 <span·class="go">0····2013-01-01</span>898 <span·class="go">0····2013-01-01</span>
897 <span·class="go">1····2013-01-02</span>899 <span·class="go">1····2013-01-02</span>
898 <span·class="go">2····2013-01-03</span>900 <span·class="go">2····2013-01-03</span>
899 <span·class="go">3····2013-01-04</span>901 <span·class="go">3····2013-01-04</span>
900 <span·class="go">dtype:·period[D]</span>902 <span·class="go">Length:·4,·dtype:·period[D]</span>
  
901 <span·class="gp">In·[18]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">strftime</span><span·class="p">(</span><span·class="s2">&quot;%Y/%m/</span><span·class="si">%d</span><span·class="s2">&quot;</span><span·class="p">)</span>903 <span·class="gp">In·[18]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">strftime</span><span·class="p">(</span><span·class="s2">&quot;%Y/%m/</span><span·class="si">%d</span><span·class="s2">&quot;</span><span·class="p">)</span>
902 <span·class="gh">Out[18]:·</span>904 <span·class="gh">Out[18]:·</span>
903 <span·class="go">0····2013/01/01</span>905 <span·class="go">0····2013/01/01</span>
904 <span·class="go">1····2013/01/02</span>906 <span·class="go">1····2013/01/02</span>
905 <span·class="go">2····2013/01/03</span>907 <span·class="go">2····2013/01/03</span>
906 <span·class="go">3····2013/01/04</span>908 <span·class="go">3····2013/01/04</span>
907 <span·class="go">dtype:·object</span>909 <span·class="go">Length:·4,·dtype:·object</span>
908 </pre></div>910 </pre></div>
909 </div>911 </div>
910 <p>The·string·format·is·as·the·python·standard·library·and·details·can·be·found·<a·class="reference·external"·href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior">here</a></p>912 <p>The·string·format·is·as·the·python·standard·library·and·details·can·be·found·<a·class="reference·external"·href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior">here</a></p>
911 </section>913 </section>
912 <section·id="series-dt-total-seconds">914 <section·id="series-dt-total-seconds">
913 <h4>Series.dt.total_seconds<a·class="headerlink"·href="#series-dt-total-seconds"·title="Link·to·this·heading">#</a></h4>915 <h4>Series.dt.total_seconds<a·class="headerlink"·href="#series-dt-total-seconds"·title="Link·to·this·heading">#</a></h4>
914 <p><code·class="docutils·literal·notranslate"><span·class="pre">pd.Series</span></code>·of·type·<code·class="docutils·literal·notranslate"><span·class="pre">timedelta64</span></code>·has·new·method·<code·class="docutils·literal·notranslate"><span·class="pre">.dt.total_seconds()</span></code>·returning·the·duration·of·the·timedelta·in·seconds·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10817">GH·10817</a>)</p>916 <p><code·class="docutils·literal·notranslate"><span·class="pre">pd.Series</span></code>·of·type·<code·class="docutils·literal·notranslate"><span·class="pre">timedelta64</span></code>·has·new·method·<code·class="docutils·literal·notranslate"><span·class="pre">.dt.total_seconds()</span></code>·returning·the·duration·of·the·timedelta·in·seconds·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/10817">GH·10817</a>)</p>
Offset 921, 23 lines modifiedOffset 923, 23 lines modified
  
921 <span·class="gp">In·[20]:·</span><span·class="n">s</span>923 <span·class="gp">In·[20]:·</span><span·class="n">s</span>
922 <span·class="gh">Out[20]:·</span>924 <span·class="gh">Out[20]:·</span>
923 <span·class="go">0···0·days·00:01:00</span>925 <span·class="go">0···0·days·00:01:00</span>
924 <span·class="go">1···1·days·00:01:00</span>926 <span·class="go">1···1·days·00:01:00</span>
925 <span·class="go">2···2·days·00:01:00</span>927 <span·class="go">2···2·days·00:01:00</span>
926 <span·class="go">3···3·days·00:01:00</span>928 <span·class="go">3···3·days·00:01:00</span>
927 <span·class="go">dtype:·timedelta64[ns]</span>929 <span·class="go">Length:·4,·dtype:·timedelta64[ns]</span>
  
928 <span·class="gp">In·[21]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">total_seconds</span><span·class="p">()</span>930 <span·class="gp">In·[21]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">total_seconds</span><span·class="p">()</span>
929 <span·class="gh">Out[21]:·</span>931 <span·class="gh">Out[21]:·</span>
930 <span·class="go">0········60.0</span>932 <span·class="go">0········60.0</span>
931 <span·class="go">1·····86460.0</span>933 <span·class="go">1·····86460.0</span>
932 <span·class="go">2····172860.0</span>934 <span·class="go">2····172860.0</span>
933 <span·class="go">3····259260.0</span>935 <span·class="go">3····259260.0</span>
934 <span·class="go">dtype:·float64</span>936 <span·class="go">Length:·4,·dtype:·float64</span>
935 </pre></div>937 </pre></div>
936 </div>938 </div>
937 </section>939 </section>
938 </section>940 </section>
939 <section·id="period-frequency-enhancement">941 <section·id="period-frequency-enhancement">
940 <span·id="whatsnew-0170-periodfreq"></span><h3>Period·frequency·enhancement<a·class="headerlink"·href="#period-frequency-enhancement"·title="Link·to·this·heading">#</a></h3>942 <span·id="whatsnew-0170-periodfreq"></span><h3>Period·frequency·enhancement<a·class="headerlink"·href="#period-frequency-enhancement"·title="Link·to·this·heading">#</a></h3>
941 <p><code·class="docutils·literal·notranslate"><span·class="pre">Period</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">period_range</span></code>·can·now·accept·multiplied·freq.·Also,·<code·class="docutils·literal·notranslate"><span·class="pre">Period.freq</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex.freq</span></code>·are·now·stored·as·a·<code·class="docutils·literal·notranslate"><span·class="pre">DateOffset</span></code>·instance·like·<code·class="docutils·literal·notranslate"><span·class="pre">DatetimeIndex</span></code>,·and·not·as·<code·class="docutils·literal·notranslate"><span·class="pre">str</span></code>·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/7811">GH·7811</a>)</p>943 <p><code·class="docutils·literal·notranslate"><span·class="pre">Period</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">period_range</span></code>·can·now·accept·multiplied·freq.·Also,·<code·class="docutils·literal·notranslate"><span·class="pre">Period.freq</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">PeriodIndex.freq</span></code>·are·now·stored·as·a·<code·class="docutils·literal·notranslate"><span·class="pre">DateOffset</span></code>·instance·like·<code·class="docutils·literal·notranslate"><span·class="pre">DatetimeIndex</span></code>,·and·not·as·<code·class="docutils·literal·notranslate"><span·class="pre">str</span></code>·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/7811">GH·7811</a>)</p>
Offset 1018, 25 lines modifiedOffset 1020, 29 lines modified
1018 <span·class="gh">Out[32]:·</span>1020 <span·class="gh">Out[32]:·</span>
1019 <span·class="go">col1··foo····bar···</span>1021 <span·class="go">col1··foo····bar···</span>
1020 <span·class="go">col2····a··b···a··b</span>1022 <span·class="go">col2····a··b···a··b</span>
1021 <span·class="go">i1·i2··············</span>1023 <span·class="go">i1·i2··············</span>
1022 <span·class="go">j··l····1··2···3··4</span>1024 <span·class="go">j··l····1··2···3··4</span>
1023 <span·class="go">···k····5··6···7··8</span>1025 <span·class="go">···k····5··6···7··8</span>
  
 1026 <span·class="go">[2·rows·x·4·columns]</span>
  
1024 <span·class="gp">In·[33]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">to_excel</span><span·class="p">(</span><span·class="s2">&quot;test.xlsx&quot;</span><span·class="p">)</span>1027 <span·class="gp">In·[33]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">to_excel</span><span·class="p">(</span><span·class="s2">&quot;test.xlsx&quot;</span><span·class="p">)</span>
  
1025 <span·class="gp">In·[34]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_excel</span><span·class="p">(</span><span·class="s2">&quot;test.xlsx&quot;</span><span·class="p">,</span>·<span·class="n">header</span><span·class="o">=</span><span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">],</span>·<span·class="n">index_col</span><span·class="o">=</span><span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">])</span>1028 <span·class="gp">In·[34]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_excel</span><span·class="p">(</span><span·class="s2">&quot;test.xlsx&quot;</span><span·class="p">,</span>·<span·class="n">header</span><span·class="o">=</span><span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">],</span>·<span·class="n">index_col</span><span·class="o">=</span><span·class="p">[</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">1</span><span·class="p">])</span>
  
1026 <span·class="gp">In·[35]:·</span><span·class="n">df</span>1029 <span·class="gp">In·[35]:·</span><span·class="n">df</span>
1027 <span·class="gh">Out[35]:·</span>1030 <span·class="gh">Out[35]:·</span>
1028 <span·class="go">col1··foo····bar···</span>1031 <span·class="go">col1··foo····bar···</span>
1029 <span·class="go">col2····a··b···a··b</span>1032 <span·class="go">col2····a··b···a··b</span>
1030 <span·class="go">i1·i2··············</span>1033 <span·class="go">i1·i2··············</span>
1031 <span·class="go">j··l····1··2···3··4</span>1034 <span·class="go">j··l····1··2···3··4</span>
1032 <span·class="go">···k····5··6···7··8</span>1035 <span·class="go">···k····5··6···7··8</span>
  
Max diff block lines reached; 30698/40628 bytes (75.56%) of diff not shown.
14.1 KB
html2text {}
    
Offset 222, 33 lines modifiedOffset 222, 35 lines modified
222 In·[2]:·df222 In·[2]:·df
223 Out[2]:223 Out[2]:
224 ···········A·························B·························C224 ···········A·························B·························C
225 0·2013-01-01·2013-01-01·00:00:00-05:00·2013-01-01·00:00:00+01:00225 0·2013-01-01·2013-01-01·00:00:00-05:00·2013-01-01·00:00:00+01:00
226 1·2013-01-02·2013-01-02·00:00:00-05:00·2013-01-02·00:00:00+01:00226 1·2013-01-02·2013-01-02·00:00:00-05:00·2013-01-02·00:00:00+01:00
227 2·2013-01-03·2013-01-03·00:00:00-05:00·2013-01-03·00:00:00+01:00227 2·2013-01-03·2013-01-03·00:00:00-05:00·2013-01-03·00:00:00+01:00
  
 228 [3·rows·x·3·columns]
  
228 In·[3]:·df.dtypes229 In·[3]:·df.dtypes
229 Out[3]:230 Out[3]:
230 A················datetime64[ns]231 A················datetime64[ns]
231 B····datetime64[ns,·US/Eastern]232 B····datetime64[ns,·US/Eastern]
232 C···········datetime64[ns,·CET]233 C···········datetime64[ns,·CET]
233 dtype:·object234 Length:·3,·dtype:·object
234 In·[4]:·df.B235 In·[4]:·df.B
235 Out[4]:236 Out[4]:
236 0···2013-01-01·00:00:00-05:00237 0···2013-01-01·00:00:00-05:00
237 1···2013-01-02·00:00:00-05:00238 1···2013-01-02·00:00:00-05:00
238 2···2013-01-03·00:00:00-05:00239 2···2013-01-03·00:00:00-05:00
239 Name:·B,·dtype:·datetime64[ns,·US/Eastern]240 Name:·B,·Length:·3,·dtype:·datetime64[ns,·US/Eastern]
  
240 In·[5]:·df.B.dt.tz_localize(None)241 In·[5]:·df.B.dt.tz_localize(None)
241 Out[5]:242 Out[5]:
242 0···2013-01-01243 0···2013-01-01
243 1···2013-01-02244 1···2013-01-02
244 2···2013-01-03245 2···2013-01-03
245 Name:·B,·dtype:·datetime64[ns]246 Name:·B,·Length:·3,·dtype:·datetime64[ns]
246 This·uses·a·new-dtype·representation·as·well,·that·is·very·similar·in·look-and-247 This·uses·a·new-dtype·representation·as·well,·that·is·very·similar·in·look-and-
247 feel·to·its·numpy·cousin·datetime64[ns]248 feel·to·its·numpy·cousin·datetime64[ns]
248 In·[6]:·df["B"].dtype249 In·[6]:·df["B"].dtype
249 Out[6]:·datetime64[ns,·US/Eastern]250 Out[6]:·datetime64[ns,·US/Eastern]
  
250 In·[7]:·type(df["B"].dtype)251 In·[7]:·type(df["B"].dtype)
251 Out[7]:·pandas.core.dtypes.dtypes.DatetimeTZDtype252 Out[7]:·pandas.core.dtypes.dtypes.DatetimeTZDtype
Offset 324, 64 lines modifiedOffset 326, 64 lines modified
  
324 In·[14]:·s326 In·[14]:·s
325 Out[14]:327 Out[14]:
326 0···2013-01-01328 0···2013-01-01
327 1···2013-01-02329 1···2013-01-02
328 2···2013-01-03330 2···2013-01-03
329 3···2013-01-04331 3···2013-01-04
330 dtype:·datetime64[ns]332 Length:·4,·dtype:·datetime64[ns]
  
331 In·[15]:·s.dt.strftime("%Y/%m/%d")333 In·[15]:·s.dt.strftime("%Y/%m/%d")
332 Out[15]:334 Out[15]:
333 0····2013/01/01335 0····2013/01/01
334 1····2013/01/02336 1····2013/01/02
335 2····2013/01/03337 2····2013/01/03
336 3····2013/01/04338 3····2013/01/04
337 dtype:·object339 Length:·4,·dtype:·object
338 #·PeriodIndex340 #·PeriodIndex
339 In·[16]:·s·=·pd.Series(pd.period_range("20130101",·periods=4))341 In·[16]:·s·=·pd.Series(pd.period_range("20130101",·periods=4))
  
340 In·[17]:·s342 In·[17]:·s
341 Out[17]:343 Out[17]:
342 0····2013-01-01344 0····2013-01-01
343 1····2013-01-02345 1····2013-01-02
344 2····2013-01-03346 2····2013-01-03
345 3····2013-01-04347 3····2013-01-04
346 dtype:·period[D]348 Length:·4,·dtype:·period[D]
  
347 In·[18]:·s.dt.strftime("%Y/%m/%d")349 In·[18]:·s.dt.strftime("%Y/%m/%d")
348 Out[18]:350 Out[18]:
349 0····2013/01/01351 0····2013/01/01
350 1····2013/01/02352 1····2013/01/02
351 2····2013/01/03353 2····2013/01/03
352 3····2013/01/04354 3····2013/01/04
353 dtype:·object355 Length:·4,·dtype:·object
354 The·string·format·is·as·the·python·standard·library·and·details·can·be·found356 The·string·format·is·as·the·python·standard·library·and·details·can·be·found
355 _\x8h_\x8e_\x8r_\x8e357 _\x8h_\x8e_\x8r_\x8e
356 *\x8**\x8**\x8*·S\x8Se\x8er\x8ri\x8ie\x8es\x8s.\x8.d\x8dt\x8t.\x8.t\x8to\x8ot\x8ta\x8al\x8l_\x8_s\x8se\x8ec\x8co\x8on\x8nd\x8ds\x8s_\x8#\x8#·*\x8**\x8**\x8*358 *\x8**\x8**\x8*·S\x8Se\x8er\x8ri\x8ie\x8es\x8s.\x8.d\x8dt\x8t.\x8.t\x8to\x8ot\x8ta\x8al\x8l_\x8_s\x8se\x8ec\x8co\x8on\x8nd\x8ds\x8s_\x8#\x8#·*\x8**\x8**\x8*
357 pd.Series·of·type·timedelta64·has·new·method·.dt.total_seconds()·returning·the359 pd.Series·of·type·timedelta64·has·new·method·.dt.total_seconds()·returning·the
358 duration·of·the·timedelta·in·seconds·(_\x8G_\x8H_\x8·_\x81_\x80_\x88_\x81_\x87)360 duration·of·the·timedelta·in·seconds·(_\x8G_\x8H_\x8·_\x81_\x80_\x88_\x81_\x87)
359 #·TimedeltaIndex361 #·TimedeltaIndex
360 In·[19]:·s·=·pd.Series(pd.timedelta_range("1·minutes",·periods=4))362 In·[19]:·s·=·pd.Series(pd.timedelta_range("1·minutes",·periods=4))
  
361 In·[20]:·s363 In·[20]:·s
362 Out[20]:364 Out[20]:
363 0···0·days·00:01:00365 0···0·days·00:01:00
364 1···1·days·00:01:00366 1···1·days·00:01:00
365 2···2·days·00:01:00367 2···2·days·00:01:00
366 3···3·days·00:01:00368 3···3·days·00:01:00
367 dtype:·timedelta64[ns]369 Length:·4,·dtype:·timedelta64[ns]
  
368 In·[21]:·s.dt.total_seconds()370 In·[21]:·s.dt.total_seconds()
369 Out[21]:371 Out[21]:
370 0········60.0372 0········60.0
371 1·····86460.0373 1·····86460.0
372 2····172860.0374 2····172860.0
373 3····259260.0375 3····259260.0
374 dtype:·float64376 Length:·4,·dtype:·float64
375 *\x8**\x8**\x8**\x8*·P\x8Pe\x8er\x8ri\x8io\x8od\x8d·f\x8fr\x8re\x8eq\x8qu\x8ue\x8en\x8nc\x8cy\x8y·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8t_\x8#\x8#·*\x8**\x8**\x8**\x8*377 *\x8**\x8**\x8**\x8*·P\x8Pe\x8er\x8ri\x8io\x8od\x8d·f\x8fr\x8re\x8eq\x8qu\x8ue\x8en\x8nc\x8cy\x8y·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8t_\x8#\x8#·*\x8**\x8**\x8**\x8*
376 Period,·PeriodIndex·and·period_range·can·now·accept·multiplied·freq.·Also,378 Period,·PeriodIndex·and·period_range·can·now·accept·multiplied·freq.·Also,
377 Period.freq·and·PeriodIndex.freq·are·now·stored·as·a·DateOffset·instance·like379 Period.freq·and·PeriodIndex.freq·are·now·stored·as·a·DateOffset·instance·like
378 DatetimeIndex,·and·not·as·str·(_\x8G_\x8H_\x8·_\x87_\x88_\x81_\x81)380 DatetimeIndex,·and·not·as·str·(_\x8G_\x8H_\x8·_\x87_\x88_\x81_\x81)
379 A·multiplied·freq·represents·a·span·of·corresponding·length.·The·example·below381 A·multiplied·freq·represents·a·span·of·corresponding·length.·The·example·below
380 creates·a·period·of·3·days.·Addition·and·subtraction·will·shift·the·period·by382 creates·a·period·of·3·days.·Addition·and·subtraction·will·shift·the·period·by
381 its·span.383 its·span.
Offset 447, 25 lines modifiedOffset 449, 29 lines modified
447 Out[32]:449 Out[32]:
448 col1··foo····bar450 col1··foo····bar
449 col2····a··b···a··b451 col2····a··b···a··b
450 i1·i2452 i1·i2
451 j··l····1··2···3··4453 j··l····1··2···3··4
452 ···k····5··6···7··8454 ···k····5··6···7··8
  
 455 [2·rows·x·4·columns]
  
453 In·[33]:·df.to_excel("test.xlsx")456 In·[33]:·df.to_excel("test.xlsx")
  
454 In·[34]:·df·=·pd.read_excel("test.xlsx",·header=[0,·1],·index_col=[0,·1])457 In·[34]:·df·=·pd.read_excel("test.xlsx",·header=[0,·1],·index_col=[0,·1])
  
455 In·[35]:·df458 In·[35]:·df
456 Out[35]:459 Out[35]:
457 col1··foo····bar460 col1··foo····bar
458 col2····a··b···a··b461 col2····a··b···a··b
459 i1·i2462 i1·i2
460 j··l····1··2···3··4463 j··l····1··2···3··4
461 ···k····5··6···7··8464 ···k····5··6···7··8
  
 465 [2·rows·x·4·columns]
462 Previously,·it·was·necessary·to·specify·the·has_index_names·argument·in466 Previously,·it·was·necessary·to·specify·the·has_index_names·argument·in
463 read_excel,·if·the·serialized·data·had·index·names.·For·version·0.17.0·the467 read_excel,·if·the·serialized·data·had·index·names.·For·version·0.17.0·the
464 output·format·of·to_excel·has·been·changed·to·make·this·keyword·unnecessary·-468 output·format·of·to_excel·has·been·changed·to·make·this·keyword·unnecessary·-
465 the·change·is·shown·below.469 the·change·is·shown·below.
Max diff block lines reached; 10710/14444 bytes (74.15%) of diff not shown.
5.16 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.17.1.html
    
Offset 1642, 45 lines modifiedOffset 1642, 45 lines modified
  
1642 <span·class="gp">In·[10]:·</span><span·class="n">s</span>1642 <span·class="gp">In·[10]:·</span><span·class="n">s</span>
1643 <span·class="gh">Out[10]:·</span>1643 <span·class="gh">Out[10]:·</span>
1644 <span·class="go">0····a</span>1644 <span·class="go">0····a</span>
1645 <span·class="go">1····a</span>1645 <span·class="go">1····a</span>
1646 <span·class="go">2····b</span>1646 <span·class="go">2····b</span>
1647 <span·class="go">3····b</span>1647 <span·class="go">3····b</span>
1648 <span·class="go">dtype:·category</span>1648 <span·class="go">Length:·4,·dtype:·category</span>
1649 <span·class="go">Categories·(2,·object):·[&#39;a&#39;,·&#39;b&#39;]</span>1649 <span·class="go">Categories·(2,·object):·[&#39;a&#39;,·&#39;b&#39;]</span>
  
1650 <span·class="gp">In·[11]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">contains</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)</span>1650 <span·class="gp">In·[11]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">contains</span><span·class="p">(</span><span·class="s2">&quot;a&quot;</span><span·class="p">)</span>
1651 <span·class="gh">Out[11]:·</span>1651 <span·class="gh">Out[11]:·</span>
1652 <span·class="go">0·····True</span>1652 <span·class="go">0·····True</span>
1653 <span·class="go">1·····True</span>1653 <span·class="go">1·····True</span>
1654 <span·class="go">2····False</span>1654 <span·class="go">2····False</span>
1655 <span·class="go">3····False</span>1655 <span·class="go">3····False</span>
1656 <span·class="go">dtype:·bool</span>1656 <span·class="go">Length:·4,·dtype:·bool</span>
  
1657 <span·class="gp">In·[12]:·</span><span·class="n">date</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">date_range</span><span·class="p">(</span><span·class="s2">&quot;1/1/2015&quot;</span><span·class="p">,</span>·<span·class="n">periods</span><span·class="o">=</span><span·class="mi">5</span><span·class="p">))</span><span·class="o">.</span><span·class="n">astype</span><span·class="p">(</span><span·class="s2">&quot;category&quot;</span><span·class="p">)</span>1657 <span·class="gp">In·[12]:·</span><span·class="n">date</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">(</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">date_range</span><span·class="p">(</span><span·class="s2">&quot;1/1/2015&quot;</span><span·class="p">,</span>·<span·class="n">periods</span><span·class="o">=</span><span·class="mi">5</span><span·class="p">))</span><span·class="o">.</span><span·class="n">astype</span><span·class="p">(</span><span·class="s2">&quot;category&quot;</span><span·class="p">)</span>
  
1658 <span·class="gp">In·[13]:·</span><span·class="n">date</span>1658 <span·class="gp">In·[13]:·</span><span·class="n">date</span>
1659 <span·class="gh">Out[13]:·</span>1659 <span·class="gh">Out[13]:·</span>
1660 <span·class="go">0···2015-01-01</span>1660 <span·class="go">0···2015-01-01</span>
1661 <span·class="go">1···2015-01-02</span>1661 <span·class="go">1···2015-01-02</span>
1662 <span·class="go">2···2015-01-03</span>1662 <span·class="go">2···2015-01-03</span>
1663 <span·class="go">3···2015-01-04</span>1663 <span·class="go">3···2015-01-04</span>
1664 <span·class="go">4···2015-01-05</span>1664 <span·class="go">4···2015-01-05</span>
1665 <span·class="go">dtype:·category</span>1665 <span·class="go">Length:·5,·dtype:·category</span>
1666 <span·class="go">Categories·(5,·datetime64[ns]):·[2015-01-01,·2015-01-02,·2015-01-03,·2015-01-04,·2015-01-05]</span>1666 <span·class="go">Categories·(5,·datetime64[ns]):·[2015-01-01,·2015-01-02,·2015-01-03,·2015-01-04,·2015-01-05]</span>
  
1667 <span·class="gp">In·[14]:·</span><span·class="n">date</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">day</span>1667 <span·class="gp">In·[14]:·</span><span·class="n">date</span><span·class="o">.</span><span·class="n">dt</span><span·class="o">.</span><span·class="n">day</span>
1668 <span·class="gh">Out[14]:·</span>1668 <span·class="gh">Out[14]:·</span>
1669 <span·class="go">0····1</span>1669 <span·class="go">0····1</span>
1670 <span·class="go">1····2</span>1670 <span·class="go">1····2</span>
1671 <span·class="go">2····3</span>1671 <span·class="go">2····3</span>
1672 <span·class="go">3····4</span>1672 <span·class="go">3····4</span>
1673 <span·class="go">4····5</span>1673 <span·class="go">4····5</span>
1674 <span·class="go">dtype:·int32</span>1674 <span·class="go">Length:·5,·dtype:·int32</span>
1675 </pre></div>1675 </pre></div>
1676 </div>1676 </div>
1677 </li>1677 </li>
1678 <li><p><code·class="docutils·literal·notranslate"><span·class="pre">pivot_table</span></code>·now·has·a·<code·class="docutils·literal·notranslate"><span·class="pre">margins_name</span></code>·argument·so·you·can·use·something·other·than·the·default·of·‘All’·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/3335">GH·3335</a>)</p></li>1678 <li><p><code·class="docutils·literal·notranslate"><span·class="pre">pivot_table</span></code>·now·has·a·<code·class="docutils·literal·notranslate"><span·class="pre">margins_name</span></code>·argument·so·you·can·use·something·other·than·the·default·of·‘All’·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/3335">GH·3335</a>)</p></li>
1679 <li><p>Implement·export·of·<code·class="docutils·literal·notranslate"><span·class="pre">datetime64[ns,</span>·<span·class="pre">tz]</span></code>·dtypes·with·a·fixed·HDF5·store·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11411">GH·11411</a>)</p></li>1679 <li><p>Implement·export·of·<code·class="docutils·literal·notranslate"><span·class="pre">datetime64[ns,</span>·<span·class="pre">tz]</span></code>·dtypes·with·a·fixed·HDF5·store·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11411">GH·11411</a>)</p></li>
1680 <li><p>Pretty·printing·sets·(e.g.·in·DataFrame·cells)·now·uses·set·literal·syntax·(<code·class="docutils·literal·notranslate"><span·class="pre">{x,</span>·<span·class="pre">y}</span></code>)·instead·of1680 <li><p>Pretty·printing·sets·(e.g.·in·DataFrame·cells)·now·uses·set·literal·syntax·(<code·class="docutils·literal·notranslate"><span·class="pre">{x,</span>·<span·class="pre">y}</span></code>)·instead·of
1681 Legacy·Python·syntax·(<code·class="docutils·literal·notranslate"><span·class="pre">set([x,</span>·<span·class="pre">y])</span></code>)·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11215">GH·11215</a>)</p></li>1681 Legacy·Python·syntax·(<code·class="docutils·literal·notranslate"><span·class="pre">set([x,</span>·<span·class="pre">y])</span></code>)·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11215">GH·11215</a>)</p></li>
1.45 KB
html2text {}
    
Offset 229, 47 lines modifiedOffset 229, 47 lines modified
  
229 ······In·[10]:·s229 ······In·[10]:·s
230 ······Out[10]:230 ······Out[10]:
231 ······0····a231 ······0····a
232 ······1····a232 ······1····a
233 ······2····b233 ······2····b
234 ······3····b234 ······3····b
235 ······dtype:·category235 ······Length:·4,·dtype:·category
236 ······Categories·(2,·object):·['a',·'b']236 ······Categories·(2,·object):·['a',·'b']
  
237 ······In·[11]:·s.str.contains("a")237 ······In·[11]:·s.str.contains("a")
238 ······Out[11]:238 ······Out[11]:
239 ······0·····True239 ······0·····True
240 ······1·····True240 ······1·····True
241 ······2····False241 ······2····False
242 ······3····False242 ······3····False
243 ······dtype:·bool243 ······Length:·4,·dtype:·bool
  
244 ······In·[12]:·date·=·pd.Series(pd.date_range("1/1/2015",·periods=5)).astype244 ······In·[12]:·date·=·pd.Series(pd.date_range("1/1/2015",·periods=5)).astype
245 ······("category")245 ······("category")
  
246 ······In·[13]:·date246 ······In·[13]:·date
247 ······Out[13]:247 ······Out[13]:
248 ······0···2015-01-01248 ······0···2015-01-01
249 ······1···2015-01-02249 ······1···2015-01-02
250 ······2···2015-01-03250 ······2···2015-01-03
251 ······3···2015-01-04251 ······3···2015-01-04
252 ······4···2015-01-05252 ······4···2015-01-05
253 ······dtype:·category253 ······Length:·5,·dtype:·category
254 ······Categories·(5,·datetime64[ns]):·[2015-01-01,·2015-01-02,·2015-01-03,254 ······Categories·(5,·datetime64[ns]):·[2015-01-01,·2015-01-02,·2015-01-03,
255 ······2015-01-04,·2015-01-05]255 ······2015-01-04,·2015-01-05]
  
256 ······In·[14]:·date.dt.day256 ······In·[14]:·date.dt.day
257 ······Out[14]:257 ······Out[14]:
258 ······0····1258 ······0····1
259 ······1····2259 ······1····2
260 ······2····3260 ······2····3
261 ······3····4261 ······3····4
262 ······4····5262 ······4····5
263 ······dtype:·int32263 ······Length:·5,·dtype:·int32
264 ····*·pivot_table·now·has·a·margins_name·argument·so·you·can·use·something264 ····*·pivot_table·now·has·a·margins_name·argument·so·you·can·use·something
265 ······other·than·the·default·of·‘All’·(_\x8G_\x8H_\x8·_\x83_\x83_\x83_\x85)265 ······other·than·the·default·of·‘All’·(_\x8G_\x8H_\x8·_\x83_\x83_\x83_\x85)
266 ····*·Implement·export·of·datetime64[ns,·tz]·dtypes·with·a·fixed·HDF5·store·(_\x8G_\x8H266 ····*·Implement·export·of·datetime64[ns,·tz]·dtypes·with·a·fixed·HDF5·store·(_\x8G_\x8H
267 ······_\x81_\x81_\x84_\x81_\x81)267 ······_\x81_\x81_\x84_\x81_\x81)
268 ····*·Pretty·printing·sets·(e.g.·in·DataFrame·cells)·now·uses·set·literal268 ····*·Pretty·printing·sets·(e.g.·in·DataFrame·cells)·now·uses·set·literal
269 ······syntax·({x,·y})·instead·of·Legacy·Python·syntax·(set([x,·y]))·(_\x8G_\x8H_\x8·_\x81_\x81_\x82_\x81_\x85)269 ······syntax·({x,·y})·instead·of·Legacy·Python·syntax·(set([x,·y]))·(_\x8G_\x8H_\x8·_\x81_\x81_\x82_\x81_\x85)
270 ····*·Improve·the·error·message·in·pandas.io.gbq.to_gbq()·when·a·streaming270 ····*·Improve·the·error·message·in·pandas.io.gbq.to_gbq()·when·a·streaming
75.6 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.0.html
    
Offset 749, 14 lines modifiedOffset 749, 16 lines modified
749 <span·class="go">3··3·-0.312652</span>749 <span·class="go">3··3·-0.312652</span>
750 <span·class="go">4··4·-0.720589</span>750 <span·class="go">4··4·-0.720589</span>
751 <span·class="go">5··5··0.887163</span>751 <span·class="go">5··5··0.887163</span>
752 <span·class="go">6··6··0.859588</span>752 <span·class="go">6··6··0.859588</span>
753 <span·class="go">7··7·-0.636524</span>753 <span·class="go">7··7·-0.636524</span>
754 <span·class="go">8··8··0.015696</span>754 <span·class="go">8··8··0.015696</span>
755 <span·class="go">9··9·-2.242685</span>755 <span·class="go">9··9·-2.242685</span>
  
 756 <span·class="go">[10·rows·x·2·columns]</span>
756 </pre></div>757 </pre></div>
757 </div>758 </div>
758 <p>Previous·behavior:</p>759 <p>Previous·behavior:</p>
759 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[8]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">rolling_mean</span><span·class="p">(</span><span·class="n">df</span><span·class="p">,</span>·<span·class="n">window</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">)</span>760 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[8]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">rolling_mean</span><span·class="p">(</span><span·class="n">df</span><span·class="p">,</span>·<span·class="n">window</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">)</span>
760 <span·class="go">········FutureWarning:·pd.rolling_mean·is·deprecated·for·DataFrame·and·will·be·removed·in·a·future·version,·replace·with</span>761 <span·class="go">········FutureWarning:·pd.rolling_mean·is·deprecated·for·DataFrame·and·will·be·removed·in·a·future·version,·replace·with</span>
761 <span·class="go">·······················DataFrame.rolling(window=3,center=False).mean()</span>762 <span·class="go">·······················DataFrame.rolling(window=3,center=False).mean()</span>
762 <span·class="gh">Out[8]:</span>763 <span·class="gh">Out[8]:</span>
Offset 798, 14 lines modifiedOffset 800, 16 lines modified
798 <span·class="go">3··2.0·-0.023640</span>800 <span·class="go">3··2.0·-0.023640</span>
799 <span·class="go">4··3.0··0.133155</span>801 <span·class="go">4··3.0··0.133155</span>
800 <span·class="go">5··4.0·-0.048693</span>802 <span·class="go">5··4.0·-0.048693</span>
801 <span·class="go">6··5.0··0.342054</span>803 <span·class="go">6··5.0··0.342054</span>
802 <span·class="go">7··6.0··0.370076</span>804 <span·class="go">7··6.0··0.370076</span>
803 <span·class="go">8··7.0··0.079587</span>805 <span·class="go">8··7.0··0.079587</span>
804 <span·class="go">9··8.0·-0.954504</span>806 <span·class="go">9··8.0·-0.954504</span>
  
 807 <span·class="go">[10·rows·x·2·columns]</span>
805 </pre></div>808 </pre></div>
806 </div>809 </div>
807 <p>They·provide·getitem·accessors</p>810 <p>They·provide·getitem·accessors</p>
808 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">r</span><span·class="p">[</span><span·class="s1">&#39;A&#39;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">mean</span><span·class="p">()</span>811 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">r</span><span·class="p">[</span><span·class="s1">&#39;A&#39;</span><span·class="p">]</span><span·class="o">.</span><span·class="n">mean</span><span·class="p">()</span>
809 <span·class="gh">Out[7]:·</span>812 <span·class="gh">Out[7]:·</span>
810 <span·class="go">0····NaN</span>813 <span·class="go">0····NaN</span>
811 <span·class="go">1····NaN</span>814 <span·class="go">1····NaN</span>
Offset 813, 15 lines modifiedOffset 817, 15 lines modified
813 <span·class="go">3····2.0</span>817 <span·class="go">3····2.0</span>
814 <span·class="go">4····3.0</span>818 <span·class="go">4····3.0</span>
815 <span·class="go">5····4.0</span>819 <span·class="go">5····4.0</span>
816 <span·class="go">6····5.0</span>820 <span·class="go">6····5.0</span>
817 <span·class="go">7····6.0</span>821 <span·class="go">7····6.0</span>
818 <span·class="go">8····7.0</span>822 <span·class="go">8····7.0</span>
819 <span·class="go">9····8.0</span>823 <span·class="go">9····8.0</span>
820 <span·class="go">Name:·A,·dtype:·float64</span>824 <span·class="go">Name:·A,·Length:·10,·dtype:·float64</span>
821 </pre></div>825 </pre></div>
822 </div>826 </div>
823 <p>And·multiple·aggregations</p>827 <p>And·multiple·aggregations</p>
824 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[8]:·</span><span·class="n">r</span><span·class="o">.</span><span·class="n">agg</span><span·class="p">({</span><span·class="s1">&#39;A&#39;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s1">&#39;mean&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;std&#39;</span><span·class="p">],</span>828 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[8]:·</span><span·class="n">r</span><span·class="o">.</span><span·class="n">agg</span><span·class="p">({</span><span·class="s1">&#39;A&#39;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s1">&#39;mean&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;std&#39;</span><span·class="p">],</span>
825 <span·class="gp">···...:·</span>·······<span·class="s1">&#39;B&#39;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s1">&#39;mean&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;std&#39;</span><span·class="p">]})</span>829 <span·class="gp">···...:·</span>·······<span·class="s1">&#39;B&#39;</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s1">&#39;mean&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;std&#39;</span><span·class="p">]})</span>
826 <span·class="gp">···...:·</span>830 <span·class="gp">···...:·</span>
827 <span·class="gh">Out[8]:·</span>831 <span·class="gh">Out[8]:·</span>
Offset 833, 14 lines modifiedOffset 837, 16 lines modified
833 <span·class="go">3··2.0··1.0·-0.023640··1.335505</span>837 <span·class="go">3··2.0··1.0·-0.023640··1.335505</span>
834 <span·class="go">4··3.0··1.0··0.133155··1.143778</span>838 <span·class="go">4··3.0··1.0··0.133155··1.143778</span>
835 <span·class="go">5··4.0··1.0·-0.048693··0.835747</span>839 <span·class="go">5··4.0··1.0·-0.048693··0.835747</span>
836 <span·class="go">6··5.0··1.0··0.342054··0.920379</span>840 <span·class="go">6··5.0··1.0··0.342054··0.920379</span>
837 <span·class="go">7··6.0··1.0··0.370076··0.871850</span>841 <span·class="go">7··6.0··1.0··0.370076··0.871850</span>
838 <span·class="go">8··7.0··1.0··0.079587··0.750099</span>842 <span·class="go">8··7.0··1.0··0.079587··0.750099</span>
839 <span·class="go">9··8.0··1.0·-0.954504··1.162285</span>843 <span·class="go">9··8.0··1.0·-0.954504··1.162285</span>
  
 844 <span·class="go">[10·rows·x·4·columns]</span>
840 </pre></div>845 </pre></div>
841 </div>846 </div>
842 </section>847 </section>
843 <section·id="changes-to-rename">848 <section·id="changes-to-rename">
844 <span·id="whatsnew-0180-enhancements-rename"></span><h3>Changes·to·rename<a·class="headerlink"·href="#changes-to-rename"·title="Link·to·this·heading">#</a></h3>849 <span·id="whatsnew-0180-enhancements-rename"></span><h3>Changes·to·rename<a·class="headerlink"·href="#changes-to-rename"·title="Link·to·this·heading">#</a></h3>
845 <p><code·class="docutils·literal·notranslate"><span·class="pre">Series.rename</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">NDFrame.rename_axis</span></code>·can·now·take·a·scalar·or·list-like850 <p><code·class="docutils·literal·notranslate"><span·class="pre">Series.rename</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">NDFrame.rename_axis</span></code>·can·now·take·a·scalar·or·list-like
846 argument·for·altering·the·Series·or·axis·<em>name</em>,·in·addition·to·their·old·behaviors·of·altering·labels.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9494">GH·9494</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11965">GH·11965</a>)</p>851 argument·for·altering·the·Series·or·axis·<em>name</em>,·in·addition·to·their·old·behaviors·of·altering·labels.·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/9494">GH·9494</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/11965">GH·11965</a>)</p>
Offset 849, 15 lines modifiedOffset 855, 15 lines modified
849 <span·class="gp">In·[10]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">rename</span><span·class="p">(</span><span·class="s1">&#39;newname&#39;</span><span·class="p">)</span>855 <span·class="gp">In·[10]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">rename</span><span·class="p">(</span><span·class="s1">&#39;newname&#39;</span><span·class="p">)</span>
850 <span·class="gh">Out[10]:·</span>856 <span·class="gh">Out[10]:·</span>
851 <span·class="go">0····1.150036</span>857 <span·class="go">0····1.150036</span>
852 <span·class="go">1····0.991946</span>858 <span·class="go">1····0.991946</span>
853 <span·class="go">2····0.953324</span>859 <span·class="go">2····0.953324</span>
854 <span·class="go">3···-2.021255</span>860 <span·class="go">3···-2.021255</span>
855 <span·class="go">4···-0.334077</span>861 <span·class="go">4···-0.334077</span>
856 <span·class="go">Name:·newname,·dtype:·float64</span>862 <span·class="go">Name:·newname,·Length:·5,·dtype:·float64</span>
857 </pre></div>863 </pre></div>
858 </div>864 </div>
859 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[11]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">(</span><span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">randn</span><span·class="p">(</span><span·class="mi">5</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">))</span>865 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[11]:·</span><span·class="n">df</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">DataFrame</span><span·class="p">(</span><span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">randn</span><span·class="p">(</span><span·class="mi">5</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">))</span>
  
860 <span·class="gp">In·[12]:·</span><span·class="p">(</span><span·class="n">df</span><span·class="o">.</span><span·class="n">rename_axis</span><span·class="p">(</span><span·class="s2">&quot;indexname&quot;</span><span·class="p">)</span>866 <span·class="gp">In·[12]:·</span><span·class="p">(</span><span·class="n">df</span><span·class="o">.</span><span·class="n">rename_axis</span><span·class="p">(</span><span·class="s2">&quot;indexname&quot;</span><span·class="p">)</span>
861 <span·class="gp">···....:·</span>···<span·class="o">.</span><span·class="n">rename_axis</span><span·class="p">(</span><span·class="s2">&quot;columns_name&quot;</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="s2">&quot;columns&quot;</span><span·class="p">))</span>867 <span·class="gp">···....:·</span>···<span·class="o">.</span><span·class="n">rename_axis</span><span·class="p">(</span><span·class="s2">&quot;columns_name&quot;</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="s2">&quot;columns&quot;</span><span·class="p">))</span>
862 <span·class="gp">···....:·</span>868 <span·class="gp">···....:·</span>
Offset 865, 14 lines modifiedOffset 871, 16 lines modified
865 <span·class="go">columns_name·········0·········1</span>871 <span·class="go">columns_name·········0·········1</span>
866 <span·class="go">indexname·······················</span>872 <span·class="go">indexname·······················</span>
867 <span·class="go">0·············0.002118··0.405453</span>873 <span·class="go">0·············0.002118··0.405453</span>
868 <span·class="go">1·············0.289092··1.321158</span>874 <span·class="go">1·············0.289092··1.321158</span>
869 <span·class="go">2············-1.546906·-0.202646</span>875 <span·class="go">2············-1.546906·-0.202646</span>
870 <span·class="go">3············-0.655969··0.193421</span>876 <span·class="go">3············-0.655969··0.193421</span>
871 <span·class="go">4·············0.553439··1.318152</span>877 <span·class="go">4·············0.553439··1.318152</span>
  
 878 <span·class="go">[5·rows·x·2·columns]</span>
872 </pre></div>879 </pre></div>
873 </div>880 </div>
874 <p>The·new·functionality·works·well·in·method·chains.·Previously·these·methods·only·accepted·functions·or·dicts·mapping·a·<em>label</em>·to·a·new·label.881 <p>The·new·functionality·works·well·in·method·chains.·Previously·these·methods·only·accepted·functions·or·dicts·mapping·a·<em>label</em>·to·a·new·label.
875 This·continues·to·work·as·before·for·function·or·dict-like·values.</p>882 This·continues·to·work·as·before·for·function·or·dict-like·values.</p>
876 </section>883 </section>
877 <section·id="range-index">884 <section·id="range-index">
878 <span·id="whatsnew-0180-enhancements-rangeindex"></span><h3>Range·Index<a·class="headerlink"·href="#range-index"·title="Link·to·this·heading">#</a></h3>885 <span·id="whatsnew-0180-enhancements-rangeindex"></span><h3>Range·Index<a·class="headerlink"·href="#range-index"·title="Link·to·this·heading">#</a></h3>
Offset 929, 24 lines modifiedOffset 937, 26 lines modified
929 <p>Extracting·a·regular·expression·with·one·group·returns·a·Series·if937 <p>Extracting·a·regular·expression·with·one·group·returns·a·Series·if
930 <code·class="docutils·literal·notranslate"><span·class="pre">expand=False</span></code>.</p>938 <code·class="docutils·literal·notranslate"><span·class="pre">expand=False</span></code>.</p>
931 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[16]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s1">&#39;a1&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;b2&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;c3&#39;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">extract</span><span·class="p">(</span><span·class="sa">r</span><span·class="s1">&#39;[ab](\d)&#39;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">False</span><span·class="p">)</span>939 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[16]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s1">&#39;a1&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;b2&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;c3&#39;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">extract</span><span·class="p">(</span><span·class="sa">r</span><span·class="s1">&#39;[ab](\d)&#39;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">False</span><span·class="p">)</span>
932 <span·class="gh">Out[16]:·</span>940 <span·class="gh">Out[16]:·</span>
933 <span·class="go">0······1</span>941 <span·class="go">0······1</span>
934 <span·class="go">1······2</span>942 <span·class="go">1······2</span>
935 <span·class="go">2····NaN</span>943 <span·class="go">2····NaN</span>
936 <span·class="go">dtype:·object</span>944 <span·class="go">Length:·3,·dtype:·object</span>
937 </pre></div>945 </pre></div>
938 </div>946 </div>
939 <p>It·returns·a·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>·with·one·column·if·<code·class="docutils·literal·notranslate"><span·class="pre">expand=True</span></code>.</p>947 <p>It·returns·a·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>·with·one·column·if·<code·class="docutils·literal·notranslate"><span·class="pre">expand=True</span></code>.</p>
940 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s1">&#39;a1&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;b2&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;c3&#39;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">extract</span><span·class="p">(</span><span·class="sa">r</span><span·class="s1">&#39;[ab](\d)&#39;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span>948 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s1">&#39;a1&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;b2&#39;</span><span·class="p">,</span>·<span·class="s1">&#39;c3&#39;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">str</span><span·class="o">.</span><span·class="n">extract</span><span·class="p">(</span><span·class="sa">r</span><span·class="s1">&#39;[ab](\d)&#39;</span><span·class="p">,</span>·<span·class="n">expand</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span>
941 <span·class="gh">Out[17]:·</span>949 <span·class="gh">Out[17]:·</span>
942 <span·class="go">·····0</span>950 <span·class="go">·····0</span>
943 <span·class="go">0····1</span>951 <span·class="go">0····1</span>
944 <span·class="go">1····2</span>952 <span·class="go">1····2</span>
945 <span·class="go">2··NaN</span>953 <span·class="go">2··NaN</span>
  
 954 <span·class="go">[3·rows·x·1·columns]</span>
946 </pre></div>955 </pre></div>
947 </div>956 </div>
948 <p>Calling·on·an·<code·class="docutils·literal·notranslate"><span·class="pre">Index</span></code>·with·a·regex·with·exactly·one·capture·group957 <p>Calling·on·an·<code·class="docutils·literal·notranslate"><span·class="pre">Index</span></code>·with·a·regex·with·exactly·one·capture·group
949 returns·an·<code·class="docutils·literal·notranslate"><span·class="pre">Index</span></code>·if·<code·class="docutils·literal·notranslate"><span·class="pre">expand=False</span></code>.</p>958 returns·an·<code·class="docutils·literal·notranslate"><span·class="pre">Index</span></code>·if·<code·class="docutils·literal·notranslate"><span·class="pre">expand=False</span></code>.</p>
950 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">s</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s2">&quot;a1&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;b2&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;c3&quot;</span><span·class="p">],</span>·<span·class="p">[</span><span·class="s2">&quot;A11&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;B22&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;C33&quot;</span><span·class="p">])</span>959 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">s</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">Series</span><span·class="p">([</span><span·class="s2">&quot;a1&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;b2&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;c3&quot;</span><span·class="p">],</span>·<span·class="p">[</span><span·class="s2">&quot;A11&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;B22&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;C33&quot;</span><span·class="p">])</span>
  
951 <span·class="gp">In·[19]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">index</span>960 <span·class="gp">In·[19]:·</span><span·class="n">s</span><span·class="o">.</span><span·class="n">index</span>
Offset 959, 14 lines modifiedOffset 969, 16 lines modified
Max diff block lines reached; 46540/56979 bytes (81.68%) of diff not shown.
19.8 KB
html2text {}
    
Offset 199, 14 lines modifiedOffset 199, 16 lines modified
199 3··3·-0.312652199 3··3·-0.312652
200 4··4·-0.720589200 4··4·-0.720589
201 5··5··0.887163201 5··5··0.887163
202 6··6··0.859588202 6··6··0.859588
203 7··7·-0.636524203 7··7·-0.636524
204 8··8··0.015696204 8··8··0.015696
205 9··9·-2.242685205 9··9·-2.242685
  
 206 [10·rows·x·2·columns]
206 Previous·behavior:207 Previous·behavior:
207 In·[8]:·pd.rolling_mean(df,·window=3)208 In·[8]:·pd.rolling_mean(df,·window=3)
208 ········FutureWarning:·pd.rolling_mean·is·deprecated·for·DataFrame·and·will·be209 ········FutureWarning:·pd.rolling_mean·is·deprecated·for·DataFrame·and·will·be
209 removed·in·a·future·version,·replace·with210 removed·in·a·future·version,·replace·with
210 ·······················DataFrame.rolling(window=3,center=False).mean()211 ·······················DataFrame.rolling(window=3,center=False).mean()
211 Out[8]:212 Out[8]:
212 ····A·········B213 ····A·········B
Offset 241, 28 lines modifiedOffset 243, 30 lines modified
241 3··2.0·-0.023640243 3··2.0·-0.023640
242 4··3.0··0.133155244 4··3.0··0.133155
243 5··4.0·-0.048693245 5··4.0·-0.048693
244 6··5.0··0.342054246 6··5.0··0.342054
245 7··6.0··0.370076247 7··6.0··0.370076
246 8··7.0··0.079587248 8··7.0··0.079587
247 9··8.0·-0.954504249 9··8.0·-0.954504
  
 250 [10·rows·x·2·columns]
248 They·provide·getitem·accessors251 They·provide·getitem·accessors
249 In·[7]:·r['A'].mean()252 In·[7]:·r['A'].mean()
250 Out[7]:253 Out[7]:
251 0····NaN254 0····NaN
252 1····NaN255 1····NaN
253 2····1.0256 2····1.0
254 3····2.0257 3····2.0
255 4····3.0258 4····3.0
256 5····4.0259 5····4.0
257 6····5.0260 6····5.0
258 7····6.0261 7····6.0
259 8····7.0262 8····7.0
260 9····8.0263 9····8.0
261 Name:·A,·dtype:·float64264 Name:·A,·Length:·10,·dtype:·float64
262 And·multiple·aggregations265 And·multiple·aggregations
263 In·[8]:·r.agg({'A':·['mean',·'std'],266 In·[8]:·r.agg({'A':·['mean',·'std'],
264 ···...:········'B':·['mean',·'std']})267 ···...:········'B':·['mean',·'std']})
265 ···...:268 ···...:
266 Out[8]:269 Out[8]:
267 ·····A··············B270 ·····A··············B
268 ··mean··std······mean·······std271 ··mean··std······mean·······std
Offset 272, 41 lines modifiedOffset 276, 45 lines modified
272 3··2.0··1.0·-0.023640··1.335505276 3··2.0··1.0·-0.023640··1.335505
273 4··3.0··1.0··0.133155··1.143778277 4··3.0··1.0··0.133155··1.143778
274 5··4.0··1.0·-0.048693··0.835747278 5··4.0··1.0·-0.048693··0.835747
275 6··5.0··1.0··0.342054··0.920379279 6··5.0··1.0··0.342054··0.920379
276 7··6.0··1.0··0.370076··0.871850280 7··6.0··1.0··0.370076··0.871850
277 8··7.0··1.0··0.079587··0.750099281 8··7.0··1.0··0.079587··0.750099
278 9··8.0··1.0·-0.954504··1.162285282 9··8.0··1.0·-0.954504··1.162285
  
 283 [10·rows·x·4·columns]
279 *\x8**\x8**\x8**\x8*·C\x8Ch\x8ha\x8an\x8ng\x8ge\x8es\x8s·t\x8to\x8o·r\x8re\x8en\x8na\x8am\x8me\x8e_\x8#\x8#·*\x8**\x8**\x8**\x8*284 *\x8**\x8**\x8**\x8*·C\x8Ch\x8ha\x8an\x8ng\x8ge\x8es\x8s·t\x8to\x8o·r\x8re\x8en\x8na\x8am\x8me\x8e_\x8#\x8#·*\x8**\x8**\x8**\x8*
280 Series.rename·and·NDFrame.rename_axis·can·now·take·a·scalar·or·list-like285 Series.rename·and·NDFrame.rename_axis·can·now·take·a·scalar·or·list-like
281 argument·for·altering·the·Series·or·axis·n\x8na\x8am\x8me\x8e,·in·addition·to·their·old286 argument·for·altering·the·Series·or·axis·n\x8na\x8am\x8me\x8e,·in·addition·to·their·old
282 behaviors·of·altering·labels.·(_\x8G_\x8H_\x8·_\x89_\x84_\x89_\x84,·_\x8G_\x8H_\x8·_\x81_\x81_\x89_\x86_\x85)287 behaviors·of·altering·labels.·(_\x8G_\x8H_\x8·_\x89_\x84_\x89_\x84,·_\x8G_\x8H_\x8·_\x81_\x81_\x89_\x86_\x85)
283 In·[9]:·s·=·pd.Series(np.random.randn(5))288 In·[9]:·s·=·pd.Series(np.random.randn(5))
  
284 In·[10]:·s.rename('newname')289 In·[10]:·s.rename('newname')
285 Out[10]:290 Out[10]:
286 0····1.150036291 0····1.150036
287 1····0.991946292 1····0.991946
288 2····0.953324293 2····0.953324
289 3···-2.021255294 3···-2.021255
290 4···-0.334077295 4···-0.334077
291 Name:·newname,·dtype:·float64296 Name:·newname,·Length:·5,·dtype:·float64
292 In·[11]:·df·=·pd.DataFrame(np.random.randn(5,·2))297 In·[11]:·df·=·pd.DataFrame(np.random.randn(5,·2))
  
293 In·[12]:·(df.rename_axis("indexname")298 In·[12]:·(df.rename_axis("indexname")
294 ···....:····.rename_axis("columns_name",·axis="columns"))299 ···....:····.rename_axis("columns_name",·axis="columns"))
295 ···....:300 ···....:
296 Out[12]:301 Out[12]:
297 columns_name·········0·········1302 columns_name·········0·········1
298 indexname303 indexname
299 0·············0.002118··0.405453304 0·············0.002118··0.405453
300 1·············0.289092··1.321158305 1·············0.289092··1.321158
301 2············-1.546906·-0.202646306 2············-1.546906·-0.202646
302 3············-0.655969··0.193421307 3············-0.655969··0.193421
303 4·············0.553439··1.318152308 4·············0.553439··1.318152
  
 309 [5·rows·x·2·columns]
304 The·new·functionality·works·well·in·method·chains.·Previously·these·methods310 The·new·functionality·works·well·in·method·chains.·Previously·these·methods
305 only·accepted·functions·or·dicts·mapping·a·l\x8la\x8ab\x8be\x8el\x8l·to·a·new·label.·This·continues311 only·accepted·functions·or·dicts·mapping·a·l\x8la\x8ab\x8be\x8el\x8l·to·a·new·label.·This·continues
306 to·work·as·before·for·function·or·dict-like·values.312 to·work·as·before·for·function·or·dict-like·values.
307 *\x8**\x8**\x8**\x8*·R\x8Ra\x8an\x8ng\x8ge\x8e·I\x8In\x8nd\x8de\x8ex\x8x_\x8#\x8#·*\x8**\x8**\x8**\x8*313 *\x8**\x8**\x8**\x8*·R\x8Ra\x8an\x8ng\x8ge\x8e·I\x8In\x8nd\x8de\x8ex\x8x_\x8#\x8#·*\x8**\x8**\x8**\x8*
308 A·RangeIndex·has·been·added·to·the·Int64Index·sub-classes·to·support·a·memory314 A·RangeIndex·has·been·added·to·the·Int64Index·sub-classes·to·support·a·memory
309 saving·alternative·for·common·use·cases.·This·has·a·similar·implementation·to315 saving·alternative·for·common·use·cases.·This·has·a·similar·implementation·to
310 the·python·range·object·(xrange·in·python·2),·in·that·it·only·stores·the·start,316 the·python·range·object·(xrange·in·python·2),·in·that·it·only·stores·the·start,
Offset 359, 22 lines modifiedOffset 367, 24 lines modified
359 Extracting·a·regular·expression·with·one·group·returns·a·Series·if367 Extracting·a·regular·expression·with·one·group·returns·a·Series·if
360 expand=False.368 expand=False.
361 In·[16]:·pd.Series(['a1',·'b2',·'c3']).str.extract(r'[ab](\d)',·expand=False)369 In·[16]:·pd.Series(['a1',·'b2',·'c3']).str.extract(r'[ab](\d)',·expand=False)
362 Out[16]:370 Out[16]:
363 0······1371 0······1
364 1······2372 1······2
365 2····NaN373 2····NaN
366 dtype:·object374 Length:·3,·dtype:·object
367 It·returns·a·DataFrame·with·one·column·if·expand=True.375 It·returns·a·DataFrame·with·one·column·if·expand=True.
368 In·[17]:·pd.Series(['a1',·'b2',·'c3']).str.extract(r'[ab](\d)',·expand=True)376 In·[17]:·pd.Series(['a1',·'b2',·'c3']).str.extract(r'[ab](\d)',·expand=True)
369 Out[17]:377 Out[17]:
370 ·····0378 ·····0
371 0····1379 0····1
372 1····2380 1····2
373 2··NaN381 2··NaN
  
 382 [3·rows·x·1·columns]
374 Calling·on·an·Index·with·a·regex·with·exactly·one·capture·group·returns·an383 Calling·on·an·Index·with·a·regex·with·exactly·one·capture·group·returns·an
375 Index·if·expand=False.384 Index·if·expand=False.
376 In·[18]:·s·=·pd.Series(["a1",·"b2",·"c3"],·["A11",·"B22",·"C33"])385 In·[18]:·s·=·pd.Series(["a1",·"b2",·"c3"],·["A11",·"B22",·"C33"])
  
377 In·[19]:·s.index386 In·[19]:·s.index
378 Out[19]:·Index(['A11',·'B22',·'C33'],·dtype='object')387 Out[19]:·Index(['A11',·'B22',·'C33'],·dtype='object')
  
Offset 383, 53 lines modifiedOffset 393, 61 lines modified
383 It·returns·a·DataFrame·with·one·column·if·expand=True.393 It·returns·a·DataFrame·with·one·column·if·expand=True.
384 In·[21]:·s.index.str.extract("(?P<letter>[a-zA-Z])",·expand=True)394 In·[21]:·s.index.str.extract("(?P<letter>[a-zA-Z])",·expand=True)
385 Out[21]:395 Out[21]:
386 ··letter396 ··letter
387 0······A397 0······A
388 1······B398 1······B
389 2······C399 2······C
  
Max diff block lines reached; 16520/20299 bytes (81.38%) of diff not shown.
24.8 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.18.1.html
    
Offset 724, 15 lines modifiedOffset 724, 15 lines modified
  
724 <span·class="gp">In·[6]:·</span><span·class="n">dt</span>·<span·class="o">+</span>·<span·class="n">bhour_us</span>724 <span·class="gp">In·[6]:·</span><span·class="n">dt</span>·<span·class="o">+</span>·<span·class="n">bhour_us</span>
725 <span·class="gh">Out[6]:·</span><span·class="go">Timestamp(&#39;2014-01-17·16:00:00&#39;)</span>725 <span·class="gh">Out[6]:·</span><span·class="go">Timestamp(&#39;2014-01-17·16:00:00&#39;)</span>
726 </pre></div>726 </pre></div>
727 </div>727 </div>
728 <p>Tuesday·after·MLK·Day·(Monday·is·skipped·because·it’s·a·holiday)</p>728 <p>Tuesday·after·MLK·Day·(Monday·is·skipped·because·it’s·a·holiday)</p>
729 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">dt</span>·<span·class="o">+</span>·<span·class="n">bhour_us</span>·<span·class="o">*</span>·<span·class="mi">2</span>729 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">dt</span>·<span·class="o">+</span>·<span·class="n">bhour_us</span>·<span·class="o">*</span>·<span·class="mi">2</span>
730 <span·class="gh">Out[7]:·</span><span·class="go">Timestamp(&#39;2014-01-21·09:00:00&#39;)</span>730 <span·class="gh">Out[7]:·</span><span·class="go">Timestamp(&#39;2014-01-20·09:00:00&#39;)</span>
731 </pre></div>731 </pre></div>
732 </div>732 </div>
733 </section>733 </section>
734 <section·id="method-groupby-syntax-with-window-and-resample-operations">734 <section·id="method-groupby-syntax-with-window-and-resample-operations">
735 <span·id="whatsnew-0181-deferred-ops"></span><h3>Method·<code·class="docutils·literal·notranslate"><span·class="pre">.groupby(..)</span></code>·syntax·with·window·and·resample·operations<a·class="headerlink"·href="#method-groupby-syntax-with-window-and-resample-operations"·title="Link·to·this·heading">#</a></h3>735 <span·id="whatsnew-0181-deferred-ops"></span><h3>Method·<code·class="docutils·literal·notranslate"><span·class="pre">.groupby(..)</span></code>·syntax·with·window·and·resample·operations<a·class="headerlink"·href="#method-groupby-syntax-with-window-and-resample-operations"·title="Link·to·this·heading">#</a></h3>
736 <p><code·class="docutils·literal·notranslate"><span·class="pre">.groupby(...)</span></code>·has·been·enhanced·to·provide·convenient·syntax·when·working·with·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling(..)</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding(..)</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.resample(..)</span></code>·per·group,·see·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12486">GH·12486</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12738">GH·12738</a>).</p>736 <p><code·class="docutils·literal·notranslate"><span·class="pre">.groupby(...)</span></code>·has·been·enhanced·to·provide·convenient·syntax·when·working·with·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling(..)</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding(..)</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.resample(..)</span></code>·per·group,·see·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12486">GH·12486</a>,·<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12738">GH·12738</a>).</p>
737 <p>You·can·now·use·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling(..)</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding(..)</span></code>·as·methods·on·groupbys.·These·return·another·deferred·object·(similar·to·what·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling()</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding()</span></code>·do·on·ungrouped·pandas·objects).·You·can·then·operate·on·these·<code·class="docutils·literal·notranslate"><span·class="pre">RollingGroupby</span></code>·objects·in·a·similar·manner.</p>737 <p>You·can·now·use·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling(..)</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding(..)</span></code>·as·methods·on·groupbys.·These·return·another·deferred·object·(similar·to·what·<code·class="docutils·literal·notranslate"><span·class="pre">.rolling()</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">.expanding()</span></code>·do·on·ungrouped·pandas·objects).·You·can·then·operate·on·these·<code·class="docutils·literal·notranslate"><span·class="pre">RollingGroupby</span></code>·objects·in·a·similar·manner.</p>
Offset 835, 14 lines modifiedOffset 835, 16 lines modified
835 <span·class="gh">Out[12]:·</span>835 <span·class="gh">Out[12]:·</span>
836 <span·class="go">············group··val</span>836 <span·class="go">············group··val</span>
837 <span·class="go">date··················</span>837 <span·class="go">date··················</span>
838 <span·class="go">2016-01-03······1····5</span>838 <span·class="go">2016-01-03······1····5</span>
839 <span·class="go">2016-01-10······1····6</span>839 <span·class="go">2016-01-10······1····6</span>
840 <span·class="go">2016-01-17······2····7</span>840 <span·class="go">2016-01-17······2····7</span>
841 <span·class="go">2016-01-24······2····8</span>841 <span·class="go">2016-01-24······2····8</span>
  
 842 <span·class="go">[4·rows·x·2·columns]</span>
842 </pre></div>843 </pre></div>
843 </div>844 </div>
844 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="n">In</span><span·class="p">[</span><span·class="mi">1</span><span·class="p">]:</span>·<span·class="n">df</span><span·class="o">.</span><span·class="n">groupby</span><span·class="p">(</span><span·class="s2">&quot;group&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">apply</span><span·class="p">(</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">resample</span><span·class="p">(</span><span·class="s2">&quot;1D&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">ffill</span><span·class="p">())</span>845 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="n">In</span><span·class="p">[</span><span·class="mi">1</span><span·class="p">]:</span>·<span·class="n">df</span><span·class="o">.</span><span·class="n">groupby</span><span·class="p">(</span><span·class="s2">&quot;group&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">apply</span><span·class="p">(</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">resample</span><span·class="p">(</span><span·class="s2">&quot;1D&quot;</span><span·class="p">)</span><span·class="o">.</span><span·class="n">ffill</span><span·class="p">())</span>
845 <span·class="n">Out</span><span·class="p">[</span><span·class="mi">1</span><span·class="p">]:</span>846 <span·class="n">Out</span><span·class="p">[</span><span·class="mi">1</span><span·class="p">]:</span>
846 ··················<span·class="n">group</span>··<span·class="n">val</span>847 ··················<span·class="n">group</span>··<span·class="n">val</span>
847 <span·class="n">group</span>·<span·class="n">date</span>848 <span·class="n">group</span>·<span·class="n">date</span>
848 <span·class="mi">1</span>·····<span·class="mi">2016</span><span·class="o">-</span><span·class="mi">01</span><span·class="o">-</span><span·class="mi">03</span>······<span·class="mi">1</span>····<span·class="mi">5</span>849 <span·class="mi">1</span>·····<span·class="mi">2016</span><span·class="o">-</span><span·class="mi">01</span><span·class="o">-</span><span·class="mi">03</span>······<span·class="mi">1</span>····<span·class="mi">5</span>
Offset 905, 48 lines modifiedOffset 907, 54 lines modified
  
905 <span·class="gp">In·[14]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">where</span><span·class="p">(</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span>·<span·class="o">&gt;</span>·<span·class="mi">4</span><span·class="p">,</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span>·<span·class="o">+</span>·<span·class="mi">10</span><span·class="p">)</span>907 <span·class="gp">In·[14]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">where</span><span·class="p">(</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span>·<span·class="o">&gt;</span>·<span·class="mi">4</span><span·class="p">,</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span>·<span·class="o">+</span>·<span·class="mi">10</span><span·class="p">)</span>
906 <span·class="gh">Out[14]:·</span>908 <span·class="gh">Out[14]:·</span>
907 <span·class="go">····A···B··C</span>909 <span·class="go">····A···B··C</span>
908 <span·class="go">0··11··14··7</span>910 <span·class="go">0··11··14··7</span>
909 <span·class="go">1··12···5··8</span>911 <span·class="go">1··12···5··8</span>
910 <span·class="go">2··13···6··9</span>912 <span·class="go">2··13···6··9</span>
  
 913 <span·class="go">[3·rows·x·3·columns]</span>
911 </pre></div>914 </pre></div>
912 </div>915 </div>
913 </section>916 </section>
914 <section·id="methods-loc-iloc-ix">917 <section·id="methods-loc-iloc-ix">
915 <h4>Methods·<code·class="docutils·literal·notranslate"><span·class="pre">.loc[]</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.iloc[]</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.ix[]</span></code><a·class="headerlink"·href="#methods-loc-iloc-ix"·title="Link·to·this·heading">#</a></h4>918 <h4>Methods·<code·class="docutils·literal·notranslate"><span·class="pre">.loc[]</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.iloc[]</span></code>,·<code·class="docutils·literal·notranslate"><span·class="pre">.ix[]</span></code><a·class="headerlink"·href="#methods-loc-iloc-ix"·title="Link·to·this·heading">#</a></h4>
916 <p>These·can·accept·a·callable,·and·a·tuple·of·callable·as·a·slicer.·The·callable919 <p>These·can·accept·a·callable,·and·a·tuple·of·callable·as·a·slicer.·The·callable
917 can·return·a·valid·boolean·indexer·or·anything·which·is·valid·for·these·indexer’s·input.</p>920 can·return·a·valid·boolean·indexer·or·anything·which·is·valid·for·these·indexer’s·input.</p>
918 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·callable·returns·bool·indexer</span>921 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·callable·returns·bool·indexer</span>
919 <span·class="gp">In·[15]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">A</span>·<span·class="o">&gt;=</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">sum</span><span·class="p">()</span>·<span·class="o">&gt;</span>·<span·class="mi">10</span><span·class="p">]</span>922 <span·class="gp">In·[15]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">A</span>·<span·class="o">&gt;=</span>·<span·class="mi">2</span><span·class="p">,</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="n">x</span><span·class="o">.</span><span·class="n">sum</span><span·class="p">()</span>·<span·class="o">&gt;</span>·<span·class="mi">10</span><span·class="p">]</span>
920 <span·class="gh">Out[15]:·</span>923 <span·class="gh">Out[15]:·</span>
921 <span·class="go">···B··C</span>924 <span·class="go">···B··C</span>
922 <span·class="go">1··5··8</span>925 <span·class="go">1··5··8</span>
923 <span·class="go">2··6··9</span>926 <span·class="go">2··6··9</span>
  
 927 <span·class="go">[2·rows·x·2·columns]</span>
  
924 <span·class="go">#·callable·returns·list·of·labels</span>928 <span·class="go">#·callable·returns·list·of·labels</span>
925 <span·class="gp">In·[16]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">],</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s2">&quot;A&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;B&quot;</span><span·class="p">]]</span>929 <span·class="gp">In·[16]:·</span><span·class="n">df</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="p">[</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="mi">2</span><span·class="p">],</span>·<span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="p">[</span><span·class="s2">&quot;A&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;B&quot;</span><span·class="p">]]</span>
926 <span·class="gh">Out[16]:·</span>930 <span·class="gh">Out[16]:·</span>
927 <span·class="go">···A··B</span>931 <span·class="go">···A··B</span>
928 <span·class="go">1··2··5</span>932 <span·class="go">1··2··5</span>
929 <span·class="go">2··3··6</span>933 <span·class="go">2··3··6</span>
  
 934 <span·class="go">[2·rows·x·2·columns]</span>
930 </pre></div>935 </pre></div>
931 </div>936 </div>
932 </section>937 </section>
933 <section·id="indexing-with">938 <section·id="indexing-with">
934 <h4>Indexing·with·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code><a·class="headerlink"·href="#indexing-with"·title="Link·to·this·heading">#</a></h4>939 <h4>Indexing·with·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code><a·class="headerlink"·href="#indexing-with"·title="Link·to·this·heading">#</a></h4>
935 <p>Finally,·you·can·use·a·callable·in·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code>·indexing·of·Series,·DataFrame·and·Panel.940 <p>Finally,·you·can·use·a·callable·in·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code>·indexing·of·Series,·DataFrame·and·Panel.
936 The·callable·must·return·a·valid·input·for·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code>·indexing·depending·on·its941 The·callable·must·return·a·valid·input·for·<code·class="docutils·literal·notranslate"><span·class="pre">[]</span></code>·indexing·depending·on·its
937 class·and·index·type.</p>942 class·and·index·type.</p>
938 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="n">df</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="s2">&quot;A&quot;</span><span·class="p">]</span>943 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="n">df</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">x</span><span·class="p">:</span>·<span·class="s2">&quot;A&quot;</span><span·class="p">]</span>
939 <span·class="gh">Out[17]:·</span>944 <span·class="gh">Out[17]:·</span>
940 <span·class="go">0····1</span>945 <span·class="go">0····1</span>
941 <span·class="go">1····2</span>946 <span·class="go">1····2</span>
942 <span·class="go">2····3</span>947 <span·class="go">2····3</span>
943 <span·class="go">Name:·A,·dtype:·int64</span>948 <span·class="go">Name:·A,·Length:·3,·dtype:·int64</span>
944 </pre></div>949 </pre></div>
945 </div>950 </div>
946 <p>Using·these·methods·/·indexers,·you·can·chain·data·selection·operations951 <p>Using·these·methods·/·indexers,·you·can·chain·data·selection·operations
947 without·using·temporary·variable.</p>952 without·using·temporary·variable.</p>
948 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">bb</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_csv</span><span·class="p">(</span><span·class="s2">&quot;data/baseball.csv&quot;</span><span·class="p">,</span>·<span·class="n">index_col</span><span·class="o">=</span><span·class="s2">&quot;id&quot;</span><span·class="p">)</span>953 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">bb</span>·<span·class="o">=</span>·<span·class="n">pd</span><span·class="o">.</span><span·class="n">read_csv</span><span·class="p">(</span><span·class="s2">&quot;data/baseball.csv&quot;</span><span·class="p">,</span>·<span·class="n">index_col</span><span·class="o">=</span><span·class="s2">&quot;id&quot;</span><span·class="p">)</span>
  
949 <span·class="gp">In·[19]:·</span><span·class="p">(</span><span·class="n">bb</span><span·class="o">.</span><span·class="n">groupby</span><span·class="p">([</span><span·class="s2">&quot;year&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;team&quot;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">sum</span><span·class="p">(</span><span·class="n">numeric_only</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">df</span><span·class="p">:</span>·<span·class="n">df</span><span·class="o">.</span><span·class="n">r</span>·<span·class="o">&gt;</span>·<span·class="mi">100</span><span·class="p">])</span>954 <span·class="gp">In·[19]:·</span><span·class="p">(</span><span·class="n">bb</span><span·class="o">.</span><span·class="n">groupby</span><span·class="p">([</span><span·class="s2">&quot;year&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;team&quot;</span><span·class="p">])</span><span·class="o">.</span><span·class="n">sum</span><span·class="p">(</span><span·class="n">numeric_only</span><span·class="o">=</span><span·class="kc">True</span><span·class="p">)</span><span·class="o">.</span><span·class="n">loc</span><span·class="p">[</span><span·class="k">lambda</span>·<span·class="n">df</span><span·class="p">:</span>·<span·class="n">df</span><span·class="o">.</span><span·class="n">r</span>·<span·class="o">&gt;</span>·<span·class="mi">100</span><span·class="p">])</span>
Offset 1050, 30 lines modifiedOffset 1058, 32 lines modified
1050 <span·class="gp">···....:·</span>1058 <span·class="gp">···....:·</span>
  
1051 <span·class="gp">In·[21]:·</span><span·class="n">df</span>1059 <span·class="gp">In·[21]:·</span><span·class="n">df</span>
1052 <span·class="gh">Out[21]:·</span>1060 <span·class="gh">Out[21]:·</span>
1053 <span·class="go">···year··month··day··hour</span>1061 <span·class="go">···year··month··day··hour</span>
1054 <span·class="go">0··2015······2····4·····2</span>1062 <span·class="go">0··2015······2····4·····2</span>
1055 <span·class="go">1··2016······3····5·····3</span>1063 <span·class="go">1··2016······3····5·····3</span>
  
 1064 <span·class="go">[2·rows·x·4·columns]</span>
1056 </pre></div>1065 </pre></div>
1057 </div>1066 </div>
1058 <p>Assembling·using·the·passed·frame.</p>1067 <p>Assembling·using·the·passed·frame.</p>
1059 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[22]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">to_datetime</span><span·class="p">(</span><span·class="n">df</span><span·class="p">)</span>1068 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[22]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">to_datetime</span><span·class="p">(</span><span·class="n">df</span><span·class="p">)</span>
1060 <span·class="gh">Out[22]:·</span>1069 <span·class="gh">Out[22]:·</span>
1061 <span·class="go">0···2015-02-04·02:00:00</span>1070 <span·class="go">0···2015-02-04·02:00:00</span>
1062 <span·class="go">1···2016-03-05·03:00:00</span>1071 <span·class="go">1···2016-03-05·03:00:00</span>
1063 <span·class="go">dtype:·datetime64[ns]</span>1072 <span·class="go">Length:·2,·dtype:·datetime64[ns]</span>
1064 </pre></div>1073 </pre></div>
1065 </div>1074 </div>
1066 <p>You·can·pass·only·the·columns·that·you·need·to·assemble.</p>1075 <p>You·can·pass·only·the·columns·that·you·need·to·assemble.</p>
1067 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[23]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">to_datetime</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[[</span><span·class="s2">&quot;year&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;month&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;day&quot;</span><span·class="p">]])</span>1076 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[23]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">to_datetime</span><span·class="p">(</span><span·class="n">df</span><span·class="p">[[</span><span·class="s2">&quot;year&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;month&quot;</span><span·class="p">,</span>·<span·class="s2">&quot;day&quot;</span><span·class="p">]])</span>
1068 <span·class="gh">Out[23]:·</span>1077 <span·class="gh">Out[23]:·</span>
1069 <span·class="go">0···2015-02-04</span>1078 <span·class="go">0···2015-02-04</span>
1070 <span·class="go">1···2016-03-05</span>1079 <span·class="go">1···2016-03-05</span>
1071 <span·class="go">dtype:·datetime64[ns]</span>1080 <span·class="go">Length:·2,·dtype:·datetime64[ns]</span>
1072 </pre></div>1081 </pre></div>
1073 </div>1082 </div>
1074 </section>1083 </section>
1075 <section·id="other-enhancements">1084 <section·id="other-enhancements">
1076 <span·id="whatsnew-0181-other"></span><h3>Other·enhancements<a·class="headerlink"·href="#other-enhancements"·title="Link·to·this·heading">#</a></h3>1085 <span·id="whatsnew-0181-other"></span><h3>Other·enhancements<a·class="headerlink"·href="#other-enhancements"·title="Link·to·this·heading">#</a></h3>
1077 <ul>1086 <ul>
1078 <li><p><code·class="docutils·literal·notranslate"><span·class="pre">pd.read_csv()</span></code>·now·supports·<code·class="docutils·literal·notranslate"><span·class="pre">delim_whitespace=True</span></code>·for·the·Python·engine·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12958">GH·12958</a>)</p></li>1087 <li><p><code·class="docutils·literal·notranslate"><span·class="pre">pd.read_csv()</span></code>·now·supports·<code·class="docutils·literal·notranslate"><span·class="pre">delim_whitespace=True</span></code>·for·the·Python·engine·(<a·class="extlink-issue·reference·external"·href="https://github.com/pandas-dev/pandas/issues/12958">GH·12958</a>)</p></li>
Offset 1158, 14 lines modifiedOffset 1168, 16 lines modified
  
1158 <span·class="gp">In·[30]:·</span><span·class="n">df</span>1168 <span·class="gp">In·[30]:·</span><span·class="n">df</span>
1159 <span·class="gh">Out[30]:·</span>1169 <span·class="gh">Out[30]:·</span>
1160 <span·class="go">···A··B</span>1170 <span·class="go">···A··B</span>
1161 <span·class="go">0··a··1</span>1171 <span·class="go">0··a··1</span>
1162 <span·class="go">1··b··2</span>1172 <span·class="go">1··b··2</span>
Max diff block lines reached; 6892/19211 bytes (35.88%) of diff not shown.
5.88 KB
html2text {}
    
Offset 173, 15 lines modifiedOffset 173, 15 lines modified
  
173 In·[5]:·dt·=·datetime.datetime(2014,·1,·17,·15)173 In·[5]:·dt·=·datetime.datetime(2014,·1,·17,·15)
  
174 In·[6]:·dt·+·bhour_us174 In·[6]:·dt·+·bhour_us
175 Out[6]:·Timestamp('2014-01-17·16:00:00')175 Out[6]:·Timestamp('2014-01-17·16:00:00')
176 Tuesday·after·MLK·Day·(Monday·is·skipped·because·it’s·a·holiday)176 Tuesday·after·MLK·Day·(Monday·is·skipped·because·it’s·a·holiday)
177 In·[7]:·dt·+·bhour_us·*·2177 In·[7]:·dt·+·bhour_us·*·2
178 Out[7]:·Timestamp('2014-01-21·09:00:00')178 Out[7]:·Timestamp('2014-01-20·09:00:00')
179 *\x8**\x8**\x8**\x8*·M\x8Me\x8et\x8th\x8ho\x8od\x8d·.\x8.g\x8gr\x8ro\x8ou\x8up\x8pb\x8by\x8y(\x8(.\x8..\x8.)\x8)·s\x8sy\x8yn\x8nt\x8ta\x8ax\x8x·w\x8wi\x8it\x8th\x8h·w\x8wi\x8in\x8nd\x8do\x8ow\x8w·a\x8an\x8nd\x8d·r\x8re\x8es\x8sa\x8am\x8mp\x8pl\x8le\x8e·o\x8op\x8pe\x8er\x8ra\x8at\x8ti\x8io\x8on\x8ns\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*179 *\x8**\x8**\x8**\x8*·M\x8Me\x8et\x8th\x8ho\x8od\x8d·.\x8.g\x8gr\x8ro\x8ou\x8up\x8pb\x8by\x8y(\x8(.\x8..\x8.)\x8)·s\x8sy\x8yn\x8nt\x8ta\x8ax\x8x·w\x8wi\x8it\x8th\x8h·w\x8wi\x8in\x8nd\x8do\x8ow\x8w·a\x8an\x8nd\x8d·r\x8re\x8es\x8sa\x8am\x8mp\x8pl\x8le\x8e·o\x8op\x8pe\x8er\x8ra\x8at\x8ti\x8io\x8on\x8ns\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*
180 .groupby(...)·has·been·enhanced·to·provide·convenient·syntax·when·working·with180 .groupby(...)·has·been·enhanced·to·provide·convenient·syntax·when·working·with
181 .rolling(..),·.expanding(..)·and·.resample(..)·per·group,·see·(_\x8G_\x8H_\x8·_\x81_\x82_\x84_\x88_\x86,·_\x8G_\x8H181 .rolling(..),·.expanding(..)·and·.resample(..)·per·group,·see·(_\x8G_\x8H_\x8·_\x81_\x82_\x84_\x88_\x86,·_\x8G_\x8H
182 _\x81_\x82_\x87_\x83_\x88).182 _\x81_\x82_\x87_\x83_\x88).
183 You·can·now·use·.rolling(..)·and·.expanding(..)·as·methods·on·groupbys.·These183 You·can·now·use·.rolling(..)·and·.expanding(..)·as·methods·on·groupbys.·These
184 return·another·deferred·object·(similar·to·what·.rolling()·and·.expanding()·do184 return·another·deferred·object·(similar·to·what·.rolling()·and·.expanding()·do
185 on·ungrouped·pandas·objects).·You·can·then·operate·on·these·RollingGroupby185 on·ungrouped·pandas·objects).·You·can·then·operate·on·these·RollingGroupby
Offset 281, 14 lines modifiedOffset 281, 16 lines modified
281 Out[12]:281 Out[12]:
282 ············group··val282 ············group··val
283 date283 date
284 2016-01-03······1····5284 2016-01-03······1····5
285 2016-01-10······1····6285 2016-01-10······1····6
286 2016-01-17······2····7286 2016-01-17······2····7
287 2016-01-24······2····8287 2016-01-24······2····8
  
 288 [4·rows·x·2·columns]
288 In[1]:·df.groupby("group").apply(lambda·x:·x.resample("1D").ffill())289 In[1]:·df.groupby("group").apply(lambda·x:·x.resample("1D").ffill())
289 Out[1]:290 Out[1]:
290 ··················group··val291 ··················group··val
291 group·date292 group·date
292 1·····2016-01-03······1····5293 1·····2016-01-03······1····5
293 ······2016-01-04······1····5294 ······2016-01-04······1····5
294 ······2016-01-05······1····5295 ······2016-01-05······1····5
Offset 338, 41 lines modifiedOffset 340, 47 lines modified
  
338 In·[14]:·df.where(lambda·x:·x·>·4,·lambda·x:·x·+·10)340 In·[14]:·df.where(lambda·x:·x·>·4,·lambda·x:·x·+·10)
339 Out[14]:341 Out[14]:
340 ····A···B··C342 ····A···B··C
341 0··11··14··7343 0··11··14··7
342 1··12···5··8344 1··12···5··8
343 2··13···6··9345 2··13···6··9
  
 346 [3·rows·x·3·columns]
344 *\x8**\x8**\x8*·M\x8Me\x8et\x8th\x8ho\x8od\x8ds\x8s·.\x8.l\x8lo\x8oc\x8c[\x8[]\x8],\x8,·.\x8.i\x8il\x8lo\x8oc\x8c[\x8[]\x8],\x8,·.\x8.i\x8ix\x8x[\x8[]\x8]_\x8#\x8#·*\x8**\x8**\x8*347 *\x8**\x8**\x8*·M\x8Me\x8et\x8th\x8ho\x8od\x8ds\x8s·.\x8.l\x8lo\x8oc\x8c[\x8[]\x8],\x8,·.\x8.i\x8il\x8lo\x8oc\x8c[\x8[]\x8],\x8,·.\x8.i\x8ix\x8x[\x8[]\x8]_\x8#\x8#·*\x8**\x8**\x8*
345 These·can·accept·a·callable,·and·a·tuple·of·callable·as·a·slicer.·The·callable348 These·can·accept·a·callable,·and·a·tuple·of·callable·as·a·slicer.·The·callable
346 can·return·a·valid·boolean·indexer·or·anything·which·is·valid·for·these349 can·return·a·valid·boolean·indexer·or·anything·which·is·valid·for·these
347 indexer’s·input.350 indexer’s·input.
348 #·callable·returns·bool·indexer351 #·callable·returns·bool·indexer
349 In·[15]:·df.loc[lambda·x:·x.A·>=·2,·lambda·x:·x.sum()·>·10]352 In·[15]:·df.loc[lambda·x:·x.A·>=·2,·lambda·x:·x.sum()·>·10]
350 Out[15]:353 Out[15]:
351 ···B··C354 ···B··C
352 1··5··8355 1··5··8
353 2··6··9356 2··6··9
  
 357 [2·rows·x·2·columns]
  
354 #·callable·returns·list·of·labels358 #·callable·returns·list·of·labels
355 In·[16]:·df.loc[lambda·x:·[1,·2],·lambda·x:·["A",·"B"]]359 In·[16]:·df.loc[lambda·x:·[1,·2],·lambda·x:·["A",·"B"]]
356 Out[16]:360 Out[16]:
357 ···A··B361 ···A··B
358 1··2··5362 1··2··5
359 2··3··6363 2··3··6
  
 364 [2·rows·x·2·columns]
360 *\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8xi\x8in\x8ng\x8g·w\x8wi\x8it\x8th\x8h·[\x8[]\x8]_\x8#\x8#·*\x8**\x8**\x8*365 *\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8xi\x8in\x8ng\x8g·w\x8wi\x8it\x8th\x8h·[\x8[]\x8]_\x8#\x8#·*\x8**\x8**\x8*
361 Finally,·you·can·use·a·callable·in·[]·indexing·of·Series,·DataFrame·and·Panel.366 Finally,·you·can·use·a·callable·in·[]·indexing·of·Series,·DataFrame·and·Panel.
362 The·callable·must·return·a·valid·input·for·[]·indexing·depending·on·its·class367 The·callable·must·return·a·valid·input·for·[]·indexing·depending·on·its·class
363 and·index·type.368 and·index·type.
364 In·[17]:·df[lambda·x:·"A"]369 In·[17]:·df[lambda·x:·"A"]
365 Out[17]:370 Out[17]:
366 0····1371 0····1
367 1····2372 1····2
368 2····3373 2····3
369 Name:·A,·dtype:·int64374 Name:·A,·Length:·3,·dtype:·int64
370 Using·these·methods·/·indexers,·you·can·chain·data·selection·operations·without375 Using·these·methods·/·indexers,·you·can·chain·data·selection·operations·without
371 using·temporary·variable.376 using·temporary·variable.
372 In·[18]:·bb·=·pd.read_csv("data/baseball.csv",·index_col="id")377 In·[18]:·bb·=·pd.read_csv("data/baseball.csv",·index_col="id")
  
373 In·[19]:·(bb.groupby(["year",·"team"]).sum(numeric_only=True).loc[lambda·df:378 In·[19]:·(bb.groupby(["year",·"team"]).sum(numeric_only=True).loc[lambda·df:
374 df.r·>·100])379 df.r·>·100])
375 Out[19]:380 Out[19]:
Offset 478, 26 lines modifiedOffset 486, 28 lines modified
478 ···....:486 ···....:
  
479 In·[21]:·df487 In·[21]:·df
480 Out[21]:488 Out[21]:
481 ···year··month··day··hour489 ···year··month··day··hour
482 0··2015······2····4·····2490 0··2015······2····4·····2
483 1··2016······3····5·····3491 1··2016······3····5·····3
  
 492 [2·rows·x·4·columns]
484 Assembling·using·the·passed·frame.493 Assembling·using·the·passed·frame.
485 In·[22]:·pd.to_datetime(df)494 In·[22]:·pd.to_datetime(df)
486 Out[22]:495 Out[22]:
487 0···2015-02-04·02:00:00496 0···2015-02-04·02:00:00
488 1···2016-03-05·03:00:00497 1···2016-03-05·03:00:00
489 dtype:·datetime64[ns]498 Length:·2,·dtype:·datetime64[ns]
490 You·can·pass·only·the·columns·that·you·need·to·assemble.499 You·can·pass·only·the·columns·that·you·need·to·assemble.
491 In·[23]:·pd.to_datetime(df[["year",·"month",·"day"]])500 In·[23]:·pd.to_datetime(df[["year",·"month",·"day"]])
492 Out[23]:501 Out[23]:
493 0···2015-02-04502 0···2015-02-04
494 1···2016-03-05503 1···2016-03-05
495 dtype:·datetime64[ns]504 Length:·2,·dtype:·datetime64[ns]
496 *\x8**\x8**\x8**\x8*·O\x8Ot\x8th\x8he\x8er\x8r·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8ts\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*505 *\x8**\x8**\x8**\x8*·O\x8Ot\x8th\x8he\x8er\x8r·e\x8en\x8nh\x8ha\x8an\x8nc\x8ce\x8em\x8me\x8en\x8nt\x8ts\x8s_\x8#\x8#·*\x8**\x8**\x8**\x8*
497 ····*·pd.read_csv()·now·supports·delim_whitespace=True·for·the·Python·engine506 ····*·pd.read_csv()·now·supports·delim_whitespace=True·for·the·Python·engine
498 ······(_\x8G_\x8H_\x8·_\x81_\x82_\x89_\x85_\x88)507 ······(_\x8G_\x8H_\x8·_\x81_\x82_\x89_\x85_\x88)
499 ····*·pd.read_csv()·now·supports·opening·ZIP·files·that·contains·a·single·CSV,508 ····*·pd.read_csv()·now·supports·opening·ZIP·files·that·contains·a·single·CSV,
500 ······via·extension·inference·or·explicit·compression='zip'·(_\x8G_\x8H_\x8·_\x81_\x82_\x81_\x87_\x85)509 ······via·extension·inference·or·explicit·compression='zip'·(_\x8G_\x8H_\x8·_\x81_\x82_\x81_\x87_\x85)
501 ····*·pd.read_csv()·now·supports·opening·files·using·xz·compression,·via510 ····*·pd.read_csv()·now·supports·opening·files·using·xz·compression,·via
502 ······extension·inference·or·explicit·compression='xz'·is·specified;·xz511 ······extension·inference·or·explicit·compression='xz'·is·specified;·xz
Offset 589, 14 lines modifiedOffset 599, 16 lines modified
  
589 In·[30]:·df599 In·[30]:·df
590 Out[30]:600 Out[30]:
591 ···A··B601 ···A··B
592 0··a··1602 0··a··1
593 1··b··2603 1··b··2
594 2··a··3604 2··a··3
  
 605 [3·rows·x·2·columns]
595 Previous·behavior:606 Previous·behavior:
596 In·[3]:·df.groupby('A',·as_index=True)['B'].nth(0)607 In·[3]:·df.groupby('A',·as_index=True)['B'].nth(0)
597 Out[3]:608 Out[3]:
598 0····1609 0····1
599 1····2610 1····2
600 Name:·B,·dtype:·int64611 Name:·B,·dtype:·int64
  
Offset 606, 21 lines modifiedOffset 618, 21 lines modified
Max diff block lines reached; 1927/5994 bytes (32.15%) of diff not shown.
2.89 KB
./usr/share/doc/python-pandas-doc/html/whatsnew/v0.24.0.html
    
Offset 820, 18 lines modifiedOffset 820, 18 lines modified
820 a·new·ndarray·of·period·objects·each·time.</p>820 a·new·ndarray·of·period·objects·each·time.</p>
821 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span>821 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[18]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span>
822 <span·class="gh">Out[18]:·</span>822 <span·class="gh">Out[18]:·</span>
823 <span·class="go">array([Period(&#39;2000-01-01&#39;,·&#39;D&#39;),·Period(&#39;2000-01-02&#39;,·&#39;D&#39;),</span>823 <span·class="go">array([Period(&#39;2000-01-01&#39;,·&#39;D&#39;),·Period(&#39;2000-01-02&#39;,·&#39;D&#39;),</span>
824 <span·class="go">·······Period(&#39;2000-01-03&#39;,·&#39;D&#39;),·Period(&#39;2000-01-04&#39;,·&#39;D&#39;)],·dtype=object)</span>824 <span·class="go">·······Period(&#39;2000-01-03&#39;,·&#39;D&#39;),·Period(&#39;2000-01-04&#39;,·&#39;D&#39;)],·dtype=object)</span>
  
825 <span·class="gp">In·[19]:·</span><span·class="nb">id</span><span·class="p">(</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span><span·class="p">)</span>825 <span·class="gp">In·[19]:·</span><span·class="nb">id</span><span·class="p">(</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span><span·class="p">)</span>
826 <span·class="gh">Out[19]:·</span><span·class="go">3773406912</span>826 <span·class="gh">Out[19]:·</span><span·class="go">3788646784</span>
  
827 <span·class="gp">In·[20]:·</span><span·class="nb">id</span><span·class="p">(</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span><span·class="p">)</span>827 <span·class="gp">In·[20]:·</span><span·class="nb">id</span><span·class="p">(</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">values</span><span·class="p">)</span>
828 <span·class="gh">Out[20]:·</span><span·class="go">3879182560</span>828 <span·class="gh">Out[20]:·</span><span·class="go">3786966512</span>
829 </pre></div>829 </pre></div>
830 </div>830 </div>
831 <p>If·you·need·an·actual·NumPy·array,·use·<a·class="reference·internal"·href="../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy"·title="pandas.Series.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Series.to_numpy()</span></code></a>·or·<code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Index.to_numpy()</span></code>.</p>831 <p>If·you·need·an·actual·NumPy·array,·use·<a·class="reference·internal"·href="../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy"·title="pandas.Series.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Series.to_numpy()</span></code></a>·or·<code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Index.to_numpy()</span></code>.</p>
832 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[21]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">to_numpy</span><span·class="p">()</span>832 <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[21]:·</span><span·class="n">idx</span><span·class="o">.</span><span·class="n">to_numpy</span><span·class="p">()</span>
833 <span·class="gh">Out[21]:·</span>833 <span·class="gh">Out[21]:·</span>
834 <span·class="go">array([Period(&#39;2000-01-01&#39;,·&#39;D&#39;),·Period(&#39;2000-01-02&#39;,·&#39;D&#39;),</span>834 <span·class="go">array([Period(&#39;2000-01-01&#39;,·&#39;D&#39;),·Period(&#39;2000-01-02&#39;,·&#39;D&#39;),</span>
835 <span·class="go">·······Period(&#39;2000-01-03&#39;,·&#39;D&#39;),·Period(&#39;2000-01-04&#39;,·&#39;D&#39;)],·dtype=object)</span>835 <span·class="go">·······Period(&#39;2000-01-03&#39;,·&#39;D&#39;),·Period(&#39;2000-01-04&#39;,·&#39;D&#39;)],·dtype=object)</span>
691 B
html2text {}
    
Offset 268, 18 lines modifiedOffset 268, 18 lines modified
268 each·time.268 each·time.
269 In·[18]:·idx.values269 In·[18]:·idx.values
270 Out[18]:270 Out[18]:
271 array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),271 array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),
272 ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)272 ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)
  
273 In·[19]:·id(idx.values)273 In·[19]:·id(idx.values)
274 Out[19]:·3773406912274 Out[19]:·3788646784
  
275 In·[20]:·id(idx.values)275 In·[20]:·id(idx.values)
276 Out[20]:·3879182560276 Out[20]:·3786966512
277 If·you·need·an·actual·NumPy·array,·use·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8)·or·Index.to_numpy().277 If·you·need·an·actual·NumPy·array,·use·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8)·or·Index.to_numpy().
278 In·[21]:·idx.to_numpy()278 In·[21]:·idx.to_numpy()
279 Out[21]:279 Out[21]:
280 array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),280 array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),
281 ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)281 ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)
  
282 In·[22]:·pd.Series(idx).to_numpy()282 In·[22]:·pd.Series(idx).to_numpy()