Questions tagged [genfromtxt]

Numpy function to create arrays from tabular data.

References

287 questions
0
votes
1 answer

Last of word of each line needs to be skipped?

I'm trying to write a code that will skip the last word while reading txt file. I am not sure how to go about outputting the line without including the last line and the space before it. Any help would be appreciated, I'm new to c++.
0
votes
1 answer

How to use names when importing csv data into matplotlib

I cannot figure out how to use the "names" in matplotlib when plotting data returned by numpy.genfromtxt command. Scenario: 1. I have a file with columns headers and rows of values 2. I don't know the column headers beforehand--they are generated…
stefano
  • 769
  • 2
  • 10
  • 24
0
votes
3 answers

PHP - Getting text from a text file and using them in a "loop"!

Im new to php, and i really need some help with this script. I have a text file with names(serverlist.txt). The first line of code gets these names. I want it to get one name, put it in to the last bit of code(), Then repeat the process untill there…
0
votes
2 answers

genfromtxt and numpy

I have data in files such as "file.csv". I would like to read them with np.genfromtxt and do some statistics like average, variance etc. on some columns (X, Y, Z). However I want to make the statistics on for X > 1, Y > 3 Z > 2 etc. This is a simple…
Moe Abbas
  • 1
  • 2
0
votes
1 answer

How to read a file from the bottom with numpy.genfromtxt in python

I have a file that is updated every 60 seconds with some data. I want to be able to read from the bottom of the file backwards so I can plot out the last 6 hours of data into a graph. I am able to read the first 360 lines (see below), but this is…
Mwilliams03
  • 311
  • 3
  • 14
0
votes
1 answer

How to generate a pdf or text file from windows form application

I am creating a desktop windows form application with database attached.. the first screen consists of a form that user is supposed to fill, if he/she wants to print this form.. is there any solution that a file in pdf form be created dynamically,…
0
votes
1 answer

Genfromtxt does not return column names

I want to convert a csv into a numpy array. The first row of the csv file contains the names / titles of the columns. But when I use genfromtxt with the names parameter set to true I still receive only a normal numpy array with a lot of NaN values.…
Framester
  • 33,341
  • 51
  • 130
  • 192
0
votes
1 answer

Using : operator to index numpy.ndarray of numpy.void (as output by numy.genfromtxt)

I generate data using numpy.genfromtxt like this: ConvertToDate = lambda s:datetime.strptime(s,"%d/%m/%Y") data= numpy.genfromtxt(open("PSECSkew.csv", "rb"), delimiter=',', dtype=[('CalibrationDate',…
Dan
  • 45,079
  • 17
  • 88
  • 157
-1
votes
1 answer

np.genfromtxt could not convert string to float

I was writing this code to make some data graphs on my jupyter notebook, and when I tried bringing in data from a csv file, I got a "could not convert string to float" error. So here's my code: phot_g = np.genfromtxt('gaia_hyades_search.csv',…
Arvin
  • 3
  • 2
-1
votes
2 answers

h5py doesn't support NumPy dtype('U') (Unicode) and pandas doesn't support NumPy dtype('O')

I'm trying to create a .h5 file with a dataset that contains the data from a .dat file. First, I approach this using numpy: import numpy as np import h5py filename = 'VAL220408-invparms.dat' datasetname = 'EM27_104_COCCON_VAL/220408' dtvec =…
-1
votes
1 answer

Python genfromtxt cannot import file from local machine to google colab

I am just trying to import a .txt file from my D: drive of my windows machine to google colab using genfromtxt() of numpy from python. But I cannot find a way to import. All I get is error "File not found" as the current working directory is point…
Vikram
  • 1
  • 1
-1
votes
1 answer

Converting height data from CSV file to IMG

I have some height data from a microscope. My question is: How can I convert CSV files to an IMG output and scale the color correctly? The data I have are CSV files like: 90,40,50,30,20 11, 2, 7,30,20 90,40,50,30,50 16,40,50, 4, 6 90,…
Max
  • 3
  • 2
-1
votes
2 answers

Get header in genfromtxt when using skip_header

I have data I want to plot and analyse, looking like: 0101 1 3 2 4 3 6 I use skip_header in genfromtxt to load the file 2 column data, however I also need the header for reference. Is there a way to get the header back?
StarStrides
  • 121
  • 3
  • 10
-1
votes
1 answer

Python read CSV file no functions

I am currently in a class that is a beginners course for python. We have an assignment instructing us to read the contents of the data file into a floating point array data2 without using genfromtxt or any other pre-written file-reading function.…
-2
votes
2 answers

How to turn a comma seperated value TXT into a CSV for machine learning

How do I turn this format of TXT file into a CSV file? Date,Open,high,low,close 1/1/2017,1,2,1,2 1/2/2017,2,3,2,3 1/3/2017,3,4,3,4 I am sure you can understand? It already has the comma -eparated values. I tried using numpy. >>> import…
1 2 3
19
20