Skip to main content

Easy way to read data files

Project description

This package provides an easy way to open a datafile by returning a “modified” dictionnary (see Guessing) of numpy arrays that corresponds to the differents columns.If the column contains strings it will return an array of strings.

By default it will try to guess the indexation from the commentaries, and if failed will index it from 0 to n:

#!/usr/bin/env python

from datafile.extractfile import dataFile

f = dataFile("./datafile/test/testdocfile.txt")
# the index will be guessed and if not found it will
# be indexed from 0 to n

f = dataFile("./datafile/test/testdocfile.txt",index="auto")
#f will be indexed from 0 to n

#f["0"] will return a numpy array of the first column.
#f["0",1] will return a numpy array of the index number 1 of the first column,
# if the column is divided in index (ensemble of points separated by one or more space)

f = dataFile("./datafile/test/testdocfile.txt" , "A B C D")
#f will be indexed on "A" "B" "C" (if three columns)
f = dataFile("./datafile/test/testdocfile.txt" , ["A", "B","C","D"]
#f will be indexed on "A" "B" "C"

Guessing

if the datafile contains in the commentaries a line like: #Lx(nm) Ly(nm) D(A) and the file at three column, it will index the three columns with “Lx(nm)” “Ly(nm)” , “D(A)”:

#!/usr/bin/env python
f = dataFile("./file")
f["Lx"]
f["x"]
#both are going to return the first column
f["nm"]
#will return a key error

Main usage

I use it with ipython to plot datas and explore them. Lauching ipython -pylab will launch a ipython with matplotlib loaded. After loading the file with dataFile you can plot the data with only typping plot(f[“A”],f[“B”])

email : jeanmichel.arbona@gmail.com

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

DataFile-0.1.6.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

DataFile-0.1.6.linux-x86_64.exe (68.7 kB view details)

Uploaded Source

File details

Details for the file DataFile-0.1.6.tar.gz.

File metadata

  • Download URL: DataFile-0.1.6.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for DataFile-0.1.6.tar.gz
Algorithm Hash digest
SHA256 54368dc1528e2901fcaaa737534f2ce00bbecea57668d31408b25568e255de20
MD5 d662415e074dea01accf29afd5953566
BLAKE2b-256 080cde716b3be99ccff647de998d299851d6f945f576c2f31cf4d5c743e694e5

See more details on using hashes here.

File details

Details for the file DataFile-0.1.6.linux-x86_64.exe.

File metadata

File hashes

Hashes for DataFile-0.1.6.linux-x86_64.exe
Algorithm Hash digest
SHA256 d4cb6042b1d097898a8faa1790684b5a37634e80bee76ce32b1e5ebe75cf6e09
MD5 ee238cbc5a8aa565771da72312db8dc5
BLAKE2b-256 977cea2ea529e27944b7965edb8053b5bf77a9ff1af36cfa15b9b4fd0191bd08

See more details on using hashes here.

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