Created
August 15, 2015 22:21
-
-
Save sujayy1983/6556eb7ec3b83b48e83f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Description: | |
An attempt to create plots from csv dataset. | |
Sample csv auto generation script: | |
import math | |
file = open("Dataset.csv", 'w') | |
file.write( "Linear,AP,GP,EXP,ACTION\n") | |
for x in range (1,100): | |
action = '' | |
if x%10 == 1 or x%10 == 6: | |
action = 'action-1' | |
if x%10 == 2 or x%10 == 7: | |
action = 'action-2' | |
if x%10 == 3 or x%10 == 8: | |
action = 'action-3' | |
if x%10 == 4 or x%10 == 9: | |
action = 'action-4' | |
if x%10 == 5 or x%10 == 0: | |
action = 'action-5' | |
file.write( "%s, %s, %s, %s, %s\n" %( x, x+x, x*x, math.pow(2,x), action)) | |
file.close() | |
""" | |
__author__='Sujayyendhiren Srinivasamurthi' | |
__email__='sujayy1983@gmail.com' | |
import pandas as pd | |
df = pd.read_csv('Dataset.csv') | |
df1 = df[['Linear', 'AP']] | |
print df1.describe() | |
ax = df1.plot(kind='Bar') | |
fig = ax.get_figure() | |
fig.savefig('./../Flask-app/static/plot1.png') | |
df2 = df[['Linear', 'GP']] | |
print df2.describe() | |
ax = df2.plot(kind='Bar') | |
fig = ax.get_figure() | |
fig.savefig('./../Flask-app/static/plot2.png') | |
df3 = df[['Linear', 'GP']] | |
print df3.describe() | |
ax = df3.plot(kind='Bar') | |
fig = ax.get_figure() | |
fig.savefig('./../Flask-app/static/plot3.png') | |
df4 = df[['Linear', 'ACTION']] | |
groups = df4.groupby('ACTION').groups | |
print "Grouping..." | |
for grp in groups: | |
print grp + " : " + str(len(groups[grp])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment