DataPrepKit is a Python class for data preparation and analysis. It provides functionalities for reading various data formats, summarizing statistics, handling missing values, and encoding categorical data.
Project description
DataPrepKit
DataPrepKit is a Python utility class for simplifying common data preparation tasks such as reading data from different file formats, generating summary statistics, handling missing values, and encoding categorical data.
Installation
You can install DataPrepKit using pip:
pip install dateprepkit
Usage
To use DataPrepKit in your Python project, follow the steps below:
# Import DataPrepKit
from DataPrepKit.DataPrepKit import DataPrepKit
# Initialize DataPrepKit with a DataFrame
prep_kit = DataPrepKit()
- Reading Data Use the read_data method to load data from various file formats such as CSV, Excel, or JSON:
# Read data from a CSV file
csv_data = prep_kit.read_data('student-dataset.csv', 'csv')
- Generating Data Summary Generate summary statistics for the loaded data using the data_summary method:
# Generate a data summary
summary = prep_kit.data_summary()
print("Data Summary:")
print(summary)
- Handling Missing Values Handle missing values in the DataFrame by either removing or imputing them using the handle_missing_values method:
# Handle missing values by removing
cleaned_data = prep_kit.handle_missing_values(strategy='remove')
print("\nData after handling missing values (removed):")
print(cleaned_data)
- Encoding Categorical Data Encode categorical columns in the DataFrame using one-hot encoding with the encode_categorical_data method:
# Encode categorical data
encoded_df = prep_kit.encode_categorical_data(categorical_columns=['Gender', 'City'])
print("\nEncoded DataFrame:")
print(encoded_df)
Example
Here's a complete example of how to use DataPrepKit:
# Import DataPrepKit
from DataPrepKit.DataPrepKit import DataPrepKit
# Initialize DataPrepKit with a DataFrame
prep_kit = DataPrepKit()
# Read data from a CSV file
csv_data = prep_kit.read_data('student-dataset.csv', 'csv')
# Generate a data summary
summary = prep_kit.data_summary()
print("Data Summary:")
print(summary)
# Handle missing values by removing
cleaned_data = prep_kit.handle_missing_values(strategy='remove')
print("\nData after handling missing values (removed):")
print(cleaned_data)
# Encode categorical data
encoded_df = prep_kit.encode_categorical_data(categorical_columns=['Gender', 'City'])
print("\nEncoded DataFrame:")
print(encoded_df)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dateprepkit-0.4.tar.gz.
File metadata
- Download URL: dateprepkit-0.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d196ce7df6b58c0168c96886dfb80a682b57bfa48d289917f57d0d20fa485a8
|
|
| MD5 |
d90ea9b2fb785079461a09e59437fc27
|
|
| BLAKE2b-256 |
d7ae22991e000284276942647e05d03d089b132f04cc4eeca736d9530abb3c97
|
File details
Details for the file dateprepkit-0.4-py3-none-any.whl.
File metadata
- Download URL: dateprepkit-0.4-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f36ff1d6ddb63e5484ee2423671475df883b9a539c575b053d4e6d193167670
|
|
| MD5 |
b2a3a4a7ee76a5d9d83b2a45a9ee70a0
|
|
| BLAKE2b-256 |
6f581a072aad53b9ce869fd61d466020900cb31e6942dee5a1d5b855a9e670da
|