Here is my dataframe:
*Ca *O *Ca Ca Hy
0 1 2 3 4 5
1 1
2 1 5
3 1 6 7 8
4 5
5 6
6 6
7 6
8 9
9 9 12
10 9 9 10 11
and when I tried to contact it like this:
pd.concat([df] [df i for i in range(10, 250, 10)], ignore_index=True)
I get errors like np.int is not iterable
and can not concate str to int
Also my dataframe contains NAN
, and I use df.fillna('', inplace=True)
to replace NAN with nothing ''
which it seems problem to convert to an int
CodePudding user response:
Try using df.fillna(0,inplace=True)
,
It should give out desired output, asreplacing the NaN value would not affect you sum.
Also my dataframe contains NAN , and I use
df.fillna('', inplace=True)
to replace NAN with nothing''
which it seems problem to convert to an int
As the data type of ''
is string (it is an empty string not nothing)
CodePudding user response:
I had to read from csv
to get float data and concat the data, but am still unable to convert it into integers.