<jupyter_start><jupyter_text>Study on general information and notes<jupyter_code>soup.title.text.split(' ')[2]
city_dimension_label = {
     'Environnement': 'environment',
     'Transports': 'transport',
     'Sécurité': 'security',
     'Santé': 'health',
     'Sports et loisirs': 'sport_entertainment',
     'Culture': 'culture',
     'Enseignement':'education',
     'Commerces': 'business',
     'Qualité de vie': 'life_quality'
 }
dict_cities_notes = {}
city_note = {}
city_note['name'] = soup.find(id='colleft').find('h1').text.split(' ')[0]
city_note['postal_code'] = soup.find(id='colleft').find('h1').text.split(' ')[1][1:-1]
general_note = soup.find(id='ng')
city_note['general_note'] = float(general_note.text.split(' ')[0].replace(',','.'))
city_note['count'] = int(soup.find(id='nobt').text.split(' ')[-2])
# city_note['ranking']
general_note_table = soup.find(id='tablonotes')
for label_note in general_note_table.find_all('tr'):
    city_note[city_dimension_label[label_note.find('th').text]] =  float(label_note.find('td').text.replace(',','.'))
city_note['update_time'] = datetime.now()
soup.find(id='classt').find('b').text
dict_cities_notes['puteaux'] = city_note
dict_cities_notes<jupyter_output><empty_output><jupyter_text>Study on user reviews<jupyter_code>import re
review_blocks = soup.find_all(class_='comm')
len(review_blocks)
review_block = review_blocks[0]
review_block.find_all('p')[0].text<jupyter_output><empty_output><jupyter_text>get edit time<jupyter_code>re_search = re.search(r'\d{2}-\d{2}-\d{4}',review_block.find_all('p')[0].text)
date_text = re_search.group(0)
re_search = re.search(r'\d{2}:\d{2}',review_block.find_all('p')[0].text)
time_text = re_search.group(0)
post_time = datetime.strptime('{}-{}'.format(date_text, time_text),'%d-%m-%Y-%H:%M')
dimensions = [th.text for th in review_block.find_all('th')]
notes = [int(td.text) for td in review_block.find_all('td')]
review_block_data = {
    'time': post_time,
    'mean':float(review_block.find(class_='moyenne').text),
    **dict(zip(dimensions, notes)),
    'positive': review_block.find_all('p')[1].text,
    'negative': review_block.find_all('p')[2].text,
    'count_agree': int(review_block.find_all('p')[3].find_all('strong')[0].text),
    'count_disagree': int(review_block.find_all('p')[3].find_all('strong')[1].text)
}
review_block_data<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2069110830172777, 'fraction_numerical': 0.010956595027391488, 'mean_word_length': 7.186206896551724, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '252864', 'license': 'MIT', 'n_tokens_mistral': 926, 'n_tokens_neox': 916, 'n_words': 109, 'path': 'notebooks/20210512YX-VilleIdeale-PageStructure.ipynb', 'repo_name': 'sheridonx/city_reviews_study', 'size': '2373'}