@justinholman/

MakeHist

Python

No description

fork
loading
Files
  • main.py
  • opp-sns.png
  • team1718.csv
  • teamscores.csv
  • tm-plt.png
  • tm-sns.png

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.2526929806049565","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBpbXBvcnQgbWF0cGxvdGxpYiArIHVzZSgnQWdnJykgdG8gInNhdmVmaWciIGJlbG93CmltcG9ydCBtYXRwbG90bGliIGFzIG1wbAptcGwudXNlKCdBZ2cnKQoKIyBub3cgbGV0cyBpbXBvcnQgdGhlIG90aGVyIG1vZHVsZXMgd2UgbmVlZAppbXBvcnQgcGFuZGFzIGFzIHBkCmltcG9ydCBzZWFib3JuIGFzIHNucwppbXBvcnQgbWF0cGxvdGxpYi5weXBsb3QgYXMgcGx0CgojIHdpdGggYWxsIG91ciBtb2R1bGVzIGluIHBsYWNlLCBsZXQncyByZWFkIGNzdiBkYXRhCnNjb3JlcyA9IHBkLnJlYWRfY3N2KCd0ZWFtc2NvcmVzLmNzdicsaW5kZXhfY29sPTApIAp0bSA9IHBkLlNlcmllcyhzY29yZXNbJ1RtJ10pCm9wcCA9IHBkLlNlcmllcyhzY29yZXNbJ09wcCddKQoKIyBtYWtlIGEgaGlzdG9ncmFtIHdpdGggbWF0cGxvdGxpYgpwbHQuaGlzdCh0bSkKcGx0LnhsYWJlbCgnVGVhbSBQb2ludHMnKQpwbHQuc2hvdygpCnBsdC5zYXZlZmlnKCd0bS1wbHQucG5nJykKcGx0LmNsZigpCgojIG1ha2UgYSBoaXN0b2dyYW0gd2l0aCBTZWFib3JuCnNucy5kaXN0cGxvdCh0bSkKcGx0LnhsYWJlbCgnVGVhbSBQb2ludHMnKQpwbHQuc2hvdygpCnBsdC5zYXZlZmlnKCd0bS1zbnMucG5nJykKcGx0LmNsZigpCgojIGFub3RoZXIgaGlzdG9ncmFtIHcgU2VhYm9ybiBidXQgdyBPcHAgcG9pbnRzCnNucy5kaXN0cGxvdChvcHApCnBsdC54bGFiZWwoJ09wcG9uZW50IFBvaW50cycpCnBsdC5zaG93KCkKcGx0LnNhdmVmaWcoJ29wcC1zbnMucG5nJykKcGx0LmNsZigpCgpwcmludCgicnVuIGNvbXBsZXRlIikgIA=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# import matplotlib + use('Agg') to "savefig" below
import matplotlib as mpl
mpl.use('Agg')

# now lets import the other modules we need
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# with all our modules in place, let's read csv data
scores = pd.read_csv('teamscores.csv',index_col=0) 
tm = pd.Series(scores['Tm'])
opp = pd.Series(scores['Opp'])

# make a histogram with matplotlib
plt.hist(tm)
plt.xlabel('Team Points')
plt.show()
plt.savefig('tm-plt.png')
plt.clf()

# make a histogram with Seaborn
sns.distplot(tm)
plt.xlabel('Team Points')
plt.show()
plt.savefig('tm-sns.png')
plt.clf()

# another histogram w Seaborn but w Opp points
sns.distplot(opp)
plt.xlabel('Opponent Points')
plt.show()
plt.savefig('opp-sns.png')
plt.clf()

print("run complete")