<jupyter_start><jupyter_text>Sci-Fi by Female Authors> Scrape > >> Rank>>>> Title>>>> Author>>>> Score>>>> Votes>>>> Rating>> Clean and separate data<jupyter_code>import requests
import re
import pandas as pd
from bs4 import BeautifulSoup
response = requests.get('https://www.goodreads.com/list/show/6934.Science_Fiction_Books_by_Female_Authors')
doc = BeautifulSoup(response.text)
### TEST VIEWS OF DATA
# print(doc)
# print(doc.prettify())
### TESTS of Individual Lines
doc.find_all('table')
# group = doc.find_all('table')
# group = doc.find('div', id='all_votes')
# group = doc.find_all(class_='tableList')
# group
# group.find_all('span')
# group.find_all('tr')
# group.find_all('td')
# group.find_all('a')
# group.find_all('a', class_='bookTitle')
# group.find("#all_votes > table > tbody > tr:nth-child(1)")



# #all_votes > table > tbody > tr:nth-child(1) > td:nth-child(3) > a
site_list = doc.find_all(class_="chart-details")
songs = []
for item in site_list:
    song = {}
    song['rank'] = item.find(class_='chart-list-item__rank').string
#     song['artist'] = item.find(class_='chart-list-item__artist').string
#     song['title'] = item.find(class_='chart-list-item__title-text').string
    songs.append(song)
songs


#main > div.container.chart-container.container--xxlight-grey.container--no-side-padding > div > div:nth-child(1) > div.chart-list-item.now-playing
df = pd.DataFrame(songs)
df.head(25)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18093922651933703, 'fraction_numerical': 0.007596685082872928, 'mean_word_length': 5.586363636363636, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '631833', 'license': 'MIT', 'n_tokens_mistral': 551, 'n_tokens_neox': 525, 'n_words': 89, 'path': '09-sci-fi-by-female-authors.ipynb', 'repo_name': 'domhnallog/09-homework', 'size': '1448'}