AttributeError: ‘float’ object has no attribute ’round’
Just change this: a = 3.56803 print(a.round(2)) to this: a = 3.56803 print(round(a, 2))
Just change this: a = 3.56803 print(a.round(2)) to this: a = 3.56803 print(round(a, 2))
In my case the .csv file had strings as date and time with the following format: 30/07/2017 21:01:17 I find this to be the simplest way to convert this column to float: df[‘dateTime’] = df[‘dateTime’].str.replace(‘/’, ”) df[‘dateTime’] = df[‘dateTime’].str.replace(‘:’, ”) df[‘dateTime’] = df[‘dateTime’].str.replace(‘ ‘, ”) df[‘dateTime’] = df[‘dateTime’].astype(float) So we are removing any signs and … Read more