<jupyter_start><jupyter_text>KERRY MATRIX- author: <NAME> - toc: true - badges: true- comments: true- categories: [Matrix]- image: images/kerry.png<jupyter_code>#collapse
#IMPORTING LIBRARIES AND DATA FILES
import pandas as pd
mat=pd.read_csv('../us_m.csv')
kerry=pd.read_csv('../kerry.csv')
rt = pd.read_csv('https://d14wlfuexuxgcm.cloudfront.net/covid/rt.csv')
da = pd.read_csv('https://covidtracking.com/api/v1/states/daily.csv')
#collapse
#FORMATING DATA FROM LAST WEEKS MATRIX TO MOVE WEEKLY DATA OVER
mat.columns = map(str.lower, mat.columns)
col=['state','social index current','rt current','test increase current','tpr current',
     'weekly deaths current','total deaths current','total tests current']
newCol=mat[col]
newerCol=newCol.rename(columns={'social index current':'social index past' ,'rt current':'rt past' ,'test increase current':'test increase past',
       'tpr current':'tpr past', 'weekly deaths current':'weekly deaths past', 'total deaths current':'total deaths past',
       'total tests current':'total tests past'})
kerry.columns=map(str.lower, kerry.columns)
#collapse
#CLEANING THE RTLIVE DATA
today='2020-08-03'
rtCleaned = rt[rt['date']==today]
rtColumns = ['date', 'region', 'mean']
rtCleaned = rtCleaned[rtColumns]
rtCleaned = rtCleaned.rename(columns = {'region':'state'})
rtCleaned = rtCleaned.sort_values('state', ascending=True)
#collapse
#CLEANING THE DAILY COVID DATA
dateRange='20200803'
dailyColumns = ['date', 'state', 'death', 'positiveIncrease', 'totalTestResultsIncrease', 'deathIncrease']
dailyData = da[dailyColumns]
dailyData = dailyData.sort_values('state', ascending=True)
dailyCleaned = dailyData[dailyData['date'].astype(str)==dateRange]
#collapse
#MERGING THE DATASETS TOGETHER
mergef=pd.merge(kerry, rtCleaned,  on='state')
merget=pd.merge(mergef, dailyCleaned, on='state')
merger=pd.merge(merget, newerCol, on='state')
#SHOW THE LOCATIONS FOR CLIENT
kerry
#SHOW CLIP OF THE RT DATA
rtCleaned.head(3)
#SHOW CLIP OF THE DAILY DATA
dailyCleaned.head(3)
#SHOW CLIP OF THE PAST DATA
newerCol.head(3)
#SHOW THE MERGED DATA
merger<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14820075757575757, 'fraction_numerical': 0.010416666666666666, 'mean_word_length': 6.884328358208955, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '118080', 'license': 'Apache-2.0', 'n_tokens_mistral': 777, 'n_tokens_neox': 727, 'n_words': 179, 'path': '_notebooks/Kerry_Matrix_2.0.ipynb', 'repo_name': 'lalalaNomNomNom/Notebooks', 'size': '2120'}