Numpy function to create arrays from tabular data.
Questions tagged [genfromtxt]
287 questions
0
votes
1 answer
Using datetime.strptime to get dates from .csv column
Please please help!!
Having a lot of trouble with this code. The task here is to plot some information (High, Low and Medium) against dates associated with them.
The data is found in a .csv file, with the Headings as : Date, High, Medium, Low. …

ElenaFF
- 3
- 2
0
votes
1 answer
How to import such data in python 3.0 using genfromtxt
I am using
genfromtxt('84MHZN01.TBL',delimiter='\t',dtype=None,skip_header=41,skip_footer=2)
to import the data like
[ b'-0.300000 0.00000 9.052297E+00 0.000000E+00 9.052297E+00 0.000000E+00'
b'-7.700000E-02 0.00000 …

rfeynman
- 97
- 1
- 9
0
votes
2 answers
Fast data reading from text file in numpy
How can I speed up the data reading and type converting using numpy? I face in addition the issue of getting numpy.void type objects, because of the heterogeneous arrays as far as I know, instead of ndarrays. I have created a simple test that shows…

Mantxu
- 319
- 2
- 11
0
votes
1 answer
NumPy genfromtxt - skipping rows that start with specific number
I have a file in which the first column has an integer number that tells whether it is data of metadata - lines that start with 0 are metadata, and the number of columns in them is not fixed, while any other integer designate data lines:
0 …

Ohm
- 2,312
- 4
- 36
- 75
0
votes
1 answer
Using numpy genfromtxt to read in data in single column to multiple columns using text headers
I am trying to import some data (pressures, stresses) for a set of pre-defined x,y points from a file using genfromtxt. Where the data is just output as a long column split up by a header names, for example:
time
1.0022181
PORE_PRE
…

Tom Lynch
- 183
- 1
- 1
- 7
0
votes
1 answer
Not to make 'nan' to '0' when reading the data through numpy.genfromtxt python
Now I am trying to read the array in the file named "filin1" such as:
filin1 = [1,3,4, ....,nan,nan,nan..] (in the file, actually it is just a column not an array like this)
So, I am trying to use numpy.genfromtxt as:
…

Isaac
- 885
- 2
- 15
- 35
0
votes
1 answer
Working with the elements of the "matrix" created by genfromtxt, Python3.4
I import a .txt file with the command tab = np.genfromtxt() and it creates a kind of matrix. I need to work with its contents.
When I visualize the elements with the command
for i in range n:
print(tab[n][:])
it works and I can use matrix…

Raizen
- 99
- 2
- 10
0
votes
1 answer
python How to split irreguarly delimited file?
I have an interesting problem that has arisen due to some newly formatted and poorly structured data files. They are text files, comma delimited, that contain multiple sets of data each with a unique header. Originally I was using genFromTxt to…

Twisterkid34
- 165
- 1
- 2
- 11
0
votes
1 answer
genfromtxt import data from csv file issue
My csv file(K2CsSb DOS135.csv) is very simple like:
-7.21E+00 1.34E-01
-7.16E+00 1.15E-01
-7.13E+00 0.00E+00
-7.10E+00 0.00E+00
-7.07E+00 0.00E+00
And I use genfromtxt to import this file like:
dosdata = genfromtxt('K2CsSb…

rfeynman
- 97
- 1
- 9
0
votes
1 answer
Concatenate many lists from text files
I have a few thousand lists in text files. For example:
text1.txt:
1,2,3,4
text2.txt:
a,b,c,d
I want to open all of my text files and put them all into one list, like so:
[1,2,3,4,a,b,c,d]
However, all of the loops I have tried either give me a…

Hannah
- 165
- 2
- 3
- 13
0
votes
1 answer
Importing just one value with numpy.genfromtxt
I would like to import just one value from a csv file. So far, I have been succesfull at using the skip_header and skip_footer options to seek out this element. It is a float value. One problem though, when I try to use this one element from my…

handroski
- 81
- 2
- 3
- 15
0
votes
1 answer
Python numpy.genfromtxt
Does anyone know, how I could skip the parenthesis from a text file I trying to read using numpy.genfromtxt
My data file is of the format
1.466 ((5.68 3.3 45.7)(4.5 6.7 9.5))

Ashwin Parambath
- 23
- 6
0
votes
0 answers
Opening text file with pandas, where some rows have a different format
Hi I am starting to learn pandas to deal with text files. So far I have been using numpy loadtxt but I am having some issues with some text files generated by a very old program (which I cannot…

Delosari
- 677
- 2
- 17
- 29
0
votes
1 answer
Putting multiple columns into callable sub arrays python
I have a set of data which is in columns, where the first column is the x values. How do i read this in?

pythonman11
- 1
- 1
- 5
0
votes
2 answers
Putting multiple columns of data into one array, python
So I have a set of data which has a singular column for x data and multiple columns for y data, of the form.
x_title y_title_1 y_title_2 y_title_3 .... y_title_n
data_x1 data_y2 data_y3 data_y4 data_yn
.... …

pythonman11
- 1
- 1
- 5