Matplotlib Tutorial (Part 6): Histograms

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии •

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

  • @testchannel4695
    @testchannel4695 3 года назад

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

  • @minhtu5059
    @minhtu5059 2 месяца назад

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

  • @yashpandey350
    @yashpandey350 4 года назад +4

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

  • @danishday6954
    @danishday6954 3 года назад

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

  • @shockey3084
    @shockey3084 5 лет назад +2

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

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

  • @PaoloCondo
    @PaoloCondo Год назад +1

    Thank you again for these amazing, useful videos!

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

  • @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 3 месяца назад

    perfection at its best !

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

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

  • @VictorCaldo
    @VictorCaldo 5 лет назад

    I love your channel, thanks Corey!

  • @SyedMohammedOmerFarooq
    @SyedMohammedOmerFarooq 3 года назад

    Thanks for a great lesson on histogram.

  • @mifrahfatma3616
    @mifrahfatma3616 4 года назад

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

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

  • @maxbranco7321
    @maxbranco7321 5 лет назад +7

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

    • @lxxfxx
      @lxxfxx 3 года назад

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

  • @tireldenamse5854
    @tireldenamse5854 5 лет назад +2

    Nice video!

  • @toubisalaheddine6432
    @toubisalaheddine6432 5 лет назад +1

    Great video 'our python hero"

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

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

  • @richiehrv
    @richiehrv 2 года назад

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

  • @ItzSenaCrazy
    @ItzSenaCrazy 5 лет назад

    THANKS!!! I love your videos.

  • @pivotai525
    @pivotai525 2 года назад

    The best!!

  • @lucacambursano2172
    @lucacambursano2172 4 года назад

    Thank you this really helped me out

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

  • @NhiVo-mk9xn
    @NhiVo-mk9xn 4 года назад

    Thank you! This helped me

  • @alexanderten5497
    @alexanderten5497 5 лет назад +1

    Great tutorial . So clear explanation

  • @tigistmimi7888
    @tigistmimi7888 3 года назад

    thank you

  • @abhinav9561
    @abhinav9561 4 года назад

    Thanks man!!

  • @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 лет назад +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.

  • @haoliu2686
    @haoliu2686 4 года назад

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

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

  • @danielalegriasallo5551
    @danielalegriasallo5551 3 года назад

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

  • @wenhanzhou5826
    @wenhanzhou5826 3 года назад

    legend

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

  • @mandeepubhi4744
    @mandeepubhi4744 5 лет назад

    Could you Create series on Data and Structures?

  • @daksharya5767
    @daksharya5767 4 года назад

    thanks ❤️

  • @qqiangg1
    @qqiangg1 3 года назад

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

  • @mp_dev2000
    @mp_dev2000 5 лет назад

    How did you work out the median ?

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

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

  • @MetallicManowar
    @MetallicManowar 5 лет назад +1

    Responder_id 10 missing 😝
    Interesting videos 🤔👌:-)

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

  • @Felix-gh3sx
    @Felix-gh3sx 4 года назад

    Why did you create new variables of age and id?

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

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

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

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

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

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

  • @patjaproduction1119
    @patjaproduction1119 2 года назад

    07:56

  • @JIGGAO
    @JIGGAO 4 года назад

    how to add the number of average line?

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

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

  • @Coney_island23
    @Coney_island23 2 года назад

    recommend

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

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

  • @ET_History
    @ET_History 3 года назад

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

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

  • @Arthurk346
    @Arthurk346 4 года назад

    programmers aged between 100 and 110 are feeling offended

  • @iitjee3578
    @iitjee3578 Год назад

    Where's the csv file of Responder_id, Age?

  • @RegisFregene
    @RegisFregene 8 месяцев назад

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

  • @Thedevineforce
    @Thedevineforce 4 года назад

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

  • @slobodantajisic2762
    @slobodantajisic2762 4 года назад

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

  • @AndreiMargeloiu
    @AndreiMargeloiu 4 года назад +1

    Jesus, 699 likes and 0 dislikes!

    • @TopBagon
      @TopBagon 4 года назад +2

      Got that 700th like

  • @arduh
    @arduh Год назад

    bu hayat insanazor

  • @markkennedy9767
    @markkennedy9767 Год назад +1

    The lack of nonagenarian programmers is worrying.

  • @gamerforever9137
    @gamerforever9137 3 года назад

    Who disliked this video?

  • @fakhriddinmakhmadiyorov7269
    @fakhriddinmakhmadiyorov7269 4 года назад

    only 1 person disliked:)