Drops duplicates in DataFrames with tedious dtypes
Project description
Drops duplicates in DataFrames with tedious dtypes
Tested against Windows / Python 3.11 / Anaconda
pip install dropduplicatesplanb
import pandas as pd
from dropduplicatesplanb import pd_add_drop_duplicates_planB
pd_add_drop_duplicates_planB()
df = pd.read_csv(
"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv"
)
df["baba"] = df.Embarked.apply(lambda q: [q, q, q, q])
df.loc[0, "baba"] = [[[1, 2, 34, 4, 2, 2, 34, 2, 1]]]
df.loc[1, "baba"] = [[[1, 2, 34, 4, 2, 2, 34, 2, 1]]]
df = pd.concat([df for x in range(2)], ignore_index=True)
df21 = df.d_drop_duplicates_planB(subset="baba")
df32 = df.d_drop_duplicates_planB(subset=["PassengerId", "Survived"])
df43 = df.d_drop_duplicates_planB(subset=["PassengerId", "Survived"], keep="first")
df54 = df.d_drop_duplicates_planB()
print(df)
print(df21)
print(df32)
print(df43)
print(df54)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dropduplicatesplanb-0.11.tar.gz
(20.9 kB
view details)
Built Distribution
File details
Details for the file dropduplicatesplanb-0.11.tar.gz
.
File metadata
- Download URL: dropduplicatesplanb-0.11.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f332909e839455a272c183688e3747ad6c1dc73a1dab88393bf22959ceb75caf |
|
MD5 | 9378851ac4a6e18894598c97bb4c8e3a |
|
BLAKE2b-256 | 142ee98924dd993692a91e48197f8a296ec29a3d3d9aa5ae8526310823199d60 |
File details
Details for the file dropduplicatesplanb-0.11-py3-none-any.whl
.
File metadata
- Download URL: dropduplicatesplanb-0.11-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2795c5605ddf94f69ae2b1e7392c75a5e60204d03f9d820fb662b4975ad3a6a8 |
|
MD5 | 4e4bce627b74be24b016cb86fb085e2e |
|
BLAKE2b-256 | e9f801d9dc4f182099654dcf7ce8ec5b3f5ba27cda9b644d4b61179d73e095e5 |