I have a column of hyperlinks in a dataframe and I have to extract the text for sentimental analysis. I can read the text but I'm unable to proceed further, looping over the process and appending it to a file is what I am looking for.
import urllib.request
import requests
import csv
from bs4 import BeautifulSoup
quote_page = 'https://www.sec.gov/Archives/edgar/data/3662/0000950170-98-000413.txt'
page = urllib.request.urlopen(quote_page)
soup = BeautifulSoup(page,'html.parser')
name_box = soup.find
print(name_box)
with open('index1.csv', 'a') as csv_file:
writer = csv.writer(csv_file)
writer.writerows([name_box])
Now, when I executed this, I got a CSV but the text was not in a row. So, What to do, and how to do this for each link in the dataframe.