converts csv to a dictionary
Project description
timeconMT
A conversion from csv file to dictionary by Malphrus Tech
Usage
import
from csv2dictionary.csvpro import CsvBrain
use
data
case1 = CsvBrain('test.csv')
case1.data
#returns a list of dictionaries
#the first line in the csv are the keys in the dictionaries
headers
case1 = CsvBrain('test.csv')
case1.header_labels
#returns a list of Header labels
Search
case1 = CsvBrain('test.csv')
case1.search('dog')
#returns a list of dict's that contain "dog" as a value under any key
castInt
case1 = CsvBrain('test.csv')
case1.castInt('age')
#loops thru the list of dictionaries and changes cast all values under an 'age' key to integers
castInt
case1 = CsvBrain('test.csv')
case1.castFloat('age')
#loops thru the list of dictionaries and changes cast all values under an 'age' key to Floats
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
csv2dictionary-0.0.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for csv2dictionary-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6787cac19984f55784c0d393472f2f50493441b4c58c7cf7b0f7d28476dab0d |
|
MD5 | 31310ad22fd2bf1f7b3d4c3f6801ef0b |
|
BLAKE2b-256 | ff81aa859e6a605d9df7b6daef2354a06441ac112049338691fe5486dbf48357 |