Python Forum

Full Version: non-finite value error when cleaning data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,after scraping data i tried to clean it and i got the following error message
Quote:ValueError: Cannot convert non-finite values (NA or inf) to integer
when i searched i found this error is raised when i have a empty field (but i verified my data and all the fields are not empty)

my code is the following :
test_df.loc[:'year'] = test_df['year'].str[-5,-1].astype(int)
and the column of value that i want to clean has this values:
Quote:array(['(2017)', '(I) (2017)'], dtype=object)

and my aim is to get just the year without bracket