The sensible way to work with tabular data
Project description
tabular-data
The sensible way to work with tabular data
Read CSV files with ease
Go from this 😡:
import csv
with open('names.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
print(row)
to this 😎:
from tabular_data import csv_file
for row in csv_file('names.csv').read_records():
print(row)
Write CSV files with no effort
Go from this 🤮:
import csv
with open('names.csv', 'w', newline='') as csvfile:
fieldnames = ['first_name', 'last_name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})
to this 🤩:
from tabular_data import csv_file
csv_file('names.csv').write_records(
[
{'first_name': 'Baked', 'last_name': 'Beans'},
{'first_name': 'Lovely', 'last_name': 'Spam'},
{'first_name': 'Wonderful', 'last_name': 'Spam'}
]
)
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
tabular_data-0.1.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for tabular_data-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4b74a016cc3f8b52cdda03152a6c8e347c04fbcb606308d46af03839feaf1d |
|
MD5 | 7577351f63cc9fb596f5ab373864141c |
|
BLAKE2b-256 | 091bdfd3d4ee131e00d05fe2e8f03463da1484037fd84ffccdedc520cd3872ae |