Installation
pip install a-pandas-ex-drop-duplicates-without-pain
Usage
from a_pandas_ex_drop_duplicates_without_pain import pd_add_drop_duplicates_without_pain
pd_add_drop_duplicates_without_pain()
import pandas as pd
df = pd.read_csv("https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_long.csv")
print(f'{df=}')
df_with_duplicates = df[['city', 'country', 'location', 'parameter', 'value','unit']].copy()
print(f'{df_with_duplicates=}')
df_without_duplicates = df_with_duplicates[['city', 'country', 'location', 'parameter', 'value', 'unit']].drop_duplicates().copy()
print(f'{df_without_duplicates=}')
df_with_duplicates['provoke_error'] = [[[1]*10]] * len(df_with_duplicates)
print(f'{df_with_duplicates=}')
df_result1 = None
df_result2 = None
try:
df_result1=df_with_duplicates.drop_duplicates()
except Exception as Err:
print(Err)
df_result2=df_with_duplicates.ds_drop_duplicates_without_pain()
print(f'{df_result1=}')
print(f'{df_result2=}')
df.parameter.ds_drop_duplicates_without_pain()
df= city country date.utc ... parameter value unit
0 Antwerpen BE 2019-06-18 06:00:00+00:00 ... pm25 18.0 µg/m³
1 Antwerpen BE 2019-06-17 08:00:00+00:00 ... pm25 6.5 µg/m³
2 Antwerpen BE 2019-06-17 07:00:00+00:00 ... pm25 18.5 µg/m³
3 Antwerpen BE 2019-06-17 06:00:00+00:00 ... pm25 16.0 µg/m³
4 Antwerpen BE 2019-06-17 05:00:00+00:00 ... pm25 7.5 µg/m³
... ... ... ... ... ... ...
5267 London GB 2019-04-09 06:00:00+00:00 ... no2 41.0 µg/m³
5268 London GB 2019-04-09 05:00:00+00:00 ... no2 41.0 µg/m³
5269 London GB 2019-04-09 04:00:00+00:00 ... no2 41.0 µg/m³
5270 London GB 2019-04-09 03:00:00+00:00 ... no2 67.0 µg/m³
5271 London GB 2019-04-09 02:00:00+00:00 ... no2 67.0 µg/m³
[5272 rows x 7 columns]
df_with_duplicates= city country location parameter value unit
0 Antwerpen BE BETR801 pm25 18.0 µg/m³
1 Antwerpen BE BETR801 pm25 6.5 µg/m³
2 Antwerpen BE BETR801 pm25 18.5 µg/m³
3 Antwerpen BE BETR801 pm25 16.0 µg/m³
4 Antwerpen BE BETR801 pm25 7.5 µg/m³
... ... ... ... ... ...
5267 London GB London Westminster no2 41.0 µg/m³
5268 London GB London Westminster no2 41.0 µg/m³
5269 London GB London Westminster no2 41.0 µg/m³
5270 London GB London Westminster no2 67.0 µg/m³
5271 London GB London Westminster no2 67.0 µg/m³
[5272 rows x 6 columns]
df_without_duplicates= city country location parameter value unit
0 Antwerpen BE BETR801 pm25 18.0 µg/m³
1 Antwerpen BE BETR801 pm25 6.5 µg/m³
2 Antwerpen BE BETR801 pm25 18.5 µg/m³
3 Antwerpen BE BETR801 pm25 16.0 µg/m³
4 Antwerpen BE BETR801 pm25 7.5 µg/m³
... ... ... ... ... ...
5087 London GB London Westminster no2 81.0 µg/m³
5090 London GB London Westminster no2 83.0 µg/m³
5091 London GB London Westminster no2 76.0 µg/m³
5092 London GB London Westminster no2 70.0 µg/m³
5098 London GB London Westminster no2 79.0 µg/m³
[819 rows x 6 columns]
df_with_duplicates= city country ... unit provoke_error
0 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
1 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
2 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
3 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
4 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
... ... ... ... ...
5267 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5268 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5269 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5270 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5271 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
[5272 rows x 7 columns]
unhashable type: 'list'
df_result1=None
df_result2= city country ... unit provoke_error
0 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
1 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
2 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
3 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
4 Antwerpen BE ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
... ... ... ... ...
5087 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5090 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5091 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5092 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
5098 London GB ... µg/m³ [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
[819 rows x 7 columns]
Out[2]:
0 pm25
1825 no2
Name: parameter, dtype: object
Metadata
Release files for a-pandas-ex-drop-duplicates-without-pain 0.12
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 |
|---|---|---|---|---|
| a_pandas_ex_drop_duplicates_without_pain-0.12.tar.gz | 5.6 kB | Without provenance | Details for a_pandas_ex_drop_duplicates_without_pain-0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a_pandas_ex_drop_duplicates_without_pain-0.12-py3-none-any.whl | Python 3 | none | any | Details for a_pandas_ex_drop_duplicates_without_pain-0.12-py3-none-any.whl |
Total release size: 12.6 kB
Release files / a_pandas_ex_drop_duplicates_without_pain-0.12.tar.gz
| Download URL | a_pandas_ex_drop_duplicates_without_pain-0.12.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ba174807e292c339a8ebe034fea2ee8ed976b0163362e137dd0d8002bf495fd
|
|
BLAKE2b-256 checksum How to use checksums |
feb6c41a27d954f7d12879faffc52242f12a3ca36a3a2cc592cf73a532fe2628
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / a_pandas_ex_drop_duplicates_without_pain-0.12-py3-none-any.whl
| Download URL | a_pandas_ex_drop_duplicates_without_pain-0.12-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c67427e7f93be0336b3f98018c075976110ba280abc5d1bdea71adc904cad8c
|
|
BLAKE2b-256 checksum How to use checksums |
dc7a4f5c0c9af8a9acf618d62eff22da371fa25a3d9fa55c921531deb66fba3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for a-pandas-ex-drop-duplicates-without-pain 0.12
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.