I am trying to load this data-frame (df):
3 4
5 7 4 2 4
1 2 1 2 1
It is important to mention that shape of the df is 4,5 ... in other words 4 rows and 5 columns, but in the first row some values are missing. The df is space separated.
I am trying to read this table like this:
df = genfromtxt('table')
but getting this error:
ValueError: Some errors were detected ! Line #2 (got 5 columns instead of 2) Line #3 (got 5 columns instead of 2)
Is there any way to tell python that this df contains 5 columns and that some data are missing?
I try the similar with:
df = pd.read_table('table', delim_whitespace=True, header=None)
but getting this error:
ParserError: Error tokenizing data. C error: Expected 2 fields in line 3, saw 5
In this case the question is similar, is there any way to tell python (this time using pandas) that my df has 5 columns?