<jupyter_start><jupyter_text>DSC 640 Assignment 4.2  <NAME> This is the Python portion of assignment 4.2. The below code will bring in a dataset and then provide the following visuals. 1. 1 Heat Map2. 1 Spatial Chart3. 1 Contour Chart<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
costco = pd.read_csv('ex5-2/costcos-geocoded.csv', sep=",")
ppg = pd.read_csv('ex5-2/ppg2008.csv', sep=",", index_col=0)
costco.head()<jupyter_output><empty_output><jupyter_text>1. Heat Map<jupyter_code>p1 = sns.heatmap(ppg)<jupyter_output><empty_output><jupyter_text>2. Spatial Chart<jupyter_code>import folium
import matplotlib.pyplot as plt

m = folium.Map(location=[0,0], zoom_start=2)
 
# I can add marker one by one on the map
for i in range(0,len(costco)):
   folium.Circle(
      location=[costco.iloc[i]['Latitude'], costco.iloc[i]['Longitude']],
      popup=costco.iloc[i]['City'],
      radius=100, #data.iloc[i]['value']*10000,
      color='crimson',
      fill=True,
      fill_color='crimson'
   ).add_to(m)
 
m<jupyter_output><empty_output><jupyter_text>3. Contour Chart<jupyter_code>costco_2 = costco.groupby(['Latitude', 'Longitude']).agg(['count'])
cs = plt.contourf(costco_2)#, levels=[10, 30, 50],
    #colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
cs.cmap.set_over('red')
cs.cmap.set_under('blue')
cs.changed()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1578202406227884, 'fraction_numerical': 0.04104741684359519, 'mean_word_length': 5.701421800947867, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '335968', 'license': 'Unlicense', 'n_tokens_mistral': 593, 'n_tokens_neox': 561, 'n_words': 114, 'path': 'Python Vizualizations/DSC 640 Assignment 4_2 Python Portion.ipynb', 'repo_name': 'Lemonchasers/Lemonchasers.github.io', 'size': '1419'}