<jupyter_start><jupyter_text>GitHub dataThe data is taken from World Bank dataset provided in GitHub under the link: https://github.com/datasets/population<jupyter_code>#data_path_population = '../ads_covid-19/data/raw/population/data/population.csv'
#population_raw = pd.read_csv(data_path_population)
#population_raw
#population_raw.dtypes()<jupyter_output><empty_output><jupyter_text>Web Scrapingto get population of countries from https://www.worldometers.info/world-population/population-by-country/<jupyter_code>page = requests.get("https://www.worldometers.info/world-population/population-by-country/")
soup = BeautifulSoup(page.content, 'html.parser')
soup.get_text()
html_table_pop = soup.find('table')
all_rows_pop = html_table_pop.find_all('tr')
final_pop_data_list=[]
for pos,rows in enumerate(all_rows_pop):
    col_list= [each_col.get_text(strip=True) for each_col in rows.find_all('td') ]
    final_pop_data_list.append(col_list)
reqd_pop_list = pd.DataFrame(final_pop_data_list).dropna()\
                    .rename(columns={1:'country', 2:'population'})
reqd_pop_list
reqd_pop_list = reqd_pop_list[['country','population']]
reqd_pop_list
reqd_pop_list["country"]= reqd_pop_list["country"].replace({'Myanmar':'Burma', 'Czech Republic (Czechia)': 'Czechia', 'DR Congo': 'Congo (Kinshasa)', 'Congo': 'Congo (Brazzaville)', 'South Korea': 'Korea, South', 'St. Vincent & Grenadines': 'Saint Vincent and the Grenadines', 'Taiwan': 'Taiwan*', 'United States': 'US','State of Palestine': 'West Bank and Gaza', 'Côte d\'Ivoire': 'Cote d\'Ivoire'})
list_new_country = [pd.Series(['Diamond Princess', 3711], index = reqd_pop_list.columns ) ,
                    pd.Series(['Kosovo', 1845000], index = reqd_pop_list.columns ) ,
                    pd.Series(['<NAME>', 1432], index = reqd_pop_list.columns ),
                    pd.Series(['<NAME> and Nevis', 52441], index = reqd_pop_list.columns ),
                    pd.Series(['<NAME> and Principe', 211028], index = reqd_pop_list.columns )]
reqd_pop_list = reqd_pop_list.append(list_new_country, ignore_index=True)\
                                .sort_values('country')\
                                .reset_index(drop=True)
reqd_pop_list
reqd_pop_list.to_csv('/Users/anweshapanda/ads_covid-19/data/raw/population_data.csv',sep=';',index=False)
reqd_pop_list.columns<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1464240372407956, 'fraction_numerical': 0.013542107490478206, 'mean_word_length': 4.822660098522167, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '549351', 'license': 'FTL', 'n_tokens_mistral': 865, 'n_tokens_neox': 806, 'n_words': 131, 'path': 'notebooks/World_Population_Data_Preparation_V1.0_Final.ipynb', 'repo_name': 'panwesha/eds', 'size': '2374'}