Skip to main content

Create, Read, Update, Delete, and Move Rows in a CSV File

Project description

csvplus

Create, Read, Update, Delete, and Move Rows in a CSV File

install

pip install csvplus

usage

import csvplus

filepath = "./folder/cars.csv"

# create csv with the given column names 
csvplus.create(filepath, ["make","model","year"])

# append a new row to the end of the csv file
csvplus.add(filepath, { "make": "Kia", "model": "Soul", "year": 2023 })

# delete all rows matching the where conditions
csvplus.delete(filepath, where={ "make": "Tesla" })

# find all rows matching the where conditions
csvplus.read("countries.csv", where={ "year": 1776 })
[{ "name": "United States of Ameriac", "abbreviation": "USA", "year": 1776 }]

# move rows
move(filepath, from_row, to_row, debug_level=0, quoting=csv.QUOTE_ALL):
csvplus.move("example.csv", 0, 20) # move the first row to the 20th line

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

csvplus-0.0.2.tar.gz (6.6 kB view hashes)

Uploaded Source

Supported by

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