Matplotlib Tutorial (Part 6): Histograms

  Рет қаралды 193,730

Corey Schafer

Corey Schafer

Күн бұрын

Пікірлер: 112
@coreyms
@coreyms 5 жыл бұрын
I hope everyone finds this video helpful. The next video of the series will be posted tomorrow at the same time. The next video will cover how to create scatter plots. We will use KZbin API data to plot views/likes from trending videos. We will also learn how to use color and size to add even more information to our plots, so be sure to check that out. I'd like to thank Brilliant for sponsoring this series. If you'd like to check them out then you can sign up with this link and get 20% off your premium subscription: brilliant.org/cms
@SHUBHITTALUSBIS
@SHUBHITTALUSBIS 5 жыл бұрын
Sir can you give me a rough idea of the dates when you will start with pandas and numpy!!Please sir I am really desperate to know that! THANKS
@harshman11
@harshman11 5 жыл бұрын
That's interesting.
@coreyms
@coreyms 5 жыл бұрын
@@SHUBHITTALUSBIS I've already started working on the material, but I don't know exactly when they'll be released. It takes a long time to put together an entire series, so it could be another month or two until I'm finished with those. I'll be releasing individual video in the meantime as well.
@Tejakonduri
@Tejakonduri 5 жыл бұрын
Corey Schafer great videos!! Can you let me know how to add value/count on each bar? Just in case if the count is almost similar it would be difficult to differentiate which bin has higher or lesser count..
@guilhermehx7159
@guilhermehx7159 5 жыл бұрын
I find these series very useful, tahnks Corey, you, are best
@bmwmhamam
@bmwmhamam 5 жыл бұрын
Your courses are pure perfection. Excellently well thought, you just find a solution for every point I think of while the video is playing, you just get the answer for it in a simple smart way. Extremely well prepared, flawless presentations. I can't thank you enough.
@HhhHhh-et5yk
@HhhHhh-et5yk 4 жыл бұрын
Hey! Same here , thats what i'm about to comment😹. Corey U r the best♥️.
@AmirOstad
@AmirOstad 5 жыл бұрын
Corey, I just recently started using matplotlib a lot and noticed you have lately uploaded its tutorials. Thanks man. Could you do a tutorial on Seaborn please? Thank you.
@daniel_narh
@daniel_narh 4 жыл бұрын
@Corey you are the best, am gonna leave a thank you on my portfolio in your name
@bobalbania5464
@bobalbania5464 2 жыл бұрын
for people who suffered with the csv file: copy the file to a text file, then use the following code to remove the " file_handle = open('New Text Document.txt') for line in file_handle: line.replace('"', '') # replace " with '' which is empty string after that copy the New Text Document to any CSV file you have and name it data
@testchannel4695
@testchannel4695 4 жыл бұрын
Thanks man. I was trying to understand this from Datacamp, which is PAID service... but I had to come to KZbin, which is FREE to get the explanation that I wanted. Thank you and please keep up this great work.
@danishday6954
@danishday6954 3 жыл бұрын
Lifesaver video for my engr class, I was having trouble with defining bins, and this helped me understand better
@yashpandey350
@yashpandey350 4 жыл бұрын
Very well explained I got confused in the bin attribute, you made my day.😇😇😇😇
@c10seth
@c10seth 5 жыл бұрын
Thank you for publishing this. I've been working through histograms with huge data sets at work and this really helps me identify what is really needed to simply produce helpful charts.
@shockey3084
@shockey3084 5 жыл бұрын
you have done a great job. I'm fully confident now to use plots in different styles.
@elibaum5489
@elibaum5489 5 жыл бұрын
Hey Corey, great fan here It really took me many months to find a channel where the concepts were explained so well. Keep up the good work! p.s Would you consider making a series on numpy and ai?
@engyahiasoliman5572
@engyahiasoliman5572 Жыл бұрын
no
@minhtu5059
@minhtu5059 3 ай бұрын
Thank you so much for including real-life data!!!!
@PaoloCondo
@PaoloCondo 2 жыл бұрын
Thank you again for these amazing, useful videos!
@pearltextiles5681
@pearltextiles5681 4 жыл бұрын
Great video and u teaches as simple as easy way . We can easily understand. Every topic u saws us with all options and deeply. Great work.
@DavidRajM
@DavidRajM 5 жыл бұрын
very useful series. thanks a lot. I really like the way u throw the things out.
@finndevitt5117
@finndevitt5117 4 жыл бұрын
sorry i have a question when i installing the package " plt" . That is displayed " ERROR: Could not find a version that satisfies the requirement plt (from versions: none) ERROR: No matching distribution found for plt " I need help :/ pls
@balabunat
@balabunat 5 жыл бұрын
Holy shit! You're great, man! Very useful series 👍
@randomtopicsfromcomputersc8549
@randomtopicsfromcomputersc8549 3 ай бұрын
perfection at its best !
@mifrahfatma3616
@mifrahfatma3616 4 жыл бұрын
Hii corey..your videos are really helpful...it makes everything so easy and makes programming fun...
@VictorCaldo
@VictorCaldo 5 жыл бұрын
I love your channel, thanks Corey!
@richiehrv
@richiehrv 2 жыл бұрын
thank you so much, great explanation. Helped me so much!
@KK-wq6zw
@KK-wq6zw 4 жыл бұрын
Love your tutorials ! Thank you!!!!!
@toubisalaheddine6432
@toubisalaheddine6432 5 жыл бұрын
Great video 'our python hero"
@maxbranco7321
@maxbranco7321 5 жыл бұрын
bins = [x for x in range(10, 101, 10)]
@lxxfxx
@lxxfxx 3 жыл бұрын
bins = list(range(10, 101, 10))
@SyedMohammedOmerFarooq
@SyedMohammedOmerFarooq 3 жыл бұрын
Thanks for a great lesson on histogram.
@DeathStalkksu
@DeathStalkksu 4 жыл бұрын
Amazing video!!
@ItzSenaCrazy
@ItzSenaCrazy 5 жыл бұрын
THANKS!!! I love your videos.
@tireldenamse5854
@tireldenamse5854 5 жыл бұрын
Nice video!
@Sabre00
@Sabre00 5 жыл бұрын
Hey Corey, really loving this series. Eagerly looking forward to the timeseries plot video. My question is is it possible to plot aliases for the bins? To clarify say we had three bins which are predefined and instead of showing the ranges of the bins we want to plot 'low', 'medium' and 'high' as the alias of sorts. I think something similarly was done in the bar charts video. Once again I love all your work not just this series.
@coreyms
@coreyms 5 жыл бұрын
Yes, you should be able to use the xticks method and pass in your own labels. You can find the xticks docs here: matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.xticks.html
@lucacambursano2172
@lucacambursano2172 4 жыл бұрын
Thank you this really helped me out
@NhiVo-mk9xn
@NhiVo-mk9xn 4 жыл бұрын
Thank you! This helped me
@alexanderten5497
@alexanderten5497 5 жыл бұрын
Great tutorial . So clear explanation
@arid7499
@arid7499 4 жыл бұрын
A big thank you for your videos. I have done a small change, correct me if I am wrong. I am a beginner. I imported statistics, and for median_age I used ; median_age=sorted(data["Age"]) [ len(data["Age"])//2]
@fakhriddinmakhmadiyorov7269
@fakhriddinmakhmadiyorov7269 4 жыл бұрын
no, you should find sum of all ages, divide by total number of ages, and the result will be your median age
@fakhriddinmakhmadiyorov7269
@fakhriddinmakhmadiyorov7269 4 жыл бұрын
s = 0 for i in range(0, len(ids)): s = s + ages[i] s = s // len(ids)
@stephanheyrowsky554
@stephanheyrowsky554 4 жыл бұрын
Hi Corey, first I am a big fan of your tutorials. I have learned most of my Python skills by them. At 7:00 you want to remove the 10-20 value from the histogram and just deleted the value in the list. I prefer to keep the original data as it is and use list funcionality bins=bins[1:] (plt.hist(ages, bins=bins[1:], edgecolor='black')) to remove values from the x-axis. Do I get something wrong or do you have a specific reason to do it your way?
@fioo_2386
@fioo_2386 4 жыл бұрын
what you are doing is fine, as long as it runs for this specific purpose. I guess that he did it that way just to keep it as simple as possible for educational purposes
@cryptke
@cryptke 5 жыл бұрын
Hi Corey, truly, only you can make a histogram video so interesting! On the logarithmic scale, how would you add the count labels to each bar on the graphs? Thank you!
@engyahiasoliman5572
@engyahiasoliman5572 Жыл бұрын
no
@pivotai525
@pivotai525 2 жыл бұрын
The best!!
@abhinav9561
@abhinav9561 4 жыл бұрын
Thanks man!!
@pratikjanani743
@pratikjanani743 3 жыл бұрын
Great Video, thanks for uploading. Quick question :- Can we define overflow and underflow bins in Python similar to Excel?
@veronicaventure5372
@veronicaventure5372 5 жыл бұрын
Hi Corey, I wanted to know if it is possible to label every tick. For example can you put labels for ages 30, 50, 70, 90?
@lizard415
@lizard415 5 жыл бұрын
thanks for the awesome videos Corey, you are awesome!! by the way, what are your thoughts on VScode vs Sublime 3?? will you continue being faithful to sublime text? saludos desde Chile amigo!
@coreyms
@coreyms 5 жыл бұрын
I have been using VSCode for daily coding since it has so many nice features, but I will likely use Sublime for videos because I find it to be much more minimalist and less distracting.
@faycalnabaoui9550
@faycalnabaoui9550 4 жыл бұрын
hey, great video, just wanna ask you what is the diffrence between range and bins of a hist ? thank you in advance
@mygrowthdiary8799
@mygrowthdiary8799 2 жыл бұрын
While I appreciate all the course and amazing level of detail in which you have explained. It would've been so much better if there was just 1 dataset that you used to show all the charts, or at least only a couple of variations.
@haoliu2686
@haoliu2686 4 жыл бұрын
Could you tell me how you make multiple command lines to comment (with #)?
@danielalegriasallo5551
@danielalegriasallo5551 3 жыл бұрын
Is it possible to change the color of each bin individually?
@tigistmimi7888
@tigistmimi7888 3 жыл бұрын
thank you
@daksharya5767
@daksharya5767 4 жыл бұрын
thanks ❤️
@MetallicManowar
@MetallicManowar 5 жыл бұрын
Responder_id 10 missing 😝 Interesting videos 🤔👌:-)
@Dante-ot8xg
@Dante-ot8xg 3 жыл бұрын
I wrote the code verbatim, but no histogram showed up. It ran without issue though... Any tips on how to do this with excel sheets saved as cvs files? Any resources I could look at?
@Hard3R
@Hard3R 2 ай бұрын
i have an x axys that goes from 0 to 160, how can i put 160 bins without typying [1, 2, 3, 4, 5, ...., 160]??
@wenhanzhou5826
@wenhanzhou5826 3 жыл бұрын
legend
@mandeepubhi4744
@mandeepubhi4744 5 жыл бұрын
Could you Create series on Data and Structures?
@mp_dev2000
@mp_dev2000 5 жыл бұрын
How did you work out the median ?
@qqiangg1
@qqiangg1 3 жыл бұрын
How do I download your csv file? Or, can you make the csv file downloadable?
@SoftwareEngineering226
@SoftwareEngineering226 Жыл бұрын
Data which you have used is not in the description
@mouleshm210
@mouleshm210 4 жыл бұрын
sir, how to input different colors for different bins in one plot of histogram? any codes? please help me?
@patjaproduction1119
@patjaproduction1119 2 жыл бұрын
07:56
@Felix-gh3sx
@Felix-gh3sx 4 жыл бұрын
Why did you create new variables of age and id?
@bakihussain4231
@bakihussain4231 5 жыл бұрын
i got a question why you didn't use plt.hist(ids, bins=bins) how come "plt.hist" passed 'ages' into 'ids'????
@akshat2778
@akshat2778 3 жыл бұрын
Hey corey, thanks for these awesome videos. But I am not able to download the data.csv file from github
@mahamanoumar1802
@mahamanoumar1802 4 жыл бұрын
I can't find the ID and ages data on GitHub website. any help?
@finndevitt5117
@finndevitt5117 4 жыл бұрын
sorry i have a question when i installing the package " plt" . That is displayed " ERROR: Could not find a version that satisfies the requirement plt (from versions: none) ERROR: No matching distribution found for plt " I need help :/ pls
@5staryzzz
@5staryzzz 4 жыл бұрын
I think you have to update your Python version
@ET_History
@ET_History 3 жыл бұрын
There are 6 dislikes. Probably 6 professors who are insecure about your lecture. :D
@manavrao4824
@manavrao4824 5 жыл бұрын
Hey When I use csv instead pandas that time my x axes values are overlap but when i use pandas that time everything is good what is reason behind that can any one explain me
@ahkkhans
@ahkkhans 4 жыл бұрын
Im getting error in this video To verify i cant see code from top to bottom Before ending video , you should show complete code of the file.... for people like us.
@fioo_2386
@fioo_2386 4 жыл бұрын
hello, kindly note that in such cases you should clarify what error you are experiencing, so that someone can help you. also note that in the description of the video there is a link to his github page where he places the .csv file he uses in these tutorials, the initial code of the tutorial and also the final code.
@norayrhayruni2622
@norayrhayruni2622 3 жыл бұрын
Can anybody give me some hints on how to put text(respective year in my case) in the stacked bars of histogram. I have a series of stock's return (1900-2020).
@henriquepousacaltram9733
@henriquepousacaltram9733 4 жыл бұрын
Hello, people. Does anyone know how to express the frequencies in terms of percentages relative to the total amount of observations in the data set?
@mdnahianimtiazhasan7373
@mdnahianimtiazhasan7373 3 жыл бұрын
Can anyone suggest a data set on which I can apply the things I learnt in this video?
@JIGGAO
@JIGGAO 4 жыл бұрын
how to add the number of average line?
@pipertripp
@pipertripp 5 жыл бұрын
Great series mate. Just top notch. Question, why didn't you just compute the median age rather than hard coding it? ages.median() would have done the trick since it's a pandas data object.
@anvayawalgaonkar4119
@anvayawalgaonkar4119 3 жыл бұрын
Can I know, how to calculate the bin size of histogram?
@anvayawalgaonkar4119
@anvayawalgaonkar4119 3 жыл бұрын
import pandas as pd import matplotlib.pyplot as plt ages = [1,11,13,14,21,34,78,90,23,24,45,65,53, 55,62,70,71,72,82,22,27] age_grp= [0,10,20,30,40,50,60,70,80,90,100] plt.hist(ages, age_grp, rwidth=0.8, color='yellow',histtype='bar',alpha=0.5,edgecolor='black',) plt.xticks(age_grp) plt.style.use('fivethirtyeight') plt.title('Age of the People who submitted their feedback') plt.xlabel('Age Range') plt.ylabel('People Count') plt.tight_layout() plt.show() print('Bin sizes: {}'.format()
@denisvoronov6571
@denisvoronov6571 4 жыл бұрын
I couldn't download data.csv file. Alt+left clic gives me html format file :( Any ideas, how I can do it correctly?
@denisvoronov6571
@denisvoronov6571 4 жыл бұрын
I ended up with using URL instead of file name. Here it is. I hope it'll be helpful to you: data = pd.read_csv('raw.githubusercontent.com/CoreyMSchafer/code_snippets/master/Python/Matplotlib/06-Histograms/data.csv')
@ishanpand3y
@ishanpand3y 4 жыл бұрын
Go to GitHub click on data.csv ->Click on *raw* and then Ctrl+s and save it to your desired location.
@mehmetcandemir5035
@mehmetcandemir5035 4 жыл бұрын
I pasted them into a text file and then imported it to the CSV, may not seem practical but it's never bad to keep the data
@RegisFregene
@RegisFregene 9 ай бұрын
the thing says the code is fine but no plots are showing up
@slobodantajisic2762
@slobodantajisic2762 4 жыл бұрын
17586 views and 586 likes. Does it hurt to give a thumbs up?
@Arthurk346
@Arthurk346 4 жыл бұрын
programmers aged between 100 and 110 are feeling offended
@markkennedy9767
@markkennedy9767 Жыл бұрын
The lack of nonagenarian programmers is worrying.
@dhananjaykansal8097
@dhananjaykansal8097 5 жыл бұрын
I'm new to this world. And I'm not able to understand this error. I went through the code exactly like above. Infact I copy pasted as well. But I'm constantly getting this error: KeyError: 'Responder_id' Can someone help pls? Mr. Schafer if you could please?
@coreyms
@coreyms 5 жыл бұрын
Did you download the CSV file as well? That is what contains that key.
@dhananjaykansal8097
@dhananjaykansal8097 5 жыл бұрын
@@coreyms Okay I see. Actually I tried a lot. But it just download as data.html.csv on my Mac. So I manually copied and created one. Perhaps this is where the error lies. Thanks a lot sir. But sadly not able to download the file.
@BiancaAguglia
@BiancaAguglia 5 жыл бұрын
​@@dhananjaykansal8097 I ran into a similar problem and I found out that you can use pd.read_csv to get the data directly from a webpage instead of a local folder. For example, you can go to Corey's github for this video, click on the data file, click on raw, then copy the html link for the page you're on. Use this html link inside pd.read_csv and you'll be able to get the data. 😊
@dhananjaykansal8097
@dhananjaykansal8097 5 жыл бұрын
@@BiancaAguglia Thanks a ton. I'm gonna try this.
@iitjee3578
@iitjee3578 Жыл бұрын
Where's the csv file of Responder_id, Age?
@Coney_island23
@Coney_island23 2 жыл бұрын
recommend
@Thedevineforce
@Thedevineforce 5 жыл бұрын
Anybody has a jupyter notebook version of his code? And if you would like to share, please comment.
@AndreiMargeloiu
@AndreiMargeloiu 4 жыл бұрын
Jesus, 699 likes and 0 dislikes!
@TopBagon
@TopBagon 4 жыл бұрын
Got that 700th like
@gamerforever9137
@gamerforever9137 3 жыл бұрын
Who disliked this video?
@arduh
@arduh Жыл бұрын
bu hayat insanazor
@fakhriddinmakhmadiyorov7269
@fakhriddinmakhmadiyorov7269 4 жыл бұрын
only 1 person disliked:)
@5staryzzz
@5staryzzz 4 жыл бұрын
Yeah!
Matplotlib Tutorial (Part 7): Scatter Plots
21:24
Corey Schafer
Рет қаралды 183 М.
Matplotlib Tutorial (Part 1): Creating and Customizing Our First Plots
35:01
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Matplotlib Crash Course
1:31:41
freeCodeCamp.org
Рет қаралды 349 М.
Matplotlib Tutorial (Part 9): Plotting Live Data in Real-Time
20:34
Corey Schafer
Рет қаралды 423 М.
Seaborn histplot | How to make a Seaborn histogram plot with Python code
12:39
Matplotlib Tutorial (Part 5): Filling Area on Line Plots
15:18
Corey Schafer
Рет қаралды 105 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 199 М.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 354 М.
Matplotlib Full Python Course - Data Science Fundamentals
1:02:41
NeuralNine
Рет қаралды 166 М.
Solving real world data science tasks with Python Pandas!
1:26:07
Keith Galli
Рет қаралды 1,5 МЛН
MatPlotLib Python Tutorial in Jupyter Notebooks - Part 1
27:44
Yiannis Pitsillides
Рет қаралды 27 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН