Tengo que graficar a partir de un archivo csv similar a este:
Cedula,Genero,Placa,Tipo,Multa,Fecha
0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13
0910703362,Masculino,GSF-7654,Automovil,Leve,2016-02-18
0931921408,Femenino,GOI-3298,Automovil,Muy grave,2016-01-04
0987654321,Masculino,ETR-9873,Camioneta,Grave,2016-08-05
0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13
0910703362,Masculino,GSF-7654,Automovil,Leve,2016-02-18
0931921408,Femenino,GOI-3298,Automovil,Muy grave,2016-01-04
0987654321,Masculino,ETR-9873,Camioneta,Grave,2016-08-05
0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13
0910703362,Masculino,GSF-7654,Automovil,Leve,2016-02-18
0931921408,Femenino,GOI-3298,Automovil,Muy grave,2016-01-04
0987654321,Masculino,ETR-9873,Camioneta,Grave,2016-08-05
0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13
Mi principal problema es que de todas las formas que intento tengo el error de
Traceback (most recent call last):
File "C:/Users/User1/Downloads/x/xx/aaa.py", line 14, in <module>
my_plot = grp.plot(kind='bar')
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 311, in __call__
return self._groupby.apply(f)
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 651, in apply
return self._python_apply_general(f)
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 655, in _python_apply_general
self.axis)
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 1527, in apply
res = f(group)
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 647, in f
return func(g, *args, **kwargs)
File "C:\python\lib\site-packages\pandas\core\groupby.py", line 309, in f
return self.plot(*args, **kwargs)
File "C:\python\lib\site-packages\pandas\tools\plotting.py", line 3740, in __call__
sort_columns=sort_columns, **kwds)
File "C:\python\lib\site-packages\pandas\tools\plotting.py", line 2614, in plot_frame
**kwds)
File "C:\python\lib\site-packages\pandas\tools\plotting.py", line 2441, in _plot
plot_obj.generate()
File "C:\python\lib\site-packages\pandas\tools\plotting.py", line 1026, in generate
self._compute_plot_data()
File "C:\python\lib\site-packages\pandas\tools\plotting.py", line 1135, in _compute_plot_data
'plot'.format(numeric_data.__class__.__name__))
TypeError: Empty 'DataFrame': no numeric data to plot
siendo esto lo que escribo en el codigo:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
lectura=pd.read_csv("dataset.csv",",",parse_dates=['Fecha'])
equis=lectura[["Tipo","Multa"]]
equis.head()
grp=equis.groupby("Multa")
grp.size()
my_plot = grp.plot(kind='bar')`
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
lectura=pd.read_csv("dataset.csv",",",parse_dates=['Fecha'])
equis=lectura[["Tipo","Multa"]]
equis.head()
grp=equis.groupby("Multa")
grp.size()
my_plot = grp.plot(kind='bar')
En este enlace se encuentran los gráficos que tengo que realizar.