pandas_historical
Awesome pandas_historical created by dvvolynkin
Install it from PyPI
pip install pandas_historical
Usage
import pandas as pd
currencies_scraping = pd.DataFrame([
{
'date': '2022-02-21',
'key': 'DOLLAR',
'value': 78,
'scraping_id': 123
},
{
'date': '2022-02-21',
'key': 'EURO',
'value': 87,
'scraping_id': 123
},
{
'date': '2022-02-28',
'key': 'DOLLAR',
'value': 105,
'scraping_id': 124
},
{
'date': '2022-03-07',
'key': 'EURO',
'value': 139,
'scraping_id': 125
},
{
'date': '2022-03-07',
'key': 'EURO',
'value': 148,
'scraping_id': 125
}
])
currencies_scraping
| date | key | value | scraping_id | |
|---|---|---|---|---|
| 0 | 2022-02-21 | DOLLAR | 78 | 123 |
| 1 | 2022-02-21 | EURO | 87 | 123 |
| 2 | 2022-02-28 | DOLLAR | 105 | 124 |
| 3 | 2022-03-07 | EURO | 139 | 125 |
| 4 | 2022-03-07 | EURO | 148 | 125 |
from pandas_historical import make_historical_df
historical_df = make_historical_df(currencies_scraping)
historical_df
| date | key | value | scraping_id | |
|---|---|---|---|---|
| 0 | 2022-02-21 | DOLLAR | 78 | 123 |
| 1 | 2022-02-28 | DOLLAR | 105 | 124 |
| 2 | 2022-02-21 | EURO | 87 | 123 |
| 3 | 2022-03-07 | EURO | 139 | 125 |
| 4 | 2022-03-07 | EURO | 148 | 125 |
from pandas_historical import update_historical_df
new_values = pd.DataFrame([
{
'date': '2022-03-11',
'key': 'DOLLAR',
'value': 113,
'scraping_id': 127
},
{
'date': '2022-03-11',
'key': 'EURO',
'value': 144,
'scraping_id': 127
}
])
historical_df = update_historical_df(
historical_df, new_values
)
historical_df
| date | key | value | scraping_id | |
|---|---|---|---|---|
| 0 | 2022-02-21 | DOLLAR | 78 | 123 |
| 1 | 2022-02-28 | DOLLAR | 105 | 124 |
| 2 | 2022-03-11 | DOLLAR | 113 | 127 |
| 3 | 2022-02-21 | EURO | 87 | 123 |
| 4 | 2022-03-07 | EURO | 139 | 125 |
| 5 | 2022-03-07 | EURO | 148 | 125 |
| 6 | 2022-03-11 | EURO | 144 | 127 |
from pandas_historical import get_history_state
get_history_state(historical_df)
| date | key | value | scraping_id | |
|---|---|---|---|---|
| 2 | 2022-03-11 00:00:00 | DOLLAR | 113 | 127 |
| 6 | 2022-03-11 00:00:00 | EURO | 144 | 127 |
get_history_state(historical_df, state_date='2022-03-07')
| date | key | value | scraping_id | |
|---|---|---|---|---|
| 1 | 2022-02-28 00:00:00 | DOLLAR | 105 | 124 |
| 4 | 2022-03-07 00:00:00 | EURO | 139 | 125 |
Development
Read the CONTRIBUTING.md file.
Metadata
Release files for pandas-historical 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pandas_historical-0.1.2.tar.gz | 7.7 kB | Without provenance | Details for pandas_historical-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pandas_historical-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for pandas_historical-0.1.2-py3-none-any.whl |
Total release size: 11.6 kB
Release files / pandas_historical-0.1.2.tar.gz
| Download URL | pandas_historical-0.1.2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1eef41412e96b8e47e736570913356d76d84fb37c44044921051e7c99d36e90
|
|
BLAKE2b-256 checksum How to use checksums |
9e86a171a56b4acace55013d2384bf8bef62e52aeeaec407fd13ee7ff184e4a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.8.2 requests/2.27.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|
Release files / pandas_historical-0.1.2-py3-none-any.whl
| Download URL | pandas_historical-0.1.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce1c63cd7ea785ccd0a853e039ce8d8e08256f6f114cc133872dc929db9338af
|
|
BLAKE2b-256 checksum How to use checksums |
d682b898fe38abb4bf0f4b9b24ccc7f5ced8d0f90ce9d6dd1fd8df0e72f43a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.8.2 requests/2.27.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|
Security for pandas-historical 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.