In [1]:
import numpy as np
In [2]:
import csv
In [4]:
with open('../data/leitura1.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in spamreader:
print ', '.join(row)
In [6]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.__version__
Out[6]:
In [7]:
%matplotlib inline
In [47]:
consumo=pd.read_csv('../data/databaseoriginal.csv','create_at')
In [48]:
consumo.head()
Out[48]:
In [49]:
consumo.describe()
Out[49]:
In [50]:
import pandas as pd
from altair import Chart, X, Y, Axis, SortField
budget = pd.read_csv("https://raw.githubusercontent.com/EstevesDouglas/UNICAMP-FEEC-IA369Z/master/data/databaseoriginal.csv")
budget.head()
Out[50]:
In [83]:
budget_top_10 = budget.sort_values(by='created_at',ascending=False)[:15]
In [84]:
budget_top_10.plot(kind="bar", x=budget_top_10["created_at"],
title="Consumo de energia dispositivo",
legend=False)
Out[84]:
In [85]:
Chart(budget_top_10).mark_bar().encode(x='created_at', y='field1')
In [86]:
Chart(budget_top_10).mark_bar().encode(y='created_at', x='field1')
Mais opções
In [87]:
Chart(budget_top_10).mark_bar().encode(x=X('field1'), y=Y('created_at'))
In [88]:
Chart(budget_top_10).mark_bar().encode(
x=X('field1'),
y=Y('created_at'),
color='entry_id')
In [89]:
Chart(budget_top_10).mark_bar().encode(
x=X('created_at:O',
axis=Axis(title='Project')),
y=Y('field1:Q',
axis=Axis(title='2014 Budget')),
color='entry_id')