Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

Converting a multiple spaced text data into dataframe/excel/csv

$
0
0

I have a data in txt format with 38 columns which looks like this. Except the header row, most of the rows have missing values.I want to convert this table into an array/dataframe/excel. But it is not coming as it looks in table.

I tried using python

df = pandas.read_csv(filename, sep='\s+',names=colnames, header=None)

I am confused about what seperator to use.

The program should look for value after single space. If no value is present, fill it with nan. How to do that?
Thanks in advance!


Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>