Offset 1, 5 lines modified | Offset 1, 5 lines modified | ||
1 | ·9 | 1 | ·9eae602a01ab857165939e86e74392d4·10533208·doc·optional·python-pandas-doc_2.1.4+dfsg-8_all.deb |
2 | ·27e041fb018ecb6d0eb852011f239167·63534660·debug·optional·python3-pandas-lib-dbgsym_2.1.4+dfsg-8_arm64.deb | 2 | ·27e041fb018ecb6d0eb852011f239167·63534660·debug·optional·python3-pandas-lib-dbgsym_2.1.4+dfsg-8_arm64.deb |
3 | ·eb80e3c3a3a6fcec33a5f0833fe48e16·6615460·python·optional·python3-pandas-lib_2.1.4+dfsg-8_arm64.deb | 3 | ·eb80e3c3a3a6fcec33a5f0833fe48e16·6615460·python·optional·python3-pandas-lib_2.1.4+dfsg-8_arm64.deb |
4 | ·98be946dcc3a490faf0f4fbc303f4b2a·3015192·python·optional·python3-pandas_2.1.4+dfsg-8_all.deb | 4 | ·98be946dcc3a490faf0f4fbc303f4b2a·3015192·python·optional·python3-pandas_2.1.4+dfsg-8_all.deb |
Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | -rw-r--r--···0········0········0········4·2024-04-21·12:50:13.000000·debian-binary | 1 | -rw-r--r--···0········0········0········4·2024-04-21·12:50:13.000000·debian-binary |
2 | -rw-r--r--···0········0········0···153776·2024-04-21·12:50:13.000000·control.tar.xz | 2 | -rw-r--r--···0········0········0···153776·2024-04-21·12:50:13.000000·control.tar.xz |
3 | -rw-r--r--···0········0········0·10379 | 3 | -rw-r--r--···0········0········0·10379240·2024-04-21·12:50:13.000000·data.tar.xz |
Offset 6536, 61 lines modified | Offset 6536, 61 lines modified | ||
6536 | -rw-r--r--···0·root·········(0)·root·········(0)···198274·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/series.html | 6536 | -rw-r--r--···0·root·········(0)·root·········(0)···198274·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/series.html |
6537 | -rw-r--r--···0·root·········(0)·root·········(0)····38687·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/style.html | 6537 | -rw-r--r--···0·root·········(0)·root·········(0)····38687·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/style.html |
6538 | -rw-r--r--···0·root·········(0)·root·········(0)····38825·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/testing.html | 6538 | -rw-r--r--···0·root·········(0)·root·········(0)····38825·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/testing.html |
6539 | -rw-r--r--···0·root·········(0)·root·········(0)····43429·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/window.html | 6539 | -rw-r--r--···0·root·········(0)·root·········(0)····43429·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reference/window.html |
6540 | -rw-r--r--···0·root·········(0)·root·········(0)······244·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/release.html | 6540 | -rw-r--r--···0·root·········(0)·root·········(0)······244·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/release.html |
6541 | -rw-r--r--···0·root·········(0)·root·········(0)······269·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reshaping.html | 6541 | -rw-r--r--···0·root·········(0)·root·········(0)······269·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/reshaping.html |
6542 | -rw-r--r--···0·root·········(0)·root·········(0)·····7354·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/search.html | 6542 | -rw-r--r--···0·root·········(0)·root·········(0)·····7354·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/search.html |
6543 | -rw-r--r--···0·root·········(0)·root·········(0)··2482 | 6543 | -rw-r--r--···0·root·········(0)·root·········(0)··2482626·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/searchindex.js |
6544 | -rw-r--r--···0·root·········(0)·root·········(0)······259·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/sparse.html | 6544 | -rw-r--r--···0·root·········(0)·root·········(0)······259·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/sparse.html |
6545 | -rw-r--r--···0·root·········(0)·root·········(0)······244·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/style.html | 6545 | -rw-r--r--···0·root·········(0)·root·········(0)······244·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/style.html |
6546 | -rw-r--r--···0·root·········(0)·root·········(0)······255·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/text.html | 6546 | -rw-r--r--···0·root·········(0)·root·········(0)······255·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/text.html |
6547 | -rw-r--r--···0·root·········(0)·root·········(0)······256·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/timedeltas.html | 6547 | -rw-r--r--···0·root·········(0)·root·········(0)······256·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/timedeltas.html |
6548 | -rw-r--r--···0·root·········(0)·root·········(0)······277·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/timeseries.html | 6548 | -rw-r--r--···0·root·········(0)·root·········(0)······277·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/timeseries.html |
6549 | -rw-r--r--···0·root·········(0)·root·········(0)······272·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/tutorials.html | 6549 | -rw-r--r--···0·root·········(0)·root·········(0)······272·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/tutorials.html |
6550 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/ | 6550 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/ |
6551 | -rw-r--r--···0·root·········(0)·root·········(0)···159472·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/10min.html | 6551 | -rw-r--r--···0·root·········(0)·root·········(0)···159472·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/10min.html |
6552 | -rw-r--r--···0·root·········(0)·root·········(0)···2731 | 6552 | -rw-r--r--···0·root·········(0)·root·········(0)···273119·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/advanced.html |
6553 | -rw-r--r--···0·root·········(0)·root·········(0)···429343·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/basics.html | 6553 | -rw-r--r--···0·root·········(0)·root·········(0)···429343·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/basics.html |
6554 | -rw-r--r--···0·root·········(0)·root·········(0)····26041·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/boolean.html | 6554 | -rw-r--r--···0·root·········(0)·root·········(0)····26041·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/boolean.html |
6555 | -rw-r--r--···0·root·········(0)·root·········(0)···207764·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/categorical.html | 6555 | -rw-r--r--···0·root·········(0)·root·········(0)···207764·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/categorical.html |
6556 | -rw-r--r--···0·root·········(0)·root·········(0)·····7742·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/cookbook.html | 6556 | -rw-r--r--···0·root·········(0)·root·········(0)·····7742·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/cookbook.html |
6557 | -rw-r--r--···0·root·········(0)·root·········(0)····43487·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/copy_on_write.html | 6557 | -rw-r--r--···0·root·········(0)·root·········(0)····43487·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/copy_on_write.html |
6558 | -rw-r--r--···0·root·········(0)·root·········(0)···150222·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/dsintro.html | 6558 | -rw-r--r--···0·root·········(0)·root·········(0)···150222·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/dsintro.html |
6559 | -rw-r--r--···0·root·········(0)·root·········(0)····69858·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/duplicates.html | 6559 | -rw-r--r--···0·root·········(0)·root·········(0)····69858·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/duplicates.html |
6560 | -rw-r--r--···0·root·········(0)·root·········(0)···1053 | 6560 | -rw-r--r--···0·root·········(0)·root·········(0)···105347·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/enhancingperf.html |
6561 | -rw-r--r--···0·root·········(0)·root·········(0)····98893·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/gotchas.html | 6561 | -rw-r--r--···0·root·········(0)·root·········(0)····98893·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/gotchas.html |
6562 | -rw-r--r--···0·root·········(0)·root·········(0)···287735·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/groupby.html | 6562 | -rw-r--r--···0·root·········(0)·root·········(0)···287735·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/groupby.html |
6563 | -rw-r--r--···0·root·········(0)·root·········(0)····49149·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/index.html | 6563 | -rw-r--r--···0·root·········(0)·root·········(0)····49149·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/index.html |
6564 | -rw-r--r--···0·root·········(0)·root·········(0)···375555·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/indexing.html | 6564 | -rw-r--r--···0·root·········(0)·root·········(0)···375555·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/indexing.html |
6565 | -rw-r--r--···0·root·········(0)·root·········(0)····31232·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/integer_na.html | 6565 | -rw-r--r--···0·root·········(0)·root·········(0)····31232·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/integer_na.html |
6566 | -rw-r--r--···0·root·········(0)·root·········(0)··1117010·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/io.html | 6566 | -rw-r--r--···0·root·········(0)·root·········(0)··1117010·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/io.html |
6567 | -rw-r--r--···0·root·········(0)·root·········(0)···207719·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/merging.html | 6567 | -rw-r--r--···0·root·········(0)·root·········(0)···207719·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/merging.html |
6568 | -rw-r--r--···0·root·········(0)·root·········(0)···153800·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/missing_data.html | 6568 | -rw-r--r--···0·root·········(0)·root·········(0)···153800·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/missing_data.html |
6569 | -rw-r--r--···0·root·········(0)·root·········(0)···101227·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/options.html | 6569 | -rw-r--r--···0·root·········(0)·root·········(0)···101227·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/options.html |
6570 | -rw-r--r--···0·root·········(0)·root·········(0)···136937·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/pyarrow.html | 6570 | -rw-r--r--···0·root·········(0)·root·········(0)···136937·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/pyarrow.html |
6571 | -rw-r--r--···0·root·········(0)·root·········(0)···152700·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/reshaping.html | 6571 | -rw-r--r--···0·root·········(0)·root·········(0)···152700·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/reshaping.html |
6572 | -rw-r--r--···0·root·········(0)·root·········(0)···15822 | 6572 | -rw-r--r--···0·root·········(0)·root·········(0)···158229·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/scale.html |
6573 | -rw-r--r--···0·root·········(0)·root·········(0)····55502·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/sparse.html | 6573 | -rw-r--r--···0·root·········(0)·root·········(0)····55502·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/sparse.html |
6574 | -rw-r--r--···0·root·········(0)·root·········(0)···694833·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.html | 6574 | -rw-r--r--···0·root·········(0)·root·········(0)···694833·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.html |
6575 | -rw-r--r--···0·root·········(0)·root·········(0)····87 | 6575 | -rw-r--r--···0·root·········(0)·root·········(0)····87900·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/style.ipynb.gz |
6576 | -rw-r--r--···0·root·········(0)·root·········(0)···155009·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/text.html | 6576 | -rw-r--r--···0·root·········(0)·root·········(0)···155009·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/text.html |
6577 | -rw-r--r--···0·root·········(0)·root·········(0)····90618·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timedeltas.html | 6577 | -rw-r--r--···0·root·········(0)·root·········(0)····90618·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timedeltas.html |
6578 | -rw-r--r--···0·root·········(0)·root·········(0)···474930·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timeseries.html | 6578 | -rw-r--r--···0·root·········(0)·root·········(0)···474930·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/timeseries.html |
6579 | -rw-r--r--···0·root·········(0)·root·········(0)···192427·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/visualization.html | 6579 | -rw-r--r--···0·root·········(0)·root·········(0)···192427·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/visualization.html |
6580 | -rw-r--r--···0·root·········(0)·root·········(0)···131402·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/window.html | 6580 | -rw-r--r--···0·root·········(0)·root·········(0)···131402·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/user_guide/window.html |
6581 | -rw-r--r--···0·root·········(0)·root·········(0)······270·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/visualization.html | 6581 | -rw-r--r--···0·root·········(0)·root·········(0)······270·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/visualization.html |
6582 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/ | 6582 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/ |
6583 | -rw-r--r--···0·root·········(0)·root·········(0)····94736·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html | 6583 | -rw-r--r--···0·root·········(0)·root·········(0)····94736·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html |
6584 | -rw-r--r--···0·root·········(0)·root·········(0)·····8504·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html.gz | 6584 | -rw-r--r--···0·root·········(0)·root·········(0)·····8504·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/index.html.gz |
6585 | -rw-r--r--···0·root·········(0)·root·········(0)····73511·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.0.html | 6585 | -rw-r--r--···0·root·········(0)·root·········(0)····73511·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.0.html |
6586 | -rw-r--r--···0·root·········(0)·root·········(0)····55915·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.1.html | 6586 | -rw-r--r--···0·root·········(0)·root·········(0)····55915·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.10.1.html |
6587 | -rw-r--r--···0·root·········(0)·root·········(0)····78522·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.11.0.html | 6587 | -rw-r--r--···0·root·········(0)·root·········(0)····78522·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.11.0.html |
6588 | -rw-r--r--···0·root·········(0)·root·········(0)····92042·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.12.0.html | 6588 | -rw-r--r--···0·root·········(0)·root·········(0)····92042·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.12.0.html |
6589 | -rw-r--r--···0·root·········(0)·root·········(0)···22238 | 6589 | -rw-r--r--···0·root·········(0)·root·········(0)···222389·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.0.html |
6590 | -rw-r--r--···0·root·········(0)·root·········(0)····78511·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.1.html | 6590 | -rw-r--r--···0·root·········(0)·root·········(0)····78511·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.13.1.html |
6591 | -rw-r--r--···0·root·········(0)·root·········(0)···229509·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.0.html | 6591 | -rw-r--r--···0·root·········(0)·root·········(0)···229509·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.0.html |
6592 | -rw-r--r--···0·root·········(0)·root·········(0)····71498·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.1.html | 6592 | -rw-r--r--···0·root·········(0)·root·········(0)····71498·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.14.1.html |
6593 | -rw-r--r--···0·root·········(0)·root·········(0)···236679·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.0.html | 6593 | -rw-r--r--···0·root·········(0)·root·········(0)···236679·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.0.html |
6594 | -rw-r--r--···0·root·········(0)·root·········(0)····57437·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.1.html | 6594 | -rw-r--r--···0·root·········(0)·root·········(0)····57437·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.1.html |
6595 | -rw-r--r--···0·root·········(0)·root·········(0)····65187·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.2.html | 6595 | -rw-r--r--···0·root·········(0)·root·········(0)····65187·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.15.2.html |
6596 | -rw-r--r--···0·root·········(0)·root·········(0)···133329·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.0.html | 6596 | -rw-r--r--···0·root·········(0)·root·········(0)···133329·2024-04-21·12:50:13.000000·./usr/share/doc/python-pandas-doc/html/whatsnew/v0.16.0.html |
Offset 20, 30 lines modified | Offset 20, 30 lines modified | ||
20 | ········], | 20 | ········], |
21 | ········"5.·If·every·byte·counts·use·string·replacement":·[ | 21 | ········"5.·If·every·byte·counts·use·string·replacement":·[ |
22 | ············[2374,·"5.-If-every-byte-counts-use-string-replacement"] | 22 | ············[2374,·"5.-If-every-byte-counts-use-string-replacement"] |
23 | ········], | 23 | ········], |
24 | ········"API·changes":·[ | 24 | ········"API·changes":·[ |
25 | ············[2431,·"api-changes"], | 25 | ············[2431,·"api-changes"], |
26 | ············[2430,·"api-changes"], | 26 | ············[2430,·"api-changes"], |
27 | ············[239 | 27 | ············[2396,·"api-changes"], |
28 | ············[2414,·"api-changes"], | ||
29 | ············[2391,·"api-changes"], | ||
30 | ············[238 | 28 | ············[2385,·"api-changes"], |
31 | ············[2386,·"api-changes"], | ||
32 | ············[2394,·"api-changes"], | ||
33 | ············[2399,·"api-changes"], | ||
34 | ············[2398,·"api-changes"], | 29 | ············[2398,·"api-changes"], |
30 | ············[2386,·"api-changes"], | ||
35 | ············[2390,·"api-changes"], | 31 | ············[2390,·"api-changes"], |
36 | ············[239 | 32 | ············[2393,·"api-changes"], |
33 | ············[2394,·"api-changes"], | ||
34 | ············[2388,·"api-changes"], | ||
35 | ············[2391,·"api-changes"], | ||
36 | ············[2414,·"api-changes"], | ||
37 | ············[2387,·"api-changes"], | 37 | ············[2387,·"api-changes"], |
38 | ············[2399,·"api-changes"], | ||
38 | ············[238 | 39 | ············[2382,·"api-changes"], |
39 | ············[2383,·"api-changes"], | ||
40 | ············[2381,·"api-changes"], | 40 | ············[2381,·"api-changes"], |
41 | ············[2384,·"api-changes"], | 41 | ············[2384,·"api-changes"], |
42 | ············[238 | 42 | ············[2383,·"api-changes"] |
43 | ········], | 43 | ········], |
44 | ········"API·changes·to·integer·indexing":·[ | 44 | ········"API·changes·to·integer·indexing":·[ |
45 | ············[2424,·"api-changes-to-integer-indexing"] | 45 | ············[2424,·"api-changes-to-integer-indexing"] |
46 | ········], | 46 | ········], |
47 | ········"API·reference":·[ | 47 | ········"API·reference":·[ |
48 | ············[2340,·"api-reference"] | 48 | ············[2340,·"api-reference"] |
49 | ········], | 49 | ········], |
Offset 126, 18 lines modified | Offset 126, 18 lines modified | ||
126 | ········"Aggregating·with·a·dict":·[ | 126 | ········"Aggregating·with·a·dict":·[ |
127 | ············[2353,·"aggregating-with-a-dict"] | 127 | ············[2353,·"aggregating-with-a-dict"] |
128 | ········], | 128 | ········], |
129 | ········"Aggregating·with·multiple·functions":·[ | 129 | ········"Aggregating·with·multiple·functions":·[ |
130 | ············[2353,·"aggregating-with-multiple-functions"] | 130 | ············[2353,·"aggregating-with-multiple-functions"] |
131 | ········], | 131 | ········], |
132 | ········"Aggregation":·[ | 132 | ········"Aggregation":·[ |
133 | ············[19,·"aggregation"], | ||
134 | ············[16,·"aggregation"], | 133 | ············[16,·"aggregation"], |
135 | ············[ | 134 | ············[19,·"aggregation"], |
136 | ············[2377,·"aggregation"] | 135 | ············[2377,·"aggregation"], |
136 | ············[2362,·"aggregation"] | ||
137 | ········], | 137 | ········], |
138 | ········"Aggregation·API":·[ | 138 | ········"Aggregation·API":·[ |
139 | ············[2353,·"aggregation-api"] | 139 | ············[2353,·"aggregation-api"] |
140 | ········], | 140 | ········], |
141 | ········"Aggregation·with·User-Defined·Functions":·[ | 141 | ········"Aggregation·with·User-Defined·Functions":·[ |
142 | ············[2362,·"aggregation-with-user-defined-functions"] | 142 | ············[2362,·"aggregation-with-user-defined-functions"] |
143 | ········], | 143 | ········], |
Offset 213, 16 lines modified | Offset 213, 16 lines modified | ||
213 | ········"Assignment·to·multiple·columns·of·a·DataFrame·when·some·columns·do·not·exist":·[ | 213 | ········"Assignment·to·multiple·columns·of·a·DataFrame·when·some·columns·do·not·exist":·[ |
214 | ············[2438,·"assignment-to-multiple-columns-of-a-dataframe-when-some-columns-do-not-exist"] | 214 | ············[2438,·"assignment-to-multiple-columns-of-a-dataframe-when-some-columns-do-not-exist"] |
215 | ········], | 215 | ········], |
216 | ········"Attribute·access":·[ | 216 | ········"Attribute·access":·[ |
217 | ············[2364,·"attribute-access"] | 217 | ············[2364,·"attribute-access"] |
218 | ········], | 218 | ········], |
219 | ········"Attributes":·[ | 219 | ········"Attributes":·[ |
220 | ············[2376,·"attributes"], | ||
221 | ············[2347,·"attributes"] | 220 | ············[2347,·"attributes"], |
221 | ············[2376,·"attributes"] | ||
222 | ········], | 222 | ········], |
223 | ········"Attributes·and·underlying·data":·[ | 223 | ········"Attributes·and·underlying·data":·[ |
224 | ············[2337,·"attributes-and-underlying-data"], | 224 | ············[2337,·"attributes-and-underlying-data"], |
225 | ············[2353,·"attributes-and-underlying-data"] | 225 | ············[2353,·"attributes-and-underlying-data"] |
226 | ········], | 226 | ········], |
227 | ········"Autocorrelation·plot":·[ | 227 | ········"Autocorrelation·plot":·[ |
228 | ············[2378,·"autocorrelation-plot"] | 228 | ············[2378,·"autocorrelation-plot"] |
Offset 263, 31 lines modified | Offset 263, 31 lines modified | ||
263 | ········"Backward·resample":·[ | 263 | ········"Backward·resample":·[ |
264 | ············[2377,·"backward-resample"] | 264 | ············[2377,·"backward-resample"] |
265 | ········], | 265 | ········], |
266 | ········"Backwards·compatibility":·[ | 266 | ········"Backwards·compatibility":·[ |
267 | ············[2,·"backwards-compatibility"] | 267 | ············[2,·"backwards-compatibility"] |
268 | ········], | 268 | ········], |
269 | ········"Backwards·incompatible·API·changes":·[ | 269 | ········"Backwards·incompatible·API·changes":·[ |
270 | ············[2450,·"backwards-incompatible-api-changes"], | ||
271 | ············[2469,·"backwards-incompatible-api-changes"], | ||
272 | ············[2461,·"backwards-incompatible-api-changes"], | ||
270 | ············[2456,·"backwards-incompatible-api-changes"], | 273 | ············[2456,·"backwards-incompatible-api-changes"], |
271 | ············[2432,·"backwards-incompatible-api-changes"], | 274 | ············[2432,·"backwards-incompatible-api-changes"], |
272 | ············[2450,·"backwards-incompatible-api-changes"], | ||
273 | ············[2465,·"backwards-incompatible-api-changes"], | 275 | ············[2465,·"backwards-incompatible-api-changes"], |
274 | ············[2469,·"backwards-incompatible-api-changes"], | ||
275 | ············[2438,·"backwards-incompatible-api-changes"], | 276 | ············[2438,·"backwards-incompatible-api-changes"], |
276 | ············[2461,·"backwards-incompatible-api-changes"], | ||
277 | ············[2416,·"backwards-incompatible-api-changes"], | ||
278 | ············[2397,·"backwards-incompatible-api-changes"], | ||
279 | ············[2407,·"backwards-incompatible-api-changes"], | ||
280 | ············[2392,·"backwards-incompatible-api-changes"], | 277 | ············[2392,·"backwards-incompatible-api-changes"], |
281 | ············[2389,·"backwards-incompatible-api-changes"], | ||
282 | ············[24 | 278 | ············[2416,·"backwards-incompatible-api-changes"], |
283 | ············[2402,·"backwards-incompatible-api-changes"], | 279 | ············[2402,·"backwards-incompatible-api-changes"], |
284 | ············[2395,·"backwards-incompatible-api-changes"], | 280 | ············[2395,·"backwards-incompatible-api-changes"], |
285 | ············[24 | 281 | ············[2408,·"backwards-incompatible-api-changes"], |
282 | ············[2397,·"backwards-incompatible-api-changes"], | ||
283 | ············[2389,·"backwards-incompatible-api-changes"], | ||
284 | ············[2407,·"backwards-incompatible-api-changes"], | ||
286 | ············[2405,·"backwards-incompatible-api-changes"] | 285 | ············[2405,·"backwards-incompatible-api-changes"], |
286 | ············[2413,·"backwards-incompatible-api-changes"] | ||
287 | ········], | 287 | ········], |
288 | ········"Bar·charts":·[ | 288 | ········"Bar·charts":·[ |
289 | ············[2374,·"Bar-charts"] | 289 | ············[2374,·"Bar-charts"] |
290 | ········], | 290 | ········], |
291 | ········"Bar·plots":·[ | 291 | ········"Bar·plots":·[ |
292 | ············[2378,·"bar-plots"] | 292 | ············[2378,·"bar-plots"] |
293 | ········], | 293 | ········], |
Offset 353, 16 lines modified | Offset 353, 16 lines modified | ||
353 | ········"Bitwise·boolean":·[ | 353 | ········"Bitwise·boolean":·[ |
354 | ············[2361,·"bitwise-boolean"] | 354 | ············[2361,·"bitwise-boolean"] |
355 | ········], | 355 | ········], |
356 | ········"Boolean·data·type·with·missing·values·support":·[ | 356 | ········"Boolean·data·type·with·missing·values·support":·[ |
357 | ············[2432,·"boolean-data-type-with-missing-values-support"] | 357 | ············[2432,·"boolean-data-type-with-missing-values-support"] |
358 | ········], | 358 | ········], |
359 | ········"Boolean·indexing":·[ | 359 | ········"Boolean·indexing":·[ |
360 | ············[2351,·"boolean-indexing"], | ||
361 | ············[2364,·"boolean-indexing"] | 360 | ············[2364,·"boolean-indexing"], |
361 | ············[2351,·"boolean-indexing"] | ||
362 | ········], | 362 | ········], |
363 | ········"Boolean·operators":·[ | 363 | ········"Boolean·operators":·[ |
364 | ············[2364,·"boolean-operators"] | 364 | ············[2364,·"boolean-operators"] |
Max diff block lines reached; 152385/157817 bytes (96.56%) of diff not shown. |
Offset 1849, 25 lines modified | Offset 1849, 25 lines modified | ||
1849 | <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> | 1849 | <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> |
1850 | <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> | 1850 | <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> |
1851 | <span·class="gp">In·[143]:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr[indexer] | 1851 | <span·class="gp">In·[143]:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr[indexer] |
1852 | <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr.take(indexer,·axis=0) | 1852 | <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·arr.take(indexer,·axis=0) |
1853 | <span·class="gp">···.....:·</span> | 1853 | <span·class="gp">···.....:·</span> |
1854 | <span·class="go">698·us·+-·84.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> | ||
1854 | <span·class="go">2 | 1855 | <span·class="go">210·us·+-·43·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> |
1855 | <span·class="go">77.8·us·+-·231·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each)</span> | ||
1856 | </pre></div> | 1856 | </pre></div> |
1857 | </div> | 1857 | </div> |
1858 | <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> | 1858 | <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> |
1859 | <span·class="gp">In·[145]:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.iloc[indexer] | 1859 | <span·class="gp">In·[145]:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.iloc[indexer] |
1860 | <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.take(indexer) | 1860 | <span·class="gp">···.....:·</span><span·class="o">%</span><span·class="k">timeit</span>·ser.take(indexer) |
1861 | <span·class="gp">···.....:·</span> | 1861 | <span·class="gp">···.....:·</span> |
1862 | <span·class="go"> | 1862 | <span·class="go">501·us·+-·70.5·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> |
1863 | <span·class="go"> | 1863 | <span·class="go">388·us·+-·86.5·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> |
1864 | </pre></div> | 1864 | </pre></div> |
1865 | </div> | 1865 | </div> |
1866 | </section> | 1866 | </section> |
1867 | <section·id="index-types"> | 1867 | <section·id="index-types"> |
1868 | <span·id="advanced-index-types"></span><h2>Index·types<a·class="headerlink"·href="#index-types"·title="Link·to·this·heading">¶</a></h2> | 1868 | <span·id="advanced-index-types"></span><h2>Index·types<a·class="headerlink"·href="#index-types"·title="Link·to·this·heading">¶</a></h2> |
1869 | <p>We·have·discussed·<code·class="docutils·literal·notranslate"><span·class="pre">MultiIndex</span></code>·in·the·previous·sections·pretty·extensively. | 1869 | <p>We·have·discussed·<code·class="docutils·literal·notranslate"><span·class="pre">MultiIndex</span></code>·in·the·previous·sections·pretty·extensively. |
1870 | 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>, | 1870 | 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>, |
Offset 1256, 23 lines modified | Offset 1256, 23 lines modified | ||
1256 | In·[141]:·indexer·=·np.arange(10000) | 1256 | In·[141]:·indexer·=·np.arange(10000) |
1257 | In·[142]:·random.shuffle(indexer) | 1257 | In·[142]:·random.shuffle(indexer) |
1258 | In·[143]:·%timeit·arr[indexer] | 1258 | In·[143]:·%timeit·arr[indexer] |
1259 | ···.....:·%timeit·arr.take(indexer,·axis=0) | 1259 | ···.....:·%timeit·arr.take(indexer,·axis=0) |
1260 | ···.....: | 1260 | ···.....: |
1261 | 698·us·+-·84.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) | ||
1261 | 2 | 1262 | 210·us·+-·43·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) |
1262 | 77.8·us·+-·231·ns·per·loop·(mean·+-·std.·dev.·of·7·runs,·10,000·loops·each) | ||
1263 | In·[144]:·ser·=·pd.Series(arr[:,·0]) | 1263 | In·[144]:·ser·=·pd.Series(arr[:,·0]) |
1264 | In·[145]:·%timeit·ser.iloc[indexer] | 1264 | In·[145]:·%timeit·ser.iloc[indexer] |
1265 | ···.....:·%timeit·ser.take(indexer) | 1265 | ···.....:·%timeit·ser.take(indexer) |
1266 | ···.....: | 1266 | ···.....: |
1267 | 1267 | 501·us·+-·70.5·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) | |
1268 | 1268 | 388·us·+-·86.5·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) | |
1269 | *\x8**\x8**\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8x·t\x8ty\x8yp\x8pe\x8es\x8s_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* | 1269 | *\x8**\x8**\x8**\x8**\x8*·I\x8In\x8nd\x8de\x8ex\x8x·t\x8ty\x8yp\x8pe\x8es\x8s_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* |
1270 | We·have·discussed·MultiIndex·in·the·previous·sections·pretty·extensively. | 1270 | We·have·discussed·MultiIndex·in·the·previous·sections·pretty·extensively. |
1271 | Documentation·about·DatetimeIndex·and·PeriodIndex·are·shown·_\x8h_\x8e_\x8r_\x8e,·and | 1271 | Documentation·about·DatetimeIndex·and·PeriodIndex·are·shown·_\x8h_\x8e_\x8r_\x8e,·and |
1272 | documentation·about·TimedeltaIndex·is·found·_\x8h_\x8e_\x8r_\x8e. | 1272 | documentation·about·TimedeltaIndex·is·found·_\x8h_\x8e_\x8r_\x8e. |
1273 | In·the·following·sub-sections·we·will·highlight·some·other·index·types. | 1273 | In·the·following·sub-sections·we·will·highlight·some·other·index·types. |
1274 | *\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* | 1274 | *\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* |
1275 | _\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 | 1275 | _\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 |
Offset 529, 31 lines modified | Offset 529, 31 lines modified | ||
529 | <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> | 529 | <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> |
530 | <span·class="gp">···...:·</span>····<span·class="k">return</span>·<span·class="n">s</span>·<span·class="o">*</span>·<span·class="n">dx</span> | 530 | <span·class="gp">···...:·</span>····<span·class="k">return</span>·<span·class="n">s</span>·<span·class="o">*</span>·<span·class="n">dx</span> |
531 | <span·class="gp">···...:·</span> | 531 | <span·class="gp">···...:·</span> |
532 | </pre></div> | 532 | </pre></div> |
533 | </div> | 533 | </div> |
534 | <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> | 534 | <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> |
535 | <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["a"],·x["b"],·x["N"]),·axis=1) | 535 | <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["a"],·x["b"],·x["N"]),·axis=1) |
536 | <span·class="go"> | 536 | <span·class="go">150·ms·+-·38.7·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span> |
537 | </pre></div> | 537 | </pre></div> |
538 | </div> | 538 | </div> |
539 | <p>Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation | 539 | <p>Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation |
540 | using·the·<a·class="reference·external"·href="https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun">prun·ipython·magic·function</a>:</p> | 540 | using·the·<a·class="reference·external"·href="https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun">prun·ipython·magic·function</a>:</p> |
541 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·most·time·consuming·4·calls</span> | 541 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·most·time·consuming·4·calls</span> |
542 | <span·class="gp">In·[6]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1)··#·noqa·E999 | 542 | <span·class="gp">In·[6]:·</span><span·class="o">%</span><span·class="k">prun</span>·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1)··#·noqa·E999 |
543 | <span·class="go">·········605963·function·calls·(605945·primitive·calls)·in·0.3 | 543 | <span·class="go">·········605963·function·calls·(605945·primitive·calls)·in·0.318·seconds</span> |
544 | <span·class="go">···Ordered·by:·internal·time</span> | 544 | <span·class="go">···Ordered·by:·internal·time</span> |
545 | <span·class="go">···List·reduced·from·167·to·4·due·to·restriction·<4></span> | 545 | <span·class="go">···List·reduced·from·167·to·4·due·to·restriction·<4></span> |
546 | <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span> | 546 | <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span> |
547 | <span·class="go">·····1000····0. | 547 | <span·class="go">·····1000····0.206····0.000····0.288····0.000·<ipython-input-4-c2a74e076cf0>:1(integrate_f)</span> |
548 | <span·class="go">···552423····0.08 | 548 | <span·class="go">···552423····0.082····0.000····0.082····0.000·<ipython-input-3-c138bdd570e3>:1(f)</span> |
549 | <span·class="go">·····3000····0.005····0.000····0.0 | 549 | <span·class="go">·····3000····0.005····0.000····0.020····0.000·series.py:1016(__getitem__)</span> |
550 | <span·class="go">·····3000····0.003····0.000····0.00 | 550 | <span·class="go">·····3000····0.003····0.000····0.009····0.000·series.py:1139(_get_value)</span> |
551 | </pre></div> | 551 | </pre></div> |
552 | </div> | 552 | </div> |
553 | <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>, | 553 | <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>, |
554 | hence·we’ll·concentrate·our·efforts·cythonizing·these·two·functions.</p> | 554 | hence·we’ll·concentrate·our·efforts·cythonizing·these·two·functions.</p> |
555 | </section> | 555 | </section> |
556 | <section·id="plain-cython"> | 556 | <section·id="plain-cython"> |
557 | <span·id="enhancingperf-plain"></span><h3>Plain·Cython<a·class="headerlink"·href="#plain-cython"·title="Link·to·this·heading">¶</a></h3> | 557 | <span·id="enhancingperf-plain"></span><h3>Plain·Cython<a·class="headerlink"·href="#plain-cython"·title="Link·to·this·heading">¶</a></h3> |
Offset 571, 15 lines modified | Offset 571, 15 lines modified | ||
571 | <span·class="gp">···...:·</span>····for·i·in·range(N): | 571 | <span·class="gp">···...:·</span>····for·i·in·range(N): |
572 | <span·class="gp">···...:·</span>········s·+=·f_plain(a·+·i·*·dx) | 572 | <span·class="gp">···...:·</span>········s·+=·f_plain(a·+·i·*·dx) |
573 | <span·class="gp">···...:·</span>····return·s·*·dx | 573 | <span·class="gp">···...:·</span>····return·s·*·dx |
574 | <span·class="gp">···...:·</span> | 574 | <span·class="gp">···...:·</span> |
575 | </pre></div> | 575 | </pre></div> |
576 | </div> | 576 | </div> |
577 | <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["a"],·x["b"],·x["N"]),·axis=1) | 577 | <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["a"],·x["b"],·x["N"]),·axis=1) |
578 | <span·class="go"> | 578 | <span·class="go">143·ms·+-·36·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span> |
579 | </pre></div> | 579 | </pre></div> |
580 | </div> | 580 | </div> |
581 | <p>This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-third.</p> | 581 | <p>This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one-third.</p> |
582 | </section> | 582 | </section> |
583 | <section·id="declaring-c-types"> | 583 | <section·id="declaring-c-types"> |
584 | <span·id="enhancingperf-type"></span><h3>Declaring·C·types<a·class="headerlink"·href="#declaring-c-types"·title="Link·to·this·heading">¶</a></h3> | 584 | <span·id="enhancingperf-type"></span><h3>Declaring·C·types<a·class="headerlink"·href="#declaring-c-types"·title="Link·to·this·heading">¶</a></h3> |
585 | <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> | 585 | <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 595, 36 lines modified | Offset 595, 36 lines modified | ||
595 | <span·class="gp">···....:·</span>····for·i·in·range(N): | 595 | <span·class="gp">···....:·</span>····for·i·in·range(N): |
596 | <span·class="gp">···....:·</span>········s·+=·f_typed(a·+·i·*·dx) | 596 | <span·class="gp">···....:·</span>········s·+=·f_typed(a·+·i·*·dx) |
597 | <span·class="gp">···....:·</span>····return·s·*·dx | 597 | <span·class="gp">···....:·</span>····return·s·*·dx |
598 | <span·class="gp">···....:·</span> | 598 | <span·class="gp">···....:·</span> |
599 | </pre></div> | 599 | </pre></div> |
600 | </div> | 600 | </div> |
601 | <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["a"],·x["b"],·x["N"]),·axis=1) | 601 | <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["a"],·x["b"],·x["N"]),·axis=1) |
602 | <span·class="go">1 | 602 | <span·class="go">15.7·ms·+-·4.25·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span> |
603 | </pre></div> | 603 | </pre></div> |
604 | </div> | 604 | </div> |
605 | <p>Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance·improvement·compared·to | 605 | <p>Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance·improvement·compared·to |
606 | the·original·Python·implementation.</p> | 606 | the·original·Python·implementation.</p> |
607 | </section> | 607 | </section> |
608 | <section·id="using-ndarray"> | 608 | <section·id="using-ndarray"> |
609 | <span·id="enhancingperf-ndarray"></span><h3>Using·ndarray<a·class="headerlink"·href="#using-ndarray"·title="Link·to·this·heading">¶</a></h3> | 609 | <span·id="enhancingperf-ndarray"></span><h3>Using·ndarray<a·class="headerlink"·href="#using-ndarray"·title="Link·to·this·heading">¶</a></h3> |
610 | <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 | 610 | <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 |
611 | the·index·and·the·series·(three·times·for·each·row).·These·Python·function·calls·are·expensive·and | 611 | the·index·and·the·series·(three·times·for·each·row).·These·Python·function·calls·are·expensive·and |
612 | can·be·improved·by·passing·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>.</p> | 612 | can·be·improved·by·passing·an·<code·class="docutils·literal·notranslate"><span·class="pre">np.ndarray</span></code>.</p> |
613 | <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["a"],·x["b"],·x["N"]),·axis=1) | 613 | <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["a"],·x["b"],·x["N"]),·axis=1) |
614 | <span·class="go">·········52540·function·calls·(52522·primitive·calls)·in·0.0 | 614 | <span·class="go">·········52540·function·calls·(52522·primitive·calls)·in·0.058·seconds</span> |
615 | <span·class="go">···Ordered·by:·internal·time</span> | 615 | <span·class="go">···Ordered·by:·internal·time</span> |
616 | <span·class="go">···List·reduced·from·165·to·4·due·to·restriction·<4></span> | 616 | <span·class="go">···List·reduced·from·165·to·4·due·to·restriction·<4></span> |
617 | <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span> | 617 | <span·class="go">···ncalls··tottime··percall··cumtime··percall·filename:lineno(function)</span> |
618 | <span·class="go">·····3000····0.0 | 618 | <span·class="go">·····3000····0.011····0.000····0.016····0.000·indexing.py:2678(check_dict_or_set_indexers)</span> |
619 | <span·class="go">·····1000····0.010····0.000····0.049····0.000·<string>:1(<lambda>)</span> | ||
619 | <span·class="go">·····3000····0.00 | 620 | <span·class="go">·····3000····0.007····0.000····0.017····0.000·series.py:1139(_get_value)</span> |
620 | <span·class="go">·····3000····0.003····0.000····0.004····0.000·indexing.py:2678(check_dict_or_set_indexers)</span> | ||
621 | <span·class="go">·····3000····0.00 | 621 | <span·class="go">·····3000····0.007····0.000····0.007····0.000·base.py:3763(get_loc)</span> |
622 | </pre></div> | 622 | </pre></div> |
623 | </div> | 623 | </div> |
624 | <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> | 624 | <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> |
625 | <span·class="gp">···....:·</span>cimport·numpy·as·np | 625 | <span·class="gp">···....:·</span>cimport·numpy·as·np |
626 | <span·class="gp">···....:·</span>import·numpy·as·np | 626 | <span·class="gp">···....:·</span>import·numpy·as·np |
627 | <span·class="gp">···....:·</span>cdef·double·f_typed(double·x)·except?·-2: | 627 | <span·class="gp">···....:·</span>cdef·double·f_typed(double·x)·except?·-2: |
628 | <span·class="gp">···....:·</span>····return·x·*·(x·-·1) | 628 | <span·class="gp">···....:·</span>····return·x·*·(x·-·1) |
Offset 659, 15 lines modified | Offset 659, 15 lines modified | ||
659 | </div> | 659 | </div> |
660 | <p>This·implementation·creates·an·array·of·zeros·and·inserts·the·result | 660 | <p>This·implementation·creates·an·array·of·zeros·and·inserts·the·result |
661 | 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 | 661 | 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 |
662 | 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> | 662 | 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> |
663 | <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> | 663 | <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> |
664 | calls·are·needed·to·utilize·this·function.</p> | 664 | calls·are·needed·to·utilize·this·function.</p> |
665 | <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["a"].to_numpy(),·df["b"].to_numpy(),·df["N"].to_numpy()) | 665 | <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["a"].to_numpy(),·df["b"].to_numpy(),·df["N"].to_numpy()) |
666 | <span·class="go"> | 666 | <span·class="go">2.33·ms·+-·495·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each)</span> |
667 | </pre></div> | 667 | </pre></div> |
668 | </div> | 668 | </div> |
669 | <p>Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.</p> | 669 | <p>Performance·has·improved·from·the·prior·implementation·by·almost·ten·times.</p> |
670 | </section> | 670 | </section> |
671 | <section·id="disabling-compiler-directives"> | 671 | <section·id="disabling-compiler-directives"> |
672 | <span·id="enhancingperf-boundswrap"></span><h3>Disabling·compiler·directives<a·class="headerlink"·href="#disabling-compiler-directives"·title="Link·to·this·heading">¶</a></h3> | 672 | <span·id="enhancingperf-boundswrap"></span><h3>Disabling·compiler·directives<a·class="headerlink"·href="#disabling-compiler-directives"·title="Link·to·this·heading">¶</a></h3> |
673 | <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> | 673 | <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> |
Offset 678, 15 lines modified | Offset 678, 15 lines modified | ||
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·20·to·4·due·to·restriction·<4></span> | 679 | <span·class="go">···List·reduced·from·20·to·4·due·to·restriction·<4></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">········1····0.001····0.001····0.001····0.001·<string>:1(<module>)</span> | 681 | <span·class="go">········1····0.001····0.001····0.001····0.001·<string>:1(<module>)</span> |
682 | <span·class="go">········1····0.000····0.000····0.001····0.001·{built-in·method·builtins.exec}</span> | 682 | <span·class="go">········1····0.000····0.000····0.001····0.001·{built-in·method·builtins.exec}</span> |
683 | <span·class="go">········3····0.000····0.000····0.000····0.000·frame.py:3853(__getitem__)</span> | 683 | <span·class="go">········3····0.000····0.000····0.000····0.000·frame.py:3853(__getitem__)</span> |
684 | <span·class="go">········3····0.000····0.000····0.000····0.000· | 684 | <span·class="go">········3····0.000····0.000····0.000····0.000·base.py:541(to_numpy)</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·[16]:·</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·[16]:·</span><span·class="o">%%</span><span·class="k">cython</span> |
688 | <span·class="gp">···....:·</span>cimport·cython | 688 | <span·class="gp">···....:·</span>cimport·cython |
689 | <span·class="gp">···....:·</span>cimport·numpy·as·np | 689 | <span·class="gp">···....:·</span>cimport·numpy·as·np |
690 | <span·class="gp">···....:·</span>import·numpy·as·np | 690 | <span·class="gp">···....:·</span>import·numpy·as·np |
691 | <span·class="gp">···....:·</span>cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2: | 691 | <span·class="gp">···....:·</span>cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2: |
Offset 719, 15 lines modified | Offset 719, 15 lines modified | ||
719 | <span·class="go">·················from·/build/reproducible-path/pandas-2.1.4+dfsg/buildtmp/.cache/ipython/cython/_cython_magic_dbd2f2be48d2a3825f8cbd16b561de5210461988.c:1251:</span> | 719 | <span·class="go">·················from·/build/reproducible-path/pandas-2.1.4+dfsg/buildtmp/.cache/ipython/cython/_cython_magic_dbd2f2be48d2a3825f8cbd16b561de5210461988.c:1251:</span> |
720 | <span·class="go">/usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2:·warning:·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·"#define·NPY_NO_DEPRECATED_API·NPY_1_7_API_VERSION"·[-Wcpp]</span> | 720 | <span·class="go">/usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2:·warning:·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·"#define·NPY_NO_DEPRECATED_API·NPY_1_7_API_VERSION"·[-Wcpp]</span> |
721 | <span·class="go">···17·|·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·\</span> | 721 | <span·class="go">···17·|·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·\</span> |
722 | <span·class="go">······|··^~~~~~~</span> | 722 | <span·class="go">······|··^~~~~~~</span> |
723 | </pre></div> | 723 | </pre></div> |
724 | </div> | 724 | </div> |
725 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="o">%</span><span·class="k">timeit</span>·apply_integrate_f_wrap(df["a"].to_numpy(),·df["b"].to_numpy(),·df["N"].to_numpy()) | 725 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[17]:·</span><span·class="o">%</span><span·class="k">timeit</span>·apply_integrate_f_wrap(df["a"].to_numpy(),·df["b"].to_numpy(),·df["N"].to_numpy()) |
726 | <span·class="go">1. | 726 | <span·class="go">1.26·ms·+-·286·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each)</span> |
727 | </pre></div> | 727 | </pre></div> |
Max diff block lines reached; 8929/21902 bytes (40.77%) of diff not shown. |
Offset 113, 32 lines modified | Offset 113, 32 lines modified | ||
113 | ···...:·····dx·=·(b·-·a)·/·N | 113 | ···...:·····dx·=·(b·-·a)·/·N |
114 | ···...:·····for·i·in·range(N): | 114 | ···...:·····for·i·in·range(N): |
115 | ···...:·········s·+=·f(a·+·i·*·dx) | 115 | ···...:·········s·+=·f(a·+·i·*·dx) |
116 | ···...:·····return·s·*·dx | 116 | ···...:·····return·s·*·dx |
117 | ···...: | 117 | ···...: |
118 | 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): | 118 | 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): |
119 | In·[5]:·%timeit·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1) | 119 | In·[5]:·%timeit·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]),·axis=1) |
120 | 120 | 150·ms·+-·38.7·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each) | |
121 | Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation·using | 121 | Let’s·take·a·look·and·see·where·the·time·is·spent·during·this·operation·using |
122 | 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: | 122 | 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: |
123 | #·most·time·consuming·4·calls | 123 | #·most·time·consuming·4·calls |
124 | In·[6]:·%prun·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]), | 124 | In·[6]:·%prun·-l·4·df.apply(lambda·x:·integrate_f(x["a"],·x["b"],·x["N"]), |
125 | axis=1)··#·noqa·E999 | 125 | axis=1)··#·noqa·E999 |
126 | ·········605963·function·calls·(605945·primitive·calls)·in·0.3 | 126 | ·········605963·function·calls·(605945·primitive·calls)·in·0.318·seconds |
127 | ···Ordered·by:·internal·time | 127 | ···Ordered·by:·internal·time |
128 | ···List·reduced·from·167·to·4·due·to·restriction·<4> | 128 | ···List·reduced·from·167·to·4·due·to·restriction·<4> |
129 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) | 129 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) |
130 | ·····1000····0. | 130 | ·····1000····0.206····0.000····0.288····0.000·<ipython-input-4-c2a74e076cf0>:1 |
131 | (integrate_f) | 131 | (integrate_f) |
132 | ···552423····0.08 | 132 | ···552423····0.082····0.000····0.082····0.000·<ipython-input-3-c138bdd570e3>:1 |
133 | (f) | 133 | (f) |
134 | ·····3000····0.005····0.000····0.0 | 134 | ·····3000····0.005····0.000····0.020····0.000·series.py:1016(__getitem__) |
135 | ·····3000····0.003····0.000····0.00 | 135 | ·····3000····0.003····0.000····0.009····0.000·series.py:1139(_get_value) |
136 | By·far·the·majority·of·time·is·spend·inside·either·integrate_f·or·f,·hence | 136 | By·far·the·majority·of·time·is·spend·inside·either·integrate_f·or·f,·hence |
137 | we’ll·concentrate·our·efforts·cythonizing·these·two·functions. | 137 | we’ll·concentrate·our·efforts·cythonizing·these·two·functions. |
138 | *\x8**\x8**\x8**\x8*·P\x8Pl\x8la\x8ai\x8in\x8n·C\x8Cy\x8yt\x8th\x8ho\x8on\x8n_\x8?\x8¶·*\x8**\x8**\x8**\x8* | 138 | *\x8**\x8**\x8**\x8*·P\x8Pl\x8la\x8ai\x8in\x8n·C\x8Cy\x8yt\x8th\x8ho\x8on\x8n_\x8?\x8¶·*\x8**\x8**\x8**\x8* |
139 | First·we’re·going·to·need·to·import·the·Cython·magic·function·to·IPython: | 139 | First·we’re·going·to·need·to·import·the·Cython·magic·function·to·IPython: |
140 | In·[7]:·%load_ext·Cython | 140 | In·[7]:·%load_ext·Cython |
141 | Now,·let’s·simply·copy·our·functions·over·to·Cython: | 141 | Now,·let’s·simply·copy·our·functions·over·to·Cython: |
142 | In·[8]:·%%cython | 142 | In·[8]:·%%cython |
Offset 149, 15 lines modified | Offset 149, 15 lines modified | ||
149 | ···...:·····dx·=·(b·-·a)·/·N | 149 | ···...:·····dx·=·(b·-·a)·/·N |
150 | ···...:·····for·i·in·range(N): | 150 | ···...:·····for·i·in·range(N): |
151 | ···...:·········s·+=·f_plain(a·+·i·*·dx) | 151 | ···...:·········s·+=·f_plain(a·+·i·*·dx) |
152 | ···...:·····return·s·*·dx | 152 | ···...:·····return·s·*·dx |
153 | ···...: | 153 | ···...: |
154 | In·[9]:·%timeit·df.apply(lambda·x:·integrate_f_plain(x["a"],·x["b"],·x["N"]), | 154 | In·[9]:·%timeit·df.apply(lambda·x:·integrate_f_plain(x["a"],·x["b"],·x["N"]), |
155 | axis=1) | 155 | axis=1) |
156 | 156 | 143·ms·+-·36·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each) | |
157 | This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one- | 157 | This·has·improved·the·performance·compared·to·the·pure·Python·approach·by·one- |
158 | third. | 158 | third. |
159 | *\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* | 159 | *\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* |
160 | We·can·annotate·the·function·variables·and·return·types·as·well·as·use·cdef·and | 160 | We·can·annotate·the·function·variables·and·return·types·as·well·as·use·cdef·and |
161 | cpdef·to·improve·performance: | 161 | cpdef·to·improve·performance: |
162 | In·[10]:·%%cython | 162 | In·[10]:·%%cython |
163 | ···....:·cdef·double·f_typed(double·x)·except?·-2: | 163 | ···....:·cdef·double·f_typed(double·x)·except?·-2: |
Offset 169, 35 lines modified | Offset 169, 35 lines modified | ||
169 | ···....:·····dx·=·(b·-·a)·/·N | 169 | ···....:·····dx·=·(b·-·a)·/·N |
170 | ···....:·····for·i·in·range(N): | 170 | ···....:·····for·i·in·range(N): |
171 | ···....:·········s·+=·f_typed(a·+·i·*·dx) | 171 | ···....:·········s·+=·f_typed(a·+·i·*·dx) |
172 | ···....:·····return·s·*·dx | 172 | ···....:·····return·s·*·dx |
173 | ···....: | 173 | ···....: |
174 | In·[11]:·%timeit·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x["N"]), | 174 | In·[11]:·%timeit·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x["N"]), |
175 | axis=1) | 175 | axis=1) |
176 | 1 | 176 | 15.7·ms·+-·4.25·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each) |
177 | Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance | 177 | Annotating·the·functions·with·C·types·yields·an·over·ten·times·performance |
178 | improvement·compared·to·the·original·Python·implementation. | 178 | improvement·compared·to·the·original·Python·implementation. |
179 | *\x8**\x8**\x8**\x8*·U\x8Us\x8si\x8in\x8ng\x8g·n\x8nd\x8da\x8ar\x8rr\x8ra\x8ay\x8y_\x8?\x8¶·*\x8**\x8**\x8**\x8* | 179 | *\x8**\x8**\x8**\x8*·U\x8Us\x8si\x8in\x8ng\x8g·n\x8nd\x8da\x8ar\x8rr\x8ra\x8ay\x8y_\x8?\x8¶·*\x8**\x8**\x8**\x8* |
180 | When·re-profiling,·time·is·spent·creating·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·from·each·row,·and·calling | 180 | When·re-profiling,·time·is·spent·creating·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·from·each·row,·and·calling |
181 | __getitem__·from·both·the·index·and·the·series·(three·times·for·each·row). | 181 | __getitem__·from·both·the·index·and·the·series·(three·times·for·each·row). |
182 | These·Python·function·calls·are·expensive·and·can·be·improved·by·passing·an | 182 | These·Python·function·calls·are·expensive·and·can·be·improved·by·passing·an |
183 | np.ndarray. | 183 | np.ndarray. |
184 | In·[12]:·%prun·-l·4·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x | 184 | In·[12]:·%prun·-l·4·df.apply(lambda·x:·integrate_f_typed(x["a"],·x["b"],·x |
185 | ["N"]),·axis=1) | 185 | ["N"]),·axis=1) |
186 | ·········52540·function·calls·(52522·primitive·calls)·in·0.0 | 186 | ·········52540·function·calls·(52522·primitive·calls)·in·0.058·seconds |
187 | ···Ordered·by:·internal·time | 187 | ···Ordered·by:·internal·time |
188 | ···List·reduced·from·165·to·4·due·to·restriction·<4> | 188 | ···List·reduced·from·165·to·4·due·to·restriction·<4> |
189 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) | 189 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) |
190 | ·····3000····0.005····0.000····0.018····0.000·series.py:1016(__getitem__) | ||
191 | ·····3000····0.003····0.000····0.008····0.000·series.py:1139(_get_value) | ||
192 | ·····3000····0.0 | 190 | ·····3000····0.011····0.000····0.016····0.000·indexing.py:2678 |
193 | (check_dict_or_set_indexers) | 191 | (check_dict_or_set_indexers) |
192 | ·····1000····0.010····0.000····0.049····0.000·<string>:1(<lambda>) | ||
193 | ·····3000····0.007····0.000····0.017····0.000·series.py:1139(_get_value) | ||
194 | ·····3000····0.00 | 194 | ·····3000····0.007····0.000····0.007····0.000·base.py:3763(get_loc) |
195 | In·[13]:·%%cython | 195 | In·[13]:·%%cython |
196 | ···....:·cimport·numpy·as·np | 196 | ···....:·cimport·numpy·as·np |
197 | ···....:·import·numpy·as·np | 197 | ···....:·import·numpy·as·np |
198 | ···....:·cdef·double·f_typed(double·x)·except?·-2: | 198 | ···....:·cdef·double·f_typed(double·x)·except?·-2: |
199 | ···....:·····return·x·*·(x·-·1) | 199 | ···....:·····return·x·*·(x·-·1) |
200 | ···....:·cpdef·double·integrate_f_typed(double·a,·double·b,·int·N): | 200 | ···....:·cpdef·double·integrate_f_typed(double·a,·double·b,·int·N): |
201 | ···....:·····cdef·int·i | 201 | ···....:·····cdef·int·i |
Offset 238, 15 lines modified | Offset 238, 15 lines modified | ||
238 | This·implementation·creates·an·array·of·zeros·and·inserts·the·result·of | 238 | This·implementation·creates·an·array·of·zeros·and·inserts·the·result·of |
239 | integrate_f_typed·applied·over·each·row.·Looping·over·an·ndarray·is·faster·in | 239 | integrate_f_typed·applied·over·each·row.·Looping·over·an·ndarray·is·faster·in |
240 | Cython·than·looping·over·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·object. | 240 | Cython·than·looping·over·a·_\x8S_\x8e_\x8r_\x8i_\x8e_\x8s·object. |
241 | 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 | 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) |
242 | calls·are·needed·to·utilize·this·function. | 242 | calls·are·needed·to·utilize·this·function. |
243 | In·[14]:·%timeit·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),·df | 243 | In·[14]:·%timeit·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(),·df |
244 | ["N"].to_numpy()) | 244 | ["N"].to_numpy()) |
245 | 245 | 2.33·ms·+-·495·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·100·loops·each) | |
246 | Performance·has·improved·from·the·prior·implementation·by·almost·ten·times. | 246 | Performance·has·improved·from·the·prior·implementation·by·almost·ten·times. |
247 | *\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 | *\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* |
248 | The·majority·of·the·time·is·now·spent·in·apply_integrate_f.·Disabling·Cython’s | 248 | The·majority·of·the·time·is·now·spent·in·apply_integrate_f.·Disabling·Cython’s |
249 | boundscheck·and·wraparound·checks·can·yield·more·performance. | 249 | boundscheck·and·wraparound·checks·can·yield·more·performance. |
250 | In·[15]:·%prun·-l·4·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(), | 250 | In·[15]:·%prun·-l·4·apply_integrate_f(df["a"].to_numpy(),·df["b"].to_numpy(), |
251 | df["N"].to_numpy()) | 251 | df["N"].to_numpy()) |
252 | ·········75·function·calls·in·0.001·seconds | 252 | ·········75·function·calls·in·0.001·seconds |
Offset 254, 15 lines modified | Offset 254, 15 lines modified | ||
254 | ···Ordered·by:·internal·time | 254 | ···Ordered·by:·internal·time |
255 | ···List·reduced·from·20·to·4·due·to·restriction·<4> | 255 | ···List·reduced·from·20·to·4·due·to·restriction·<4> |
256 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) | 256 | ···ncalls··tottime··percall··cumtime··percall·filename:lineno(function) |
257 | ········1····0.001····0.001····0.001····0.001·<string>:1(<module>) | 257 | ········1····0.001····0.001····0.001····0.001·<string>:1(<module>) |
258 | ········1····0.000····0.000····0.001····0.001·{built-in·method·builtins.exec} | 258 | ········1····0.000····0.000····0.001····0.001·{built-in·method·builtins.exec} |
259 | ········3····0.000····0.000····0.000····0.000·frame.py:3853(__getitem__) | 259 | ········3····0.000····0.000····0.000····0.000·frame.py:3853(__getitem__) |
260 | ········3····0.000····0.000····0.000····0.000· | 260 | ········3····0.000····0.000····0.000····0.000·base.py:541(to_numpy) |
261 | In·[16]:·%%cython | 261 | In·[16]:·%%cython |
262 | ···....:·cimport·cython | 262 | ···....:·cimport·cython |
263 | ···....:·cimport·numpy·as·np | 263 | ···....:·cimport·numpy·as·np |
264 | ···....:·import·numpy·as·np | 264 | ···....:·import·numpy·as·np |
265 | ···....:·cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2: | 265 | ···....:·cdef·np.float64_t·f_typed(np.float64_t·x)·except?·-2: |
266 | ···....:·····return·x·*·(x·-·1) | 266 | ···....:·····return·x·*·(x·-·1) |
267 | ···....:·cpdef·np.float64_t·integrate_f_typed(np.float64_t·a,·np.float64_t·b, | 267 | ···....:·cpdef·np.float64_t·integrate_f_typed(np.float64_t·a,·np.float64_t·b, |
Offset 300, 15 lines modified | Offset 300, 15 lines modified | ||
300 | /usr/lib/python3/dist-packages/numpy/core/include/numpy/ | 300 | /usr/lib/python3/dist-packages/numpy/core/include/numpy/ |
301 | npy_1_7_deprecated_api.h:17:2:·warning:·#warning·"Using·deprecated·NumPy·API, | 301 | npy_1_7_deprecated_api.h:17:2:·warning:·#warning·"Using·deprecated·NumPy·API, |
302 | disable·it·with·"·"#define·NPY_NO_DEPRECATED_API·NPY_1_7_API_VERSION"·[-Wcpp] | 302 | disable·it·with·"·"#define·NPY_NO_DEPRECATED_API·NPY_1_7_API_VERSION"·[-Wcpp] |
303 | ···17·|·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·\ | 303 | ···17·|·#warning·"Using·deprecated·NumPy·API,·disable·it·with·"·\ |
304 | ······|··^~~~~~~ | 304 | ······|··^~~~~~~ |
305 | In·[17]:·%timeit·apply_integrate_f_wrap(df["a"].to_numpy(),·df["b"].to_numpy(), | 305 | In·[17]:·%timeit·apply_integrate_f_wrap(df["a"].to_numpy(),·df["b"].to_numpy(), |
306 | df["N"].to_numpy()) | 306 | df["N"].to_numpy()) |
307 | 1. | 307 | 1.26·ms·+-·286·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1,000·loops·each) |
Max diff block lines reached; 3797/11355 bytes (33.44%) of diff not shown. |
Offset 889, 16 lines modified | Offset 889, 16 lines modified | ||
889 | <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">"data/timeseries/"</span><span·class="p">)</span><span·class="o">.</span><span·class="n">glob</span><span·class="p">(</span><span·class="s2">"ts*.parquet"</span><span·class="p">)</span> | 889 | <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">"data/timeseries/"</span><span·class="p">)</span><span·class="o">.</span><span·class="n">glob</span><span·class="p">(</span><span·class="s2">"ts*.parquet"</span><span·class="p">)</span> |
890 | <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> | 890 | <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> |
891 | <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> | 891 | <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> |
892 | <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> | 892 | <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> |
893 | <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">"name"</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> | 893 | <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">"name"</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> |
894 | <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> | 894 | <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> |
895 | <span·class="gp">···....:·</span> | 895 | <span·class="gp">···....:·</span> |
896 | <span·class="go">CPU·times:·user·6 | 896 | <span·class="go">CPU·times:·user·604·us,·sys:·35·us,·total:·639·us</span> |
897 | <span·class="go">Wall·time:· | 897 | <span·class="go">Wall·time:·646·us</span> |
898 | <span·class="gh">Out[32]:·</span><span·class="go">Series([],·dtype:·int64)</span> | 898 | <span·class="gh">Out[32]:·</span><span·class="go">Series([],·dtype:·int64)</span> |
899 | </pre></div> | 899 | </pre></div> |
900 | </div> | 900 | </div> |
901 | <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 | 901 | <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 |
902 | <code·class="docutils·literal·notranslate"><span·class="pre">chunksize</span></code>·when·reading·a·single·file.</p> | 902 | <code·class="docutils·literal·notranslate"><span·class="pre">chunksize</span></code>·when·reading·a·single·file.</p> |
903 | <p>Manually·chunking·is·an·OK·option·for·workflows·that·don’t | 903 | <p>Manually·chunking·is·an·OK·option·for·workflows·that·don’t |
904 | 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 | 904 | 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 |
Offset 600, 16 lines modified | Offset 600, 16 lines modified | ||
600 | ···....:·files·=·pathlib.Path("data/timeseries/").glob("ts*.parquet") | 600 | ···....:·files·=·pathlib.Path("data/timeseries/").glob("ts*.parquet") |
601 | ···....:·counts·=·pd.Series(dtype=int) | 601 | ···....:·counts·=·pd.Series(dtype=int) |
602 | ···....:·for·path·in·files: | 602 | ···....:·for·path·in·files: |
603 | ···....:·····df·=·pd.read_parquet(path) | 603 | ···....:·····df·=·pd.read_parquet(path) |
604 | ···....:·····counts·=·counts.add(df["name"].value_counts(),·fill_value=0) | 604 | ···....:·····counts·=·counts.add(df["name"].value_counts(),·fill_value=0) |
605 | ···....:·counts.astype(int) | 605 | ···....:·counts.astype(int) |
606 | ···....: | 606 | ···....: |
607 | CPU·times:·user·6 | 607 | CPU·times:·user·604·us,·sys:·35·us,·total:·639·us |
608 | Wall·time:· | 608 | Wall·time:·646·us |
609 | Out[32]:·Series([],·dtype:·int64) | 609 | Out[32]:·Series([],·dtype:·int64) |
610 | 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 | 610 | 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 |
611 | when·reading·a·single·file. | 611 | when·reading·a·single·file. |
612 | Manually·chunking·is·an·OK·option·for·workflows·that·don’t·require·too | 612 | Manually·chunking·is·an·OK·option·for·workflows·that·don’t·require·too |
613 | 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), | 613 | 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), |
614 | are·much·harder·to·do·chunkwise.·In·these·cases,·you·may·be·better·switching·to | 614 | are·much·harder·to·do·chunkwise.·In·these·cases,·you·may·be·better·switching·to |
615 | a·different·library·that·implements·these·out-of-core·algorithms·for·you. | 615 | a·different·library·that·implements·these·out-of-core·algorithms·for·you. |
Offset 39, 18 lines modified | Offset 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":·"202 | 46 | ····················"iopub.execute_input":·"2024-05-26T11:39:24.088609Z", |
47 | ····················"iopub.status.busy":·"202 | 47 | ····················"iopub.status.busy":·"2024-05-26T11:39:24.088289Z", |
48 | ····················"iopub.status.idle":·"202 | 48 | ····················"iopub.status.idle":·"2024-05-26T11:39:24.711465Z", |
49 | ····················"shell.execute_reply":·"202 | 49 | ····················"shell.execute_reply":·"2024-05-26T11:39:24.698031Z" |
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 modified | Offset 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":·"202 | 84 | ····················"iopub.execute_input":·"2024-05-26T11:39:24.720678Z", |
85 | ····················"iopub.status.busy":·"202 | 85 | ····················"iopub.status.busy":·"2024-05-26T11:39:24.720278Z", |
86 | ····················"iopub.status.idle":·"202 | 86 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.235484Z", |
87 | ····················"shell.execute_reply":·"202 | 87 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.219471Z" |
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":·"202 | 102 | ····················"iopub.execute_input":·"2024-05-26T11:39:25.244647Z", |
103 | ····················"iopub.status.busy":·"202 | 103 | ····················"iopub.status.busy":·"2024-05-26T11:39:25.244230Z", |
104 | ····················"iopub.status.idle":·"202 | 104 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.536260Z", |
105 | ····················"shell.execute_reply":·"202 | 105 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.535440Z" |
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 modified | Offset 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":·"202 | 130 | ····················"iopub.execute_input":·"2024-05-26T11:39:25.544612Z", |
131 | ····················"iopub.status.busy":·"202 | 131 | ····················"iopub.status.busy":·"2024-05-26T11:39:25.544212Z", |
132 | ····················"iopub.status.idle":·"202 | 132 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.568236Z", |
133 | ····················"shell.execute_reply":·"202 | 133 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.567449Z" |
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 modified | Offset 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":·"202 | 200 | ····················"iopub.execute_input":·"2024-05-26T11:39:25.608570Z", |
201 | ····················"iopub.status.busy":·"202 | 201 | ····················"iopub.status.busy":·"2024-05-26T11:39:25.608273Z", |
202 | ····················"iopub.status.idle":·"202 | 202 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.640211Z", |
203 | ····················"shell.execute_reply":·"202 | 203 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.639435Z" |
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 modified | Offset 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":·"202 | 334 | ····················"iopub.execute_input":·"2024-05-26T11:39:25.648514Z", |
335 | ····················"iopub.status.busy":·"202 | 335 | ····················"iopub.status.busy":·"2024-05-26T11:39:25.648230Z", |
336 | ····················"iopub.status.idle":·"202 | 336 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.672192Z", |
337 | ····················"shell.execute_reply":·"202 | 337 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.671440Z" |
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 modified | Offset 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":·"202 | 455 | ····················"iopub.execute_input":·"2024-05-26T11:39:25.680482Z", |
456 | ····················"iopub.status.busy":·"202 | 456 | ····················"iopub.status.busy":·"2024-05-26T11:39:25.680200Z", |
457 | ····················"iopub.status.idle":·"202 | 457 | ····················"iopub.status.idle":·"2024-05-26T11:39:25.700214Z", |
458 | ····················"shell.execute_reply":·"202 | 458 | ····················"shell.execute_reply":·"2024-05-26T11:39:25.699437Z" |
459 | ················} | 459 | ················} |
460 | ············}, | 460 | ············}, |
461 | ············"outputs":·[ | 461 | ············"outputs":·[ |
Max diff block lines reached; 83518/90470 bytes (92.32%) of diff not shown. |
Offset 1806, 20 lines modified | Offset 1806, 20 lines modified | ||
1806 | <span·class="gp">In·[99]:·</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> | 1806 | <span·class="gp">In·[99]:·</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> |
1807 | <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> | 1807 | <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> |
1808 | <span·class="gp">···....:·</span> | 1808 | <span·class="gp">···....:·</span> |
1809 | </pre></div> | 1809 | </pre></div> |
1810 | </div> | 1810 | </div> |
1811 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·eval·with·NumExpr·backend</span> | 1811 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·eval·with·NumExpr·backend</span> |
1812 | <span·class="gp">In·[100]:·</span><span·class="o">%</span><span·class="k">timeit</span>·pd.eval('df1·+·df2·+·df3·+·df4') | 1812 | <span·class="gp">In·[100]:·</span><span·class="o">%</span><span·class="k">timeit</span>·pd.eval('df1·+·df2·+·df3·+·df4') |
1813 | <span·class="go"> | 1813 | <span·class="go">20.2·ms·+-·3.92·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span> |
1814 | </pre></div> | 1814 | </pre></div> |
1815 | </div> | 1815 | </div> |
1816 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·pure·Python·evaluation</span> | 1816 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="go">#·pure·Python·evaluation</span> |
1817 | <span·class="gp">In·[101]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df1·+·df2·+·df3·+·df4 | 1817 | <span·class="gp">In·[101]:·</span><span·class="o">%</span><span·class="k">timeit</span>·df1·+·df2·+·df3·+·df4 |
1818 | <span·class="go"> | 1818 | <span·class="go">17.3·ms·+-·5.79·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each)</span> |
1819 | </pre></div> | 1819 | </pre></div> |
1820 | </div> | 1820 | </div> |
1821 | <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> | 1821 | <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> |
1822 | </li> | 1822 | </li> |
1823 | <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 | 1823 | <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 |
1824 | <code·class="docutils·literal·notranslate"><span·class="pre">DataFrame.eval</span></code>·method·that·evaluates·an·expression·in·the·context·of | 1824 | <code·class="docutils·literal·notranslate"><span·class="pre">DataFrame.eval</span></code>·method·that·evaluates·an·expression·in·the·context·of |
1825 | the·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>.·For·example,</p> | 1825 | the·<code·class="docutils·literal·notranslate"><span·class="pre">DataFrame</span></code>.·For·example,</p> |
Offset 1039, 18 lines modified | Offset 1039, 18 lines modified | ||
1039 | ······In·[99]:·df1,·df2,·df3,·df4·=·[pd.DataFrame(np.random.randn(nrows, | 1039 | ······In·[99]:·df1,·df2,·df3,·df4·=·[pd.DataFrame(np.random.randn(nrows, |
1040 | ······ncols)) | 1040 | ······ncols)) |
1041 | ·········....:·······················for·_·in·range(4)] | 1041 | ·········....:·······················for·_·in·range(4)] |
1042 | ·········....: | 1042 | ·········....: |
1043 | ······#·eval·with·NumExpr·backend | 1043 | ······#·eval·with·NumExpr·backend |
1044 | ······In·[100]:·%timeit·pd.eval('df1·+·df2·+·df3·+·df4') | 1044 | ······In·[100]:·%timeit·pd.eval('df1·+·df2·+·df3·+·df4') |
1045 | ······ | 1045 | ······20.2·ms·+-·3.92·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each) |
1046 | ······#·pure·Python·evaluation | 1046 | ······#·pure·Python·evaluation |
1047 | ······In·[101]:·%timeit·df1·+·df2·+·df3·+·df4 | 1047 | ······In·[101]:·%timeit·df1·+·df2·+·df3·+·df4 |
1048 | ······ | 1048 | ······17.3·ms·+-·5.79·ms·per·loop·(mean·+-·std.·dev.·of·7·runs,·10·loops·each) |
1049 | ······For·more·details,·see·the·_\x8t_\x8h_\x8e_\x8·_\x8d_\x8o_\x8c_\x8s | 1049 | ······For·more·details,·see·the·_\x8t_\x8h_\x8e_\x8·_\x8d_\x8o_\x8c_\x8s |
1050 | ····*·Similar·to·pandas.eval,·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e·has·a·new·DataFrame.eval·method·that | 1050 | ····*·Similar·to·pandas.eval,·_\x8D_\x8a_\x8t_\x8a_\x8F_\x8r_\x8a_\x8m_\x8e·has·a·new·DataFrame.eval·method·that |
1051 | ······evaluates·an·expression·in·the·context·of·the·DataFrame.·For·example, | 1051 | ······evaluates·an·expression·in·the·context·of·the·DataFrame.·For·example, |
1052 | ······In·[102]:·df·=·pd.DataFrame(np.random.randn(10,·2),·columns=['a',·'b']) | 1052 | ······In·[102]:·df·=·pd.DataFrame(np.random.randn(10,·2),·columns=['a',·'b']) |
1053 | ······In·[103]:·df.eval('a·+·b') | 1053 | ······In·[103]:·df.eval('a·+·b') |
1054 | ······Out[103]: | 1054 | ······Out[103]: |
Offset 1719, 18 lines modified | Offset 1719, 18 lines modified | ||
1719 | </div> | 1719 | </div> |
1720 | <div·class="admonition·note"> | 1720 | <div·class="admonition·note"> |
1721 | <p·class="admonition-title">Note</p> | 1721 | <p·class="admonition-title">Note</p> |
1722 | <p>If·you·want·to·perform·calculations·based·on·today’s·date,·use·<code·class="docutils·literal·notranslate"><span·class="pre">Timestamp.now()</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">pandas.tseries.offsets</span></code>.</p> | 1722 | <p>If·you·want·to·perform·calculations·based·on·today’s·date,·use·<code·class="docutils·literal·notranslate"><span·class="pre">Timestamp.now()</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">pandas.tseries.offsets</span></code>.</p> |
1723 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[66]:·</span><span·class="kn">import</span>·<span·class="nn">pandas.tseries.offsets</span>·<span·class="k">as</span>·<span·class="nn">offsets</span> | 1723 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[66]:·</span><span·class="kn">import</span>·<span·class="nn">pandas.tseries.offsets</span>·<span·class="k">as</span>·<span·class="nn">offsets</span> |
1724 | <span·class="gp">In·[67]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Timestamp</span><span·class="o">.</span><span·class="n">now</span><span·class="p">()</span> | 1724 | <span·class="gp">In·[67]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Timestamp</span><span·class="o">.</span><span·class="n">now</span><span·class="p">()</span> |
1725 | <span·class="gh">Out[67]:·</span><span·class="go">Timestamp('202 | 1725 | <span·class="gh">Out[67]:·</span><span·class="go">Timestamp('2024-05-27·01:34:49.835047')</span> |
1726 | <span·class="gp">In·[68]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Timestamp</span><span·class="o">.</span><span·class="n">now</span><span·class="p">()</span>·<span·class="o">+</span>·<span·class="n">offsets</span><span·class="o">.</span><span·class="n">DateOffset</span><span·class="p">(</span><span·class="n">years</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> | 1726 | <span·class="gp">In·[68]:·</span><span·class="n">pd</span><span·class="o">.</span><span·class="n">Timestamp</span><span·class="o">.</span><span·class="n">now</span><span·class="p">()</span>·<span·class="o">+</span>·<span·class="n">offsets</span><span·class="o">.</span><span·class="n">DateOffset</span><span·class="p">(</span><span·class="n">years</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> |
1727 | <span·class="gh">Out[68]:·</span><span·class="go">Timestamp('202 | 1727 | <span·class="gh">Out[68]:·</span><span·class="go">Timestamp('2025-05-27·01:34:49.845663')</span> |
1728 | </pre></div> | 1728 | </pre></div> |
1729 | </div> | 1729 | </div> |
1730 | </div> | 1730 | </div> |
1731 | </section> | 1731 | </section> |
1732 | </section> | 1732 | </section> |
1733 | <section·id="changes-to-index-comparisons"> | 1733 | <section·id="changes-to-index-comparisons"> |
1734 | <h3>Changes·to·Index·comparisons<a·class="headerlink"·href="#changes-to-index-comparisons"·title="Link·to·this·heading">¶</a></h3> | 1734 | <h3>Changes·to·Index·comparisons<a·class="headerlink"·href="#changes-to-index-comparisons"·title="Link·to·this·heading">¶</a></h3> |
Offset 826, 18 lines modified | Offset 826, 18 lines modified | ||
826 | freq=None) | 826 | freq=None) |
827 | Note | 827 | Note |
828 | If·you·want·to·perform·calculations·based·on·today’s·date,·use·Timestamp.now() | 828 | If·you·want·to·perform·calculations·based·on·today’s·date,·use·Timestamp.now() |
829 | and·pandas.tseries.offsets. | 829 | and·pandas.tseries.offsets. |
830 | In·[66]:·import·pandas.tseries.offsets·as·offsets | 830 | In·[66]:·import·pandas.tseries.offsets·as·offsets |
831 | In·[67]:·pd.Timestamp.now() | 831 | In·[67]:·pd.Timestamp.now() |
832 | Out[67]:·Timestamp('202 | 832 | Out[67]:·Timestamp('2024-05-27·01:34:49.835047') |
833 | In·[68]:·pd.Timestamp.now()·+·offsets.DateOffset(years=1) | 833 | In·[68]:·pd.Timestamp.now()·+·offsets.DateOffset(years=1) |
834 | Out[68]:·Timestamp('202 | 834 | Out[68]:·Timestamp('2025-05-27·01:34:49.845663') |
835 | *\x8**\x8**\x8**\x8*·C\x8Ch\x8ha\x8an\x8ng\x8ge\x8es\x8s·t\x8to\x8o·I\x8In\x8nd\x8de\x8ex\x8x·c\x8co\x8om\x8mp\x8pa\x8ar\x8ri\x8is\x8so\x8on\x8ns\x8s_\x8?\x8¶·*\x8**\x8**\x8**\x8* | 835 | *\x8**\x8**\x8**\x8*·C\x8Ch\x8ha\x8an\x8ng\x8ge\x8es\x8s·t\x8to\x8o·I\x8In\x8nd\x8de\x8ex\x8x·c\x8co\x8om\x8mp\x8pa\x8ar\x8ri\x8is\x8so\x8on\x8ns\x8s_\x8?\x8¶·*\x8**\x8**\x8**\x8* |
836 | Operator·equal·on·Index·should·behavior·similarly·to·Series·(_\x8G_\x8H_\x8·_\x89_\x89_\x84_\x87,·_\x8G_\x8H_\x8·_\x81_\x80_\x86_\x83_\x87) | 836 | Operator·equal·on·Index·should·behavior·similarly·to·Series·(_\x8G_\x8H_\x8·_\x89_\x89_\x84_\x87,·_\x8G_\x8H_\x8·_\x81_\x80_\x86_\x83_\x87) |
837 | Starting·in·v0.17.0,·comparing·Index·objects·of·different·lengths·will·raise·a | 837 | Starting·in·v0.17.0,·comparing·Index·objects·of·different·lengths·will·raise·a |
838 | ValueError.·This·is·to·be·consistent·with·the·behavior·of·Series. | 838 | ValueError.·This·is·to·be·consistent·with·the·behavior·of·Series. |
839 | Previous·behavior: | 839 | Previous·behavior: |
840 | In·[2]:·pd.Index([1,·2,·3])·==·pd.Index([1,·4,·5]) | 840 | In·[2]:·pd.Index([1,·2,·3])·==·pd.Index([1,·4,·5]) |
841 | Out[2]:·array([·True,·False,·False],·dtype=bool) | 841 | Out[2]:·array([·True,·False,·False],·dtype=bool) |
Offset 1269, 18 lines modified | Offset 1269, 18 lines modified | ||
1269 | a·new·ndarray·of·period·objects·each·time.</p> | 1269 | a·new·ndarray·of·period·objects·each·time.</p> |
1270 | <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> | 1270 | <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> |
1271 | <span·class="gh">Out[18]:·</span> | 1271 | <span·class="gh">Out[18]:·</span> |
1272 | <span·class="go">array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),</span> | 1272 | <span·class="go">array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),</span> |
1273 | <span·class="go">·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)</span> | 1273 | <span·class="go">·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)</span> |
1274 | <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> | 1274 | <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> |
1275 | <span·class="gh">Out[19]:·</span><span·class="go">281472 | 1275 | <span·class="gh">Out[19]:·</span><span·class="go">281472221874384</span> |
1276 | <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> | 1276 | <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> |
1277 | <span·class="gh">Out[20]:·</span><span·class="go">281472 | 1277 | <span·class="gh">Out[20]:·</span><span·class="go">281472225870640</span> |
1278 | </pre></div> | 1278 | </pre></div> |
1279 | </div> | 1279 | </div> |
1280 | <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·<a·class="reference·internal"·href="../reference/api/pandas.Index.to_numpy.html#pandas.Index.to_numpy"·title="pandas.Index.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Index.to_numpy()</span></code></a>.</p> | 1280 | <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·<a·class="reference·internal"·href="../reference/api/pandas.Index.to_numpy.html#pandas.Index.to_numpy"·title="pandas.Index.to_numpy"><code·class="xref·py·py-meth·docutils·literal·notranslate"><span·class="pre">Index.to_numpy()</span></code></a>.</p> |
1281 | <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> | 1281 | <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> |
1282 | <span·class="gh">Out[21]:·</span> | 1282 | <span·class="gh">Out[21]:·</span> |
1283 | <span·class="go">array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),</span> | 1283 | <span·class="go">array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'),</span> |
1284 | <span·class="go">·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)</span> | 1284 | <span·class="go">·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object)</span> |
Offset 312, 18 lines modified | Offset 312, 18 lines modified | ||
312 | each·time. | 312 | each·time. |
313 | In·[18]:·idx.values | 313 | In·[18]:·idx.values |
314 | Out[18]: | 314 | Out[18]: |
315 | array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'), | 315 | array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'), |
316 | ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object) | 316 | ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object) |
317 | In·[19]:·id(idx.values) | 317 | In·[19]:·id(idx.values) |
318 | Out[19]:·281472 | 318 | Out[19]:·281472221874384 |
319 | In·[20]:·id(idx.values) | 319 | In·[20]:·id(idx.values) |
320 | Out[20]:·281472 | 320 | Out[20]:·281472225870640 |
321 | 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·_\x8I_\x8n_\x8d_\x8e_\x8x_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8). | 321 | 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·_\x8I_\x8n_\x8d_\x8e_\x8x_\x8._\x8t_\x8o_\x8__\x8n_\x8u_\x8m_\x8p_\x8y_\x8(_\x8). |
322 | In·[21]:·idx.to_numpy() | 322 | In·[21]:·idx.to_numpy() |
323 | Out[21]: | 323 | Out[21]: |
324 | array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'), | 324 | array([Period('2000-01-01',·'D'),·Period('2000-01-02',·'D'), |
325 | ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object) | 325 | ·······Period('2000-01-03',·'D'),·Period('2000-01-04',·'D')],·dtype=object) |
326 | In·[22]:·pd.Series(idx).to_numpy() | 326 | In·[22]:·pd.Series(idx).to_numpy() |