Package with tools for pandas
Project description
Pypdtools
Pypdtools is a Python package that extends the functionality of Pandas DataFrames by introducing the PtDataFrame
class. PtDataFrame
provides additional features and enhancements to work with DataFrames in a more convenient and flexible way.
Features
- Asynchronous iteration support:
PtDataFrame
implements both synchronous and asynchronous iterators, allowing for efficient and convenient data processing in asynchronous contexts. - Context manager support:
PtDataFrame
can be used as a context manager to easily access the encapsulated Pandas DataFrame. - Concatenation and reduction:
PtDataFrame
supports concatenation of multiple instances and reduction of a list ofPtDataFrame
objects into a single instance. - Column extraction: Easily extract a column as a list from a
PtDataFrame
.
Docs: https://msbar.github.io/pypdtools
Source code: https://github.com/msbar/pypdtools
Installation
You can install pypdtools using pip:
pip install pypdtools
Usage
Here's an example of how to use the PtDataFrame
class:
import pandas as pd
from pypdtools.core.dataframe import PtDataFrame
# Create a Pandas DataFrame
data = {
"a": [1, 2, 3],
"b": [4, 5, 6],
"c": [7, 8, 9]
}
df = pd.DataFrame(data)
# Create a PtDataFrame from the Pandas DataFrame
pt_df = PtDataFrame(df)
# Async Iterate over rows
async for row in pt_df:
print(row)
# Concatenate PtDataFrames
pt_df2 = PtDataFrame(df)
concatenated = pt_df + pt_df2
# Reduce a list of PtDataFrames
pt_df3 = PtDataFrame.reduce([pt_df, pt_df2])
# Extract a column as a list
col_values = pt_df.col_to_list("a")
print(col_values)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypdtools-0.0.2.tar.gz
(7.2 kB
view details)
Built Distribution
File details
Details for the file pypdtools-0.0.2.tar.gz
.
File metadata
- Download URL: pypdtools-0.0.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2acf1b9f0890120d29492032721ba2f86bb1e50489651c3870f24487f1d146cf |
|
MD5 | 283f04a2133c38b57c971e0f18d84982 |
|
BLAKE2b-256 | b43b6c7c134c8b710e7f03919837eaf7396783295fefd181048b7f24f15c8183 |
File details
Details for the file pypdtools-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pypdtools-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1f60193d84d08fef5c82e02fbb2a0748a96699169c975ce228ea88ff11f76b9 |
|
MD5 | f49edaaa66d99b1385f572f6e043e218 |
|
BLAKE2b-256 | 813836cb9d3037c1fe7683d540fde429bef0a6c2bef71a797f52fa73cb843e15 |