Skip to content

Instantly share code, notes, and snippets.

@jpgard
jpgard / processors_w3g_adswpy.py
Last active August 2, 2018 13:29
ADSWPY Week 3
!pip install html5lib #install html5lib, only needs to be run once
#You might need to restart kernel after running with the menu Kernel>Restart
import pandas as pd
import numpy as np
import urllib
#description and prices of the Xeon Gold processors
df_xeon_golds=pd.read_html('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors', header=0)[78]
#statistics about the performance of a range of Intel processors from cpu-monkey
df_stats=pd.read_csv('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https://gist.github.com/cab938/6499da85d31cfccc9cc5b13621963312/raw/34db3b55bd14f39fc59e6b5128b667a9061f77d7/cpu_performance.csv')
#clean up the price column in df_xeon_golds
@jpgard
jpgard / power_w3i_adswpy.py
Last active May 3, 2018 15:52
ADSWPY Week 3
!pip install html5lib #install html5lib, only needs to be run once
#You might need to restart kernel after running with the menu Kernel>Restart
import pandas as pd
import numpy as np
df_power=pd.read_csv('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https%3A%2F%2Fgist.github.com%2Fcab938%2Ffb463f56781fae4dd1fc171def0f1e94%2Fraw%2Fa6a7e255dadb09a29cf05de692fc16b4c09e941c%2Findia_power.csv')
df_states=pd.read_csv('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https%3A%2F%2Fgist.github.com%2Fcab938%2Ff8862f40901442ae61b458327d13ef9f%2Fraw%2F13dff6567589592828ee15778d0d5897cf09f335%2Findia_states.csv')
joined_df= #join frames and only consider places we have data for both the state pop and renewables
def pct_renw_by_pop(row):
@jpgard
jpgard / power_w3u_adswpy.py
Last active May 3, 2018 15:52
ADSWPY Week 3
!pip install html5lib #install html5lib, only needs to be run once
#You might need to restart kernel after running with the menu Kernel>Restart
import pandas as pd
import numpy as np
df_power=pd.read_csv('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https%3A%2F%2Fgist.github.com%2Fcab938%2F71e8371ebc621a105afa2181efd78e75%2Fraw%2Ffafe9712373ab5a1d3b2fdb6ac09a28cbcfe8f82%2Fus_power.csv')
df_states=pd.read_csv('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https%3A%2F%2Fgist.github.com%2Fcab938%2Ffaedc9046a01b2170c0b252fbc4fc416%2Fraw%2Ff5fa5974e7fef6b996e8ff8583f8d5b47ce391c5%2Fus_states.csv')
joined_df= #join frames and only consider places we have data for both the state pop and renewables
def pct_renw_by_pop(x):