Matlab importdata () function equivalent in Python

There is an importdata function on matlab that imports data from ASCII files and puts them in a structure with two variables: textdata and data. It automatically determines the data format (string, float, etc.), Headers and separator. This function comes in handy to me, so I'm looking if there is something equivalent in python packages like numpy and scipy. I use numpy.loadtxt, but sometimes I have to use skiprows, delimiter, usecols and dtype at the same time. Does anyone know a function that identifies it in a simpler way?

+3
source share
1 answer

It looks like pandas http://pandas.pydata.org could be the way to go if you want a truly seamless import. I saw that pandas handles all sorts of strange missing / corrupted data gracefully. However, you have slightly more complex data structures than you would otherwise be looking for.

pandas.read_csv("file")
+1
source

All Articles