Python Forum
non-finite value error when cleaning data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
non-finite value error when cleaning data
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the error of not being able to pull data in this code? i didn't see an error? TestPerson 2 1,223 Sep-30-2022, 02:36 PM
Last Post: DeaD_EyE
Bug Need Pointers/Advise for Cleaning up BS4 XPATH Data BrandonKastning 0 1,241 Mar-08-2022, 12:28 PM
Last Post: BrandonKastning
  cleaning HTML pages using lxml and XPath wenkos 2 2,464 Aug-25-2021, 10:54 AM
Last Post: wenkos
  Cleaning HTML data using Jupyter Notebook jacob1986 7 4,145 Mar-05-2021, 10:44 PM
Last Post: snippsat
  Need Tip On Cleaning My BS4 Scraped Data digitalmatic7 2 3,227 Jan-29-2018, 08:49 PM
Last Post: digitalmatic7

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020