How to sum a column of a file and view it with .plot (kind = 'bar')?

0

I'm trying to sum the duration column, and display using plot()

trip_data['duration'].value_counts().plot(kind = 'bar')
trip_data['duration'].count_data().plot(kind = 'bar')
trip_data['duration'].size().plot(kind = 'bar')

But everything I try presents separately or gives error, how can I do this?

grateful for help.

    
asked by anonymous 15.09.2017 / 03:58

1 answer

1

Well, you have not tried everything yet.

Your presentation is a bit bad, but if I have guessed right what you are using, it should help.

Initially what you show is a table that does not have much to add or you can add anything. As also the specified% of your table is not specified, here is an example of one of the ways to use the type function in bar .

import numpy as np
import matplotlib.pyplot as plt
plt.figure(figsize=(17,9))
a=np.array(range(10))
b=np.cumsum(a)
plt.bar(a,b)
plt.show()

In response:

Ifyouwanttomakethechartalittlemoreinteresting,youcansee this other answer .

    
16.09.2017 / 22:50