Numpy function to create arrays from tabular data.
Questions tagged [genfromtxt]
287 questions
0
votes
0 answers
Looping through a genfromtxt object to obtain substrings and put into sqlite database
I'm very new to python and I'm trying to build this database using SQLalchemy and SQLite3.
There is a zip file of csv files that I am trying to process and put into a SQLite database. I have converted the csv files into tables, and one of the tables…

Stats_Dunce
- 23
- 6
0
votes
2 answers
humpy.genfromtxt input fname argument from list
I have a number of text files as output from a calculation from which I wish to extract data:
(Note: Because some of the files are rather mangled, I have placed copies in my Dropbox. The URL is…

Steve
- 153
- 2
- 13
0
votes
1 answer
NumPy Generates ValueError: Some errors were detected ! Line #9 (got 42 columns instead of 1)
I am writing code to combine text files and I have encountered an error that I am having trouble solving. Google is no help.
The code is:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 09:51:55 2019
@author:…

Steve
- 153
- 2
- 13
0
votes
1 answer
Adding names parameter to numpy genfromtxt causing to read empty strings for data
I can read the data file fine, but as soon as I try to add the name parameter either by specifying the names myself or reading from the first row I get back empty strings
data_no_headers =…

HockeyGeekGirl
- 11
- 2
0
votes
1 answer
Finding zero crossing in python
I have written the following code to see in which t my ODE "exponential_decay" crosses the zero line. this is Brent Method.
odr, hr, dr, cr, m = np.genfromtxt('data.txt',unpack=True)
n=0
with open('RDE_nob_trans.txt', 'w') as d:
for i in…

Ma Y
- 696
- 8
- 19
0
votes
1 answer
Parsing data with variable number of columns
I have several .txt files with 140k+ lines each. They all have three types of data, which are a mix of string and floats:
- 7 col
- 14 col
- 18 col
What is the best and fastest way to parse such data?
I tried to use numpy.genfromtxt with…

Ali R.
- 433
- 2
- 4
- 11
0
votes
1 answer
How do I load data from textfile, where one column of the table is an array?
I want to load data from a text file of the following format:
Sarah, 0.5 0.2 2.0
Where (0.5, 0.2, 2.0) is a vector that describes Sarah. The vector is shortened here. In the actual textfile the vector spans multiple lines.
I have tried :
data =…

ganto
- 102
- 7
0
votes
1 answer
calculating Average of each cell across multiple csv
i have multiple csv files (n) with fixed headers and 100 rows, and i'm trying to calculate the average (or other things such as Min or Max) of all [i][j] elements of these tables and store it in one final csv table. I tried genfromtxt but it did not…

Saeid Hedayati
- 83
- 1
- 3
- 12
0
votes
0 answers
remove CP932 encoded text from data file comments with np.genfromtxt
I am trying to import a data file using np.genfromtxt
The data file contains a large commented header, each line beginning with the comment character *
When using the comments='*' kw in genfromtxt, I am still raising an error due to a weird…

Brooks
- 21
- 2
0
votes
0 answers
Read ASCII-File with missing data fields with numpy.genfromtxt
My data file is like this:
abb
sdsdfmn
sfdf sdf
2011-12-05 11:00 1.0 9.0
2011-12-05 12:00 44.9 2.0
2011-12-05 13:00 …

mcatis
- 1,176
- 4
- 11
- 24
0
votes
1 answer
(Python) numpy genfromtxt convert problem
i use
netdata = num.genfromtxt('resultscut.rw', dtype=None, delimiter = '|', usecols=(0,1,2,3,4))
to generate a list out of a text data file. This works really nice but when i put a bigger data file to convert i get this error:
File…

QWERASDFYXCV
- 245
- 1
- 6
- 15
0
votes
1 answer
how to plot data in python from a file were the first column is a string and the second column is a number?
Suppose I have a file called FARM with the following data
pigs 23
horses 10
cows 35
goats 20
sheep 22
chickens 62
roosters 5
I'd like to plot this data with the following result
The following code does exactly what I want
import matplotlib.pyplot…

hagbard7000
- 19
- 3
0
votes
1 answer
Difference in genfromtxt between Anaconda and Canopy
i am using Anaconda (spyder IDE) to program in Python, but I recently installed Canopy. In most of my programs I'm using genfromtxt command to load data into my programs. The whole line looks like…

otter
- 93
- 2
- 8
0
votes
1 answer
np.loadtxt vs np.genfromtxt
when I use the following np.loadtxt code to load the data of the format:
2017-07-26,153.3500,153.9300,153.0600,153.5000,153.5000,12778195.00
the data gets loaded just fine, loadtxt code->
a, b, c, d, e, f, g = np.loadtxt("goog.csv",
…

conjuring
- 121
- 16
0
votes
2 answers
importing from file vs internet in genfromtxt numpy date “TypeError: must be str, not bytes” using python 3.6
Strange enough! but, applying np.genfromtxt() function on the file(goog.csv), wherein the data has been downloaded and stored from a source, produces no error.Following is the code->
import numpy as np
from matplotlib.dates import…

conjuring
- 121
- 16