0

I am importing an excel sheet into a Dataframe. When call dtypes in python I get the column as an Object.

I am turning it to float with a function and then .apply()

When I do a

df.groupby(['A'])['B'].sum()

I get this error:

 unsupported operand type(s) for +: 'int' and 'datetime.datetime'

I´ve checked the excel sheet and there are only numbers. How can I transform this data into integer or ignore the values that python can´t transform?

There are Nan values in this column.

teamyates
  • 414
  • 1
  • 7
  • 25
user1922364
  • 513
  • 2
  • 8
  • 19
  • 1
    `df.astype(float).grouby(by=['A']).sum()` – Paul H Jul 13 '18 at 15:01
  • This solution is not working. I am doing this: df_estoque_atraso_1.astype(float).grouby(by=['Num. Pedido']).sum() and getting this: TypeError: cannot astype a datetimelike from [datetime64[ns]] to [float64] – user1922364 Jul 13 '18 at 15:10

0 Answers0