

In this video, we go through several real-world examples of using the Matplotlib & Pandas libraries to visualize data from CSV files. This is a follow-up to my introductory matplotlib video ( Timeline for what we cover can be found in the comments.
We start by creating line graphs of global gas price data over time. We review how to add a title, x & y axis labels, and scale our graph. We review how to customize the style and size of our charts. Next, we look at the FIFA 19 player data to create a histogram, a couple pie charts, and a box and whisker plot.
If you enjoy this video, make sure to LIKE and SUBSCRIBE 🙂 🙂
If you have any questions or feedback, please let me know in the comments!
———————————————
Follow me on social media!
Instagram |
Twitter |
———————————————
Link to Source Code & Datasets!
Matplotlib Documentation:
Matplotlib Fonts:
Matplotlib Style Options:
Kaggle Data Link:
———————————————
Video timeline!
0:00 – Intro & Video Overview
2:22 – Load Necessary Libraries & Download Data
3:48 – Line Graph Example (Plotting Data from CSV file)
21:52 – Histogram Example (FIFA Overall Skill Distribution)
29:25 – Pie Chart #1 (Counting data in CSV) – Visualizing Soccer Foot Preferences
36:41 – Pie Chart #2 (More advance Pandas Example) – Weight Distribution of FIFA Players
47:49 – Box & Whisker Plot (Comparing FIFA teams to one another)
1:00:37 – Final Comments
———————
Equipment I use to film my videos (I get a small commission on purchases made through these links😊)
– Sony a6500 Camera:
– Rokinon 12mm Lens:
– Rode Videomicro Microphone:
– Blue Snowball Microphone (alternate mic):
– Andycine Camera Monitor:
– Snagit for screen recording
– Adobe Premiere Pro for video editing
– Adobe Photoshop for thumbnails
source
Without labels legend didn't worked. min: At 9:22 . But I appreciate your work
Does anyone have any idea why the imported modules (pandas, numpy, etc) work fine on Jupyter Notebook but when the same code is run in an IDE like Atom, it gives Module Not Found Error. The directories are the same.
9:07 One of the biggest problem of programmers……
How the code worked??
really great!
Can you elaborate Bins in simple term, what is the use of it and why the graph changes by changing it
on 16:45 , to make the legend outside the graph you can use the command:-
plt.legend(bbox_to_anchor=(1.05, 1))
Thank you so much. Learning so much from your videos.
Thanks sir, is there any guidance from you on how to plot trajectories using lat and long coordinates using matlplotlib?
this channel provides the best resource for data science in my perspective. subscribe guys, it's worth it
File "<ipython-input-46-335ef5ed3a74>", line 1
plt.plot(df.Site, df.Orders dropped Actual)
^
SyntaxError: invalid syntax
26:25 I get a TypeError saying list is not callable with plt.xticks(bins)
Can you please provide the datasets. I cannot find the datasets
Bro your videos are the best!!!!
thanks a lot 🙂
Thank you so much for the tutorial!
Have a small doubt, I have my data in hours of the year how do I convert it to months?
Thank you and don't stop teaching
for those struggling to get labels on 17:05, use (label="%s data" % country)
60K SUBSCRIBERS, WOW THE COMMUNITY IS GROWING. WELL DONE KEITH
37:23 how can I change the values to kg?
Awsome…!
2:05 F
Your videos have helped me a lot to actually be interested in Data Science.
What if in 37:40 , we have the weight column format as say 175lbs(80kg) instead of 175lbs ? How to convert that to a numerical value?
Explode in not working it is showing an error
great tutorial
Why do americans call football soccer? "foot – ball" it's obvious 😀 ohh.. great tutorials btw 🙂 especially Data Science Section. you're my favorite youtuber since I've found your channel
Awesome! TQVM!!!
fantastic
<3 <3
Your tutorial videos have helped me a lot to learn python. Tks
Asking questions on StackOverFlow is a service toward humanity, coz you don't know how many lives you'll save in the future. lol!
Keith,
At 38:45, to strip off 'lbs' from weights of fifa players and convert weights from string dtype to float dtype, what's your opinion on the following code:
fifa.Weight = fifa.Weight.str[0:3].astype('float64')
Comments from anyone are welcome.
*If we make a list of the headers (ignoring the 'Year'), and then, add gas[country] instead of gas after invoking the for loop, we can avoid using the if-statement. However, your videos are amazing!! Just started learning Python and already loving it.*
country = gas.columns[1:]
markers = ['o', 'd', 'D', '^', '*', '>', '<', 'h', 'H', ',']
for country in gas[country]:
plt.plot(gas.Year, gas[country], marker = markers.pop(0), label = country)
plt.legend(loc = 'best')
plt.xticks(gas.Year[::3].tolist()+[2012])
Hey, first thanks for the great Video. However, I have the following question: I dont get he syntax at 29:28
Is this a short form? How can I calculcate or work with a specific cell within pandas DF and reset the value of the cell afterwards?
E.g. x = x + "String"?
More precisely, how can i loop through a column and transform the values?
you are the single reason my grade is so good in my Data Analysis class, you are amazing and I can not thank you enough for all these videos!!!!
can we do a iteration on all the boxplots with the dataset?
You deserve more than a million subscribers bro! Great tutorials
One question: Matplotlib or seaborn?
Just FYI, the pie chart section of the video no longer works. Non-1D arrays are deprecated and no longer function as of version 3.3 of MatPlotLib. So, pie charts will no longer work for the kind of data visualization described here. Bar graphs will, though. Might want to make people aware of that.
I have not been able to figure out how to change the format of numbers to add commas. Say you are charting salary and you have a range from 10000 to 100000 how do I get that to show as 10,000 – 100,000 on the x or y axis?
I totally adore the way you explain. Thanks for the videos 🙂
Great content Keith! Thanks a lot for the videos. While I was working with the Pie Chart, I couldn't make the 'label' and 'title' work, how much ever I tried! Finally, i figured out that was because I was using 'Dark Theme'. Aaah! Is there a way I can do the same with Dark Theme?