Matplotlib Tutorial (Part 6): Histograms

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 112

  • @coreyms
    @coreyms  5 років тому +37

    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 UA-cam 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 років тому +1

      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 років тому +4

      @@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 років тому +42

    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 років тому +29

    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 роки тому +4

    @Corey you are the best, am gonna leave a thank you on my portfolio in your name

  • @minhtu5059
    @minhtu5059 2 місяці тому

    Thank you so much for including real-life data!!!!

  • @danishday6954
    @danishday6954 3 роки тому

    Lifesaver video for my engr class, I was having trouble with defining bins, and this helped me understand better

  • @testchannel4695
    @testchannel4695 3 роки тому

    Thanks man. I was trying to understand this from Datacamp, which is PAID service... but I had to come to UA-cam, which is FREE to get the explanation that I wanted. Thank you and please keep up this great work.

  • @yashpandey350
    @yashpandey350 4 роки тому +4

    Very well explained I got confused in the bin attribute, you made my day.😇😇😇😇

  • @shockey3084
    @shockey3084 5 років тому +2

    you have done a great job. I'm fully confident now to use plots in different styles.

  • @PaoloCondo
    @PaoloCondo Рік тому +1

    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.

  • @randomtopicsfromcomputersc8549
    @randomtopicsfromcomputersc8549 2 місяці тому

    perfection at its best !

  • @bobalbania5464
    @bobalbania5464 Рік тому

    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

  • @c10seth
    @c10seth 5 років тому +1

    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.

  • @elibaum5489
    @elibaum5489 5 років тому +12

    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?

  • @DavidRajM
    @DavidRajM 5 років тому +2

    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

  • @mifrahfatma3616
    @mifrahfatma3616 4 роки тому

    Hii corey..your videos are really helpful...it makes everything so easy and makes programming fun...

  • @SyedMohammedOmerFarooq
    @SyedMohammedOmerFarooq 3 роки тому

    Thanks for a great lesson on histogram.

  • @richiehrv
    @richiehrv 2 роки тому

    thank you so much, great explanation. Helped me so much!

  • @balabunat
    @balabunat 5 років тому +3

    Holy shit! You're great, man! Very useful series 👍

  • @KK-wq6zw
    @KK-wq6zw 4 роки тому

    Love your tutorials ! Thank you!!!!!

  • @DeathStalkksu
    @DeathStalkksu 4 роки тому +1

    Amazing video!!

  • @maxbranco7321
    @maxbranco7321 5 років тому +7

    bins = [x for x in range(10, 101, 10)]

    • @lxxfxx
      @lxxfxx 3 роки тому

      bins = list(range(10, 101, 10))

  • @toubisalaheddine6432
    @toubisalaheddine6432 5 років тому +1

    Great video 'our python hero"

  • @VictorCaldo
    @VictorCaldo 5 років тому

    I love your channel, thanks Corey!

  • @tireldenamse5854
    @tireldenamse5854 5 років тому +2

    Nice video!

  • @lucacambursano2172
    @lucacambursano2172 4 роки тому

    Thank you this really helped me out

  • @ItzSenaCrazy
    @ItzSenaCrazy 5 років тому

    THANKS!!! I love your videos.

  • @NhiVo-mk9xn
    @NhiVo-mk9xn 4 роки тому

    Thank you! This helped me

  • @pivotai525
    @pivotai525 2 роки тому

    The best!!

  • @alexanderten5497
    @alexanderten5497 5 років тому +1

    Great tutorial . So clear explanation

  • @abhinav9561
    @abhinav9561 4 роки тому

    Thanks man!!

  • @tigistmimi7888
    @tigistmimi7888 3 роки тому

    thank you

  • @wenhanzhou5826
    @wenhanzhou5826 3 роки тому

    legend

  • @Sabre00
    @Sabre00 5 років тому +1

    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

  • @daksharya5767
    @daksharya5767 4 роки тому

    thanks ❤️

  • @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]

  • @cryptke
    @cryptke 5 років тому +1

    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!

  • @patjaproduction1119
    @patjaproduction1119 2 роки тому

    07:56

  • @MetallicManowar
    @MetallicManowar 5 років тому +1

    Responder_id 10 missing 😝
    Interesting videos 🤔👌:-)

  • @pratikjanani743
    @pratikjanani743 3 роки тому

    Great Video, thanks for uploading. Quick question :- Can we define overflow and underflow bins in Python similar to Excel?

  • @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

  • @lizard415
    @lizard415 5 років тому +2

    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 років тому +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.

  • @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.

  • @mandeepubhi4744
    @mandeepubhi4744 5 років тому

    Could you Create series on Data and Structures?

  • @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 3 роки тому

      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

  • @haoliu2686
    @haoliu2686 4 роки тому

    Could you tell me how you make multiple command lines to comment (with #)?

  • @mp_dev2000
    @mp_dev2000 5 років тому

    How did you work out the median ?

  • @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?

  • @Coney_island23
    @Coney_island23 2 роки тому

    recommend

  • @danielalegriasallo5551
    @danielalegriasallo5551 3 роки тому

    Is it possible to change the color of each bin individually?

  • @Hard3R
    @Hard3R Місяць тому

    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]??

  • @SoftwareEngineering226
    @SoftwareEngineering226 Рік тому

    Data which you have used is not in the description

  • @qqiangg1
    @qqiangg1 3 роки тому

    How do I download your csv file? Or, can you make the csv file downloadable?

  • @Felix-gh3sx
    @Felix-gh3sx 4 роки тому

    Why did you create new variables of age and id?

  • @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?

  • @akshat2778
    @akshat2778 3 роки тому

    Hey corey, thanks for these awesome videos. But I am not able to download the data.csv file from github

  • @mouleshm210
    @mouleshm210 4 роки тому

    sir, how to input different colors for different bins in one plot of histogram? any codes? please help me?

  • @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

  • @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()

  • @mahamanoumar1802
    @mahamanoumar1802 4 роки тому

    I can't find the ID and ages data on GitHub website. any help?

  • @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).

  • @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'????

  • @manavrao4824
    @manavrao4824 4 роки тому

    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

  • @JIGGAO
    @JIGGAO 4 роки тому

    how to add the number of average line?

  • @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?

  • @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 роки тому +2

      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 роки тому +2

      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

  • @mdnahianimtiazhasan7373
    @mdnahianimtiazhasan7373 3 роки тому

    Can anyone suggest a data set on which I can apply the things I learnt in this video?

  • @ahkkhans
    @ahkkhans 4 роки тому +1

    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 3 роки тому

      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.

  • @slobodantajisic2762
    @slobodantajisic2762 4 роки тому

    17586 views and 586 likes. Does it hurt to give a thumbs up?

  • @pipertripp
    @pipertripp 5 років тому +1

    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.

  • @RegisFregene
    @RegisFregene 8 місяців тому

    the thing says the code is fine but no plots are showing up

  • @iitjee3578
    @iitjee3578 Рік тому

    Where's the csv file of Responder_id, Age?

  • @markkennedy9767
    @markkennedy9767 Рік тому +1

    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 років тому +1

      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 4 роки тому +3

      ​@@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 4 роки тому +1

      @@BiancaAguglia Thanks a ton. I'm gonna try this.

  • @AndreiMargeloiu
    @AndreiMargeloiu 4 роки тому +1

    Jesus, 699 likes and 0 dislikes!

    • @TopBagon
      @TopBagon 4 роки тому +2

      Got that 700th like

  • @ET_History
    @ET_History 3 роки тому

    There are 6 dislikes. Probably 6 professors who are insecure about your lecture. :D

  • @arduh
    @arduh Рік тому

    bu hayat insanazor

  • @Thedevineforce
    @Thedevineforce 4 роки тому

    Anybody has a jupyter notebook version of his code? And if you would like to share, please comment.

  • @Arthurk346
    @Arthurk346 4 роки тому

    programmers aged between 100 and 110 are feeling offended

  • @gamerforever9137
    @gamerforever9137 3 роки тому

    Who disliked this video?

  • @fakhriddinmakhmadiyorov7269
    @fakhriddinmakhmadiyorov7269 4 роки тому

    only 1 person disliked:)