<jupyter_start><jupyter_text>Data Understanding  Import Libraries<jupyter_code>%matplotlib inline

import pandas as pd
import numpy as np
from datetime import datetime
pd.set_option("display.max_rows", 500)
dataPath_Raw = ("../data/raw/COVID-19/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv")
dataPath_Processed = ("../data/processed/")
pd_raw = pd.read_csv(dataPath_Raw)
pd_raw.head();<jupyter_output><empty_output><jupyter_text>Extract the columns<jupyter_code>pd_raw.columns[:]
time_idX = pd_raw.columns[4:]
df_plot = pd.DataFrame({
    
    'date':time_idX})

df_plot.head()

len(pd_raw['Country/Region'].unique())
pd_raw['Country/Region'].unique();<jupyter_output><empty_output><jupyter_text>Define a DF with Country as a Column Name<jupyter_code>pd_raw[pd_raw['Country/Region']=="Afghanistan"];
pd_raw[pd_raw['Country/Region']=="India"].iloc[:,4::].sum(axis=0);
country_list = [
    'Italy',
    'US',
    'Spain',
    'Germany',
    'India',
    'Korea, South',
    'China',
    'Brazil',
    'United Kingdom'
]

#country_list = pd_raw['Country/Region'].unique()
for i in country_list:
    df_plot[i] = np.array(pd_raw[pd_raw['Country/Region'] == i].iloc[:,4::].sum(axis=0))
df_plot;
df_plot.set_index('date').plot()<jupyter_output><empty_output><jupyter_text>Data Type Date<jupyter_code>df_plot.head()<jupyter_output><empty_output><jupyter_text><jupyter_code>df_plot.date[0]
datetime.strptime(df_plot.date[0], "%m/%d/%y")
#Convert the String to DateTime object

time_idX = [datetime.strptime(i, "%m/%d/%y") for i in df_plot.date] 

# Converting back to ISO (str)

time_str = [i.strftime("%y-%m-%d") for i in time_idX]

#time_idX

#time_idX[0:5]
#type(time_idX)
df_plot['date']=time_idX
type(df_plot["date"][0])
df_plot.head()
df_plot.to_csv(dataPath_Processed + "COVID_Flat_Table_small.csv", sep=",", index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1713379164463247, 'fraction_numerical': 0.01110523532522475, 'mean_word_length': 7.016949152542373, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '143019', 'license': 'MIT', 'n_tokens_mistral': 788, 'n_tokens_neox': 763, 'n_words': 106, 'path': 'notebooks/1_Data_Preparation.ipynb', 'repo_name': 'ebinzacharias/ads_COVID-19', 'size': '1891'}