Reputation: 21
a= []
for item in soup2.findAll("div", class_='x'):
where_to_watch = item.find_all('b')
watch_at.append(x)
dataFrame = pd.DataFrame(data = a)
dataFrame.to_excel('x.xlsx')
print(dataFrame)
Hello Guys How can i add "text" when the value is none? or maybe add NAN value...
Upvotes: 1
Views: 32
Reputation: 26
I think you could use fillna()
method to achieve your goal. It would look like that:
dataFrame = dataFrame.fillna("text")
dataFrame.to_excel('watch.xlsx')
Also there's a function called isna()
. You could use it like that:
if pd.isna(where_to_watch):
where_to_watch = "text"
watch_at.append(where_to_watch)
dataFrame.to_excel('watch.xlsx')
Upvotes: 1