This is a piece of my dataframe called df:
carrera cinta1 cinta2
0 0.61 499.556 611.029
1 0.876 499.556 611.029
2 1.082 499.556 611.029
3 1.167 499.556 611.029
4 1.337 0.045 611.029
I need to mulitply the column 'carrera' by a float (in this case 0.2)
My dataframe comes from a list:
def calculo(self, datos):
df2 = pd.DataFrame(datos)
df2.columns = ['carrera', 'cinta1', 'cinta2']
print(df2.dtypes)
Then I multiply the column by 0.2
df1 = df2['carrera']*0.2
print(df1)
This gives an error: can't multiply sequence by non-int of type 'float'
SOLVED
The data on the dataframe was an object type. When defining the dataset I added the following:
df2 = pd.DataFrame(datos, dtype=float)