Skip to main content

A Python module for processing CSV files efficiently

Project description

PythonCSVUtils

pythonCSVutils is a lightweight Python library that provides utility functions for working with CSV files. It allows you to read, write, filter, sort, update, select, group, aggregate, merge, and manipulate CSV data with ease.

Installation

You can install pythonCSVutils via pip:

pip install pythonCSVutils

Usage

Import the necessary functions from the library:

from pythonCSVutils import read_csv, write_csv, filter_rows, sort_rows, update_rows, select_columns, read_csv_header, append_rows, group_by, aggregate, merge, drop_columns

#Reading and Writing CSV Files

data = read_csv('data.csv')

#Write data to a CSV file

write_csv('output.csv', data)

#Filter rows based on a condition

filtered_data = filter_rows(data, lambda row: row['age'] > 30)

#Sort rows based on a key

sorted_data = sort_rows(data, 'age', reverse=True)

#Update rows by modifying a specific column

updated_data = update_rows(data, 'age', lambda row: row['age'] + 1)

#Select specific columns from the data

selected_data = select_columns(data, ['name', 'age'])

#Read the header of a CSV file

header = read_csv_header('data.csv')

#Append rows to an existing CSV file

append_rows('data.csv', new_rows)

#Group data by a specific key

grouped_data = group_by(data, 'gender')

#Aggregate data based on a grouping key, an aggregation key, and an aggregation function

aggregated_data = aggregate(data, 'gender', 'age', sum)

#Merge two datasets based on a common key

merged_data = merge(data1, data2, 'id')

#Drop specific columns from the data

dropped_data = drop_columns(data, ['email', 'phone'])

License

This project is licensed under the MIT License.

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

pythonCSVutils-0.1.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonCSVutils-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pythonCSVutils-0.1.1.tar.gz.

File metadata

  • Download URL: pythonCSVutils-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pythonCSVutils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5bc634f8d4a71fce3ac691f32e6d924200e5a78b7257b3b4c616680909539066
MD5 c67818569432b0fc0a013eaa07c4c19a
BLAKE2b-256 470c4d304fb05933b6f4a77da1eb51025c3226ea3cdc6446d2d4d74060f65d00

See more details on using hashes here.

File details

Details for the file pythonCSVutils-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pythonCSVutils-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pythonCSVutils-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd65beb1798136a3b548bfd0096c98e438c89179d591b93a3c1671c7c424947c
MD5 eff23332a4b3b147a88032b63becdf45
BLAKE2b-256 bb1fcbb95e3b0ce3945737cfd91409e8ce5875ea40ed8e687f4a65d4844257fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page