Stage 2- Lets Play with Charts!!!
Charts are a better way of
understanding how to represent the data . Python also gives us an opportunity to
dabble with the chart and helps in understanding the flow of data
As an analyst one must be in love
with charts to explore the nitty gritty of the data and find the pattern.
Lets first understand how to build
a simple chart
Find below the code:
And the output is
Let us build the chart for the radish votes. Find below the
snapshot of the code snippet
We have written a programme where through first step we are
importing two modules where pyplot is one method through which we are plotting graph data with Matplotlib and NumPy caters to the numeric function of
Python.
Then we are creating 2 lists one names and other votes holding
names and votes counts respectively
Then when we come across the for loop it is creating a list
of radish names and list of vote counts
Then np.arrange function sees to it that it creates a range
of indices for X axis one value for each count. This spread out the graph bars
evenly across the X axis on the plot.
Plt.bar(x,votes) where x values are taken in x axis and
votes counts are taken as height of the bar
In the end x+0.5 means the value is incremented by 0.5 and
rotation = 90 degree means the plot is made 90 degree angle . Please see the
output below for more clarification.
Learning:
Python is one of the most useful languages for statistical
analysis. In this part we have seen the analysis on the data set radish survey
and found out the winner(radish type) with the most number of counts.
Also experimented with a simple chart style in Python.
Keep reading more for more updates!!!!
Happy Analytics
Simple and well explained example.
ReplyDeleteWell presented.
ReplyDelete