Numpy function to create arrays from tabular data.
Questions tagged [genfromtxt]
287 questions
0
votes
1 answer
python Genfromtxt how convert negative integer in to 0
img = np.genfromtxt (path+file,dtype=int,
invalid_raise=False,
missing_values= (all negatives), <<<---------------
usemask=False,
filling_values=0)
I need catch negative integers and…

Klasik
- 872
- 1
- 9
- 29
0
votes
1 answer
genfromtxt: numpy.darray, IndexError: too many indices
I have a csv file, and I try to open with
def datetime_from_str(string):
return dt.datetime.strptime(string, '%Y-%m-%d %H:%M:%S')
def main():
data = genfromtxt(
csv_name, delimiter=';', skip_header=1, dtype=None,
…

JuanPablo
- 23,792
- 39
- 118
- 164
0
votes
1 answer
numpy - merging rows with same time in array from csv data file
I have some data log files, where sadly the logger choose to log data with a timecode with a presicion in floating of the seconds, even though logging every 2 second. For that reason in some of the files there can be several lines for the same…

Termo
- 71
- 5
0
votes
1 answer
Python genfromtxt issue reading in multiple tables from one dataset
I am trying to read from all of these data tables separately for some data crunching and I can't seem to manage to do it.
The data is available here: http://cdsweb.u-strasbg.fr/topbase/tables/AGS05.OP17
There are 126 tables and it gives me empty…

Dominique Petit
- 25
- 1
- 4
0
votes
1 answer
python numpy import of uneven (data missing) array
I have a .txt array composed of strings and ints. The strings are titles for each column of ints except the first which is just numbering (i.e. 8 columns of string titles at [1:8] and then every other row is 9 columns at [0:8].
I want the numbers…

user3470496
- 141
- 7
- 33
0
votes
1 answer
Reading From text file Javascript
Okay, this may be hard to explain.
The Passwords don't work the usernames do.
I am reading from a text file.
"username,password" is the structure for the below is the text file
John,BOL12345
Mary2,BOL77777
Anna,BOL54321
test,BOL12345
The top 3 do…

Vaughan D
- 149
- 1
- 1
- 15
0
votes
1 answer
strange result. txt file to np.array
I'm trying to do something simple but for some reason I cannot. I have been looking for related answers in the site but I haven't been able to accomplish.
So, I'm trying to import a text file, csv, or rtf to an np.array, so far I have…

tcassanelli
- 175
- 8
0
votes
3 answers
Python - Converting long list of addresses into list of strings and intersection of lists
I have two very long text files (thousands of e-mail addresses, one per line) an I'm looking for a way to compare the two files and have an output with the adresses contained in the first file and in the second file but not in both of them…

DavideL
- 294
- 1
- 3
- 15
0
votes
1 answer
Is it possible to change the type of just one column in a numpy array created from genfromtxt?
I'm creating a numpy array which then will be exported into a django model. As dtype attribute I have a None, but I have one column which should be an integer which admits NULL values. Now, when in the csv a 'NULL' string is found, the type of that…

foebu
- 1,365
- 2
- 18
- 35
0
votes
1 answer
the dtype parameter in numpy genfromtxt
I am trying to create MX2 numpy matrix or array from the following file contents:
shell: head WORLD#America.csv
"2013-04-17 12","3","WORLD","#America"
"2013-04-17 13","9","WORLD","#America"
"2013-04-17 14","4","WORLD","#America"
"2013-04-17…

CodeKingPlusPlus
- 15,383
- 51
- 135
- 216
0
votes
1 answer
numpy function IOError
On my macbook air running OSX Mavericks (I'm almost certain this wasn't happening the other day on a PC running Windows 7 running virtually identical code) the following code gives me the following error.
import numpy as…

LlamaD
- 382
- 6
- 15
0
votes
2 answers
How do you allow for text qualifiers using numpy genfromtxt
I am currently trying to import some comma delimited text data into an array using the numpy library in Python. I am using the following code:
data = np.genfromtxt(fname, delimiter=',')
I get the following error:
Line #2 (got 12 columns instead…

ChrisProsser
- 12,598
- 6
- 35
- 44
0
votes
1 answer
php script that loads txt file/s and generates rss - cron?
I would like to make a script that gets lines from txt file and makes new rss feed item for every line. Txt file will be frequently updated with new lines of data, so the script should check every hour if there is a new line, and if there is, needs…

Jason Stewart
- 15
- 5
0
votes
2 answers
How to selectively import only lines of words with genfromtxt into Python?
I have a data text file which has the following format:
1 2 2 3 4 5 6
1 5 8 9 3 4 2
1 2 3 5 1 2 3
Timestamp 1
5 4 8 9 8 7 2
1 5 9 6 3 1 2
Timestamp 2
...
I wish to import the data in such a way that:
I can ignore the timestamps first and…

Sibbs Gambling
- 19,274
- 42
- 103
- 174
0
votes
1 answer
read csv/txt file with genfromtxt while separating values for numbers and datetime
I am desperately trying to read and convert a txt file like this:
file.txt
Line,Date Time,Celsius(°C),Humidity(%rh),Dew Point(°C),Serial Number
1,10-06-2013 18:25:00,24.0,48.5,12.5,990121703
2,10-06-2013 18:30:00,24.0,48.0,12.3
3,10-06-2013…

Pythonio
- 2,039
- 2
- 12
- 5