How to return N/A in python?
Answers
Answered by
1
am new to Scraperwiki and Python, and trying to figure out how to return "NA" or something similar when there is no item on a scraped webpage that meets my cssselect specifications.
In my code below, I am scraping a double-nested set of webpages. When I scrape a sub-page that does not have a value for the cssselect attribute, it simply copies the value of the last scraped page for which there was a value.
In my code below, I am scraping a double-nested set of webpages. When I scrape a sub-page that does not have a value for the cssselect attribute, it simply copies the value of the last scraped page for which there was a value.
Answered by
0
To return N/A in python:
- There are various ways to tackle this problem:
1.) To replace null values with a space (" ").
2.) To replace null values with mean/median/mode of the respective
columns.
3.) To delete the record/row containing null value.
- Import pandas from library.
- Create pandas data frame and import csv file into it.
- Check the number of rows and columns in the data frame.
- Check for null values.
- Check the sum of NA values.
Similar questions
Math,
7 months ago
Math,
1 year ago
English,
1 year ago
History,
1 year ago
Social Sciences,
1 year ago