How do I apply multiple filter criteria to a pandas DataFrame?

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

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

  • @suman14san
    @suman14san Год назад +4

    Why its always like, that i feel you are reading my mind. When you explain something, i get something in mind "what will happen if I do this" and just the very next moment you explain the same. God bless you, teachers like you have a different place in heaven

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

      Wow, you are so very kind Suman! Thank you! 🙏

  • @carkar1776
    @carkar1776 8 лет назад +40

    The clarity you provide is incredible. Please know that you are helping a lot of people by making these concepts easy to grasp. I hope you continue to provide this amazing content! You''re doing a wonderful service for the data science community.

    • @dataschool
      @dataschool  8 лет назад +4

      Wow, thank you so much for your incredibly kind comment! I greatly appreciate it. I will do my best to continue creating useful content for the community!

  • @annelizabeth728
    @annelizabeth728 7 лет назад +4

    Been coding for years and this is some of the best teaching I've ever seen. Thanks!

    • @dataschool
      @dataschool  7 лет назад

      Thank you! I really appreciate it :)

  • @alexandra-stefaniamoloiu2431
    @alexandra-stefaniamoloiu2431 8 лет назад +67

    Question: How can you be such a great teacher?

    • @dataschool
      @dataschool  8 лет назад +74

      You are very kind! Thank you.
      I think the answer is this: I have a lot of experience teaching in the classroom, I spend a ton of time preparing for every lesson (or video), and I remember what it's like to not understand something (as well as the mental path I took to gain that understanding). Plus, I care about my students, even those I will never meet! :)

    • @megalaughs89
      @megalaughs89 4 года назад +5

      @@dataschool Thank you for caring about us ( your students that u never meet)

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

      Yep

    • @helloworld-hv9oy
      @helloworld-hv9oy 3 года назад

      @@dataschool "Plus, I care about my students, even those I will never meet! :)" a few teachers bother to say this ..Happy Belated teachers Day !

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

      @@dataschool we probably may never meet, this line touched me.
      I care about my students, even those I will never meet! :)

  • @bobrossatron
    @bobrossatron 2 года назад +2

    You are a lifesaver!!! That last tip at the end of the video is exactly what I was looking for. Thank you so much!

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

      You are very welcome! 🙌

  • @morshedshahed1444
    @morshedshahed1444 2 года назад +2

    I am learning python in a data analytics course, you are awesome. I subscribed straight away.

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

    Man, I've been trying to watch a video like this for a long time, with these explanations. I never understood why square brackets, parentheses in these panda searches, now it's totally clear in my mind. Congratulations and thank you.

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

      That's awesome to hear! Thank you so much for your kind words!

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

    My guy you are a lifesaver. Legitimately pulled me out of an onset panic attack involving deadlines at work. Appreciate you so much.

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

      So glad I can be helpful to you! I appreciate your gratitude! Thanks for sharing and sorry to hear about your panic attack!

  • @phuccoiinkorea3341
    @phuccoiinkorea3341 8 лет назад +59

    The best teacher i've ever seen :D Thank you so much!

  • @sarikadatta3706
    @sarikadatta3706 2 года назад +2

    You’re indeed a very good teacher. I am so impressed with your skill of teaching.
    God bless you

  • @beansgoya
    @beansgoya 7 лет назад

    ive watched over 200 hours of python tutorials and you are by far the best. im going back to watch every single one of your videos because i still learn new things from you.

    • @dataschool
      @dataschool  7 лет назад

      That's awesome! Thank you so much for your kind words!

  • @Happybutcher
    @Happybutcher 8 лет назад

    Your are the only Python Instructor i have been able to follow until now. Thank you.

  • @MinecraftMartin
    @MinecraftMartin 6 лет назад +1

    Just want to say thank you for these videos. I was having so much trouble conceptualizing all this, being new to Python as well. You've helped tremendously. Definitely have a knack for explaining things for a general audience and not going over anyone's head.

    • @dataschool
      @dataschool  6 лет назад

      That's awesome! Thanks very much for your kind words!

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

    the awesomeness of your teaching and will to share your knowledge has been already stated by several comenters, therefore I just want to say thank you!

  • @dogruyatrm5703
    @dogruyatrm5703 7 лет назад +2

    I have to say that you're an EXCELLENT teacher, greeting from Turkey! :)

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

    This short video has cleared up 2 semesters of Grad School. Thank you!

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

      That's awesome to hear! 🙌

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

    Best teacher i have ever seen .its a pleasure to watch your videos

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

    This man has a solutions to every weird question that comes in my mind.

  • @madhushreedas5113
    @madhushreedas5113 3 года назад +1

    i am new to Python and Dataframe, you have explained it in a wonderful way to visualize the over all picture of data and way to extract ! thank you

  • @markl9451
    @markl9451 3 года назад +1

    Thanks for posting this, very easy to follow and incredibly useful to someone just starting out with Pandas. Great work!

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

    your each video is a masterpiece of learning pandas. Many thanks for your efforts and nobility to share your knowledge...

  • @ramakanthrayanchi8888
    @ramakanthrayanchi8888 8 лет назад

    The final tip in the video would be very handy. Excellent video. Thanks :)

    • @dataschool
      @dataschool  8 лет назад

      Awesome, glad it was helpful to you :)

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

    I need another video, as clear as this one, illustrating the use of matplotlib.Thanks a lot

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

      Thanks for your suggestion!

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

    I am very impressed of how you exxplain the functions in pandas. It works very fine for me. And +350 others I guess.

  • @williamsullivan9316
    @williamsullivan9316 6 лет назад +4

    Exactly what I was looking for. Explained very well. Thank you!

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

    You're a fantastic teacher. Well done & thank you!

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

    You are amazing teacher i didn't find pandas so easy anywhere

  • @SheIsSinging
    @SheIsSinging 6 лет назад

    Fantastic... you are among the top 0.000001% of the best teachers on earth. Thanks:)

    • @dataschool
      @dataschool  6 лет назад

      Thanks very much for your kind words!

  • @malathimurugesan2316
    @malathimurugesan2316 8 лет назад +1

    Great service . It shows that you take a lot of time and effort preparing these videos and uploading them. Excellent work. You have set an example. would like to see your profile.

    • @dataschool
      @dataschool  8 лет назад

      Thanks very much for your kind words! Here's more information about me: www.dataschool.io/about/

  • @SheshadriMadhu
    @SheshadriMadhu 8 лет назад +16

    You remind me of Dr Sheldon Cooper! :) Great Effort! :) Keep up the good work!

    • @dataschool
      @dataschool  8 лет назад

      Ha! Thanks! :)

    • @NicatBehbudov
      @NicatBehbudov 6 лет назад

      OMG YESS! I was thinking about whom he reminds me of :D That's right. Sheldon!

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

      Except the fact that Dr. Sheldon Cooper is not at al la brilliant teacher as this guy! :D

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

      Yes! I was thinking about this since the first video :D

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

    I really appreciate your time and effort in these amazing videos. I learned too much

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

      Thank you so much for your kind words! 🙏

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

      You're right, is not easy to explain that way, the best teacher I've ever seen.

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

      Thank you! 😄

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

    Exactly what I needed to solve a problem. Thanks a bunch.

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

    Incredible videos, the best explanations of pandas I've ever encountered

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

    Better than the class i'm in!

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

    Thank you so much! You should have 10 million subs! Cheers!

  • @terrancedejesus625
    @terrancedejesus625 8 лет назад +1

    Fantastic video and easy to follow and understand!

    • @dataschool
      @dataschool  8 лет назад

      Thanks very much! Glad it was helpful to you :)

  • @mazkaibil9108
    @mazkaibil9108 6 лет назад

    I really do not understand how people can dislike this video.

    • @dataschool
      @dataschool  6 лет назад

      Thanks for your kind words! :)

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

    Excellent as always !! I have already recommended your videos to my colleagues :).
    Something I am not able to find any where on youtube is how to use If Else to add new columns in a dataframe. Example: Based on Genre, I create a new column: If Genre = 'Drama' then New_Column = 'Col_Drama', Else if Genre isin(["Thriller","Horror"]) then New_Column = 'Col_Thril_horrer".

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

      Thanks for sharing my videos! As for your question, that will be multiple lines of code though I won't have the time to detail it all out. Good luck!

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

    Awesome! Every visit leaves me with value added. Thank you Coach

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

      That's awesome to hear! 🙌

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

    You're Amazing 🙌🙌 !! Sorry for those who is disliked his Video.
    If they don't understood from here, nobody can teach them...

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

      Thanks for your kind words!

  • @snehipachchigar7726
    @snehipachchigar7726 6 лет назад +1

    Best Best Best Teaching! Thanks a lott, Kevin! You are amazing.
    Love from India!

  • @jdavis38100
    @jdavis38100 8 лет назад

    Great video Kevin!
    Here is a related question: what is the difference between a view and a copy? Should you ever deliberately use a view instead of a copy? What are the pros. and cons of a view vs. a copy?
    One motivation for this question lies in understanding the following error when creating & replacing columns/values in a dataframe:
    A value is trying to be set on a copy of a slice from a DataFrame.
    Try using .loc[row_index,col_indexer] = value instead
    It looks like you were planning to do a video relating to chained indexing, and so it might be that you were already planning to cover this topic.

    • @dataschool
      @dataschool  8 лет назад

      Glad you liked the video! Regarding a DataFrame view versus a copy, the difference is simply whether they share the same space in memory (view=same space, copy=different space). It's sometimes not obvious whether you are looking at a view or a copy in pandas, and many times it doesn't even matter. However, you will always want to explicitly make a copy of the DataFrame if you are going to modify it. My upcoming video (August 2) will discuss this more, including how to deal with the warning message you mentioned. In the meantime, here are some relevant links:
      tomaugspurger.github.io/modern-1.html
      stackoverflow.com/questions/34884536/what-is-the-point-of-views-in-pandas-if-it-is-undefined-whether-an-indexing-oper

    • @dataschool
      @dataschool  8 лет назад

      Here's the video I just released, that I think will be helpful in answering your questions about chained indexing: ruclips.net/video/4R4WsDJ-KVc/видео.html
      Let me know if it helps! :)

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

    I know this might be a bit too late, but a good way to explain the booleans might be with a Vern's Diagram. It is explicit and really easy to represent.
    Nevertheless, amazing work and this has been helping me a lot more than anything I have from my teacher.

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

      Great ideas, and thanks for your kind words! 😄

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

    THANK YOU for this video. I've been trying to figure out how to filter multiple columns by a list and could not figure it out. Using the | got it done for me! Thank you thank you thank you

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

      You're so very welcome! Congrats for figuring it out!

  • @AlexAgha89
    @AlexAgha89 7 лет назад

    Hey, thanks for the great content. just thought id comment that you can probably simplify this using the DataFrame.query method. Instead of saying movies[(movies.duration >= 200) and (movies.genre == 'Drama')] , you could use movies.query('genre == "Crime" | duration > 200').
    That saves you having to use the numerous brackets terms and from having to name the dataframe repeatedly. I think it's also meant to run much more efficiently since it uses the same method as df.eval. Thanks again for the series and particularly for varying it up and not just using the iris dataset like so many other channels do!

    • @dataschool
      @dataschool  7 лет назад

      You're very welcome for the video series! I enjoyed creating it.
      Regarding query, I am familiar with that method, but I don't use (or teach it) since the pandas documentation lists it as "experimental": pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-query
      If that method becomes a permanent part of the pandas API, then I will definitely start using it. Until then, I prefer to use notation that is "stable" (meaning it will definitely remain part of the API).

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

    Just watch this clip to refresh my pandas knowledge.
    Thanks a lot for these wonderful tutorials 😚.
    Please when would you be making new videos, I can't wait

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

      New pandas video coming out next week! :)

  • @thewelfarestate
    @thewelfarestate 8 лет назад +2

    Excellent video! Very clear Mr. Pandas :D

    • @dataschool
      @dataschool  8 лет назад +1

      Thanks! I like that nickname :)

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

    why did you use bitwise and (&) instead of logical and(and)?

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

    Very clear explanations. Thank you!

  • @s.baskaravishnu22
    @s.baskaravishnu22 7 лет назад

    I very much congratulate you for sharing code used in video with us. Many thanks for that. It is very much useful to me. My warm regards to you.

  • @harryconnor4157
    @harryconnor4157 8 лет назад

    Hi - I don't normally comment on videos but these are fantastic! I thought I'd show some support :) Keep on pushing on!
    -Harry

    • @dataschool
      @dataschool  8 лет назад

      Awesome, thanks for your support! :)

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

    Excellent teacher! Keep training us please!!!

  • @ratiram9556
    @ratiram9556 2 года назад +1

    Simply awesome explanation...👌👌

  • @jaquesderasmo5496
    @jaquesderasmo5496 3 года назад +1

    Kevin, you are the best bro

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

    I get alot from your videos. Stay blessed

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

    You are the best teacher! Wonder if you can make a vedio to show how to create decile by an attribute in Python. Thanks

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

      Thanks for your kind words! Could you clarify what exactly you are looking for?

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

    Thank you for helping me. You just saved my project !!

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

    what is the simpliest way for and operator? ... just like you tell about and operator at the end...great approach sir.

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

    Great lecture.. I loved it ! My question is .. For multiple conditions on one column, you have used isin method. What if I have multiple conditions on multiple columns ? How can I write in a concise manner

  • @ahmadzaimhilmi
    @ahmadzaimhilmi 6 лет назад +2

    .isin()... Thank you for this tips. I have been searching for this for a long time on how to simplify my search query script.

  • @abhishekjain96
    @abhishekjain96 7 лет назад

    First of all, THANK YOU SO MUCH for working on this series as well as the series on ML with Python. I have learned from from you than all the other resources combined.
    I have a question though. Why can't we use 'and' instead of '&' ?

    • @dataschool
      @dataschool  7 лет назад

      You're very welcome for the videos! Regarding your question, it's a technical detail that was explained to me once before, but I don't fully remember the explanation... sorry!

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

      Python's and, or and not logical operators are designed to work with scalars. So Pandas had to do one better and override the bitwise operators to achieve a vectorized (element-wise) version of this functionality.
      exp1 and exp2 # logical AND
      exp1 & exp2 # element-wise logical AND
      using "and" You are implicitly asking Python to convert to a boolean value.
      NumPy arrays (of length greater than 1) and Pandas objects such as Series do not have a boolean value -- in other words, they raise
      ValueError: The truth value of an array is ambiguous. Use a.empty, a.any() or a.all().
      stackoverflow.com/questions/21415661/logical-operators-for-boolean-indexing-in-pandas
      Hope this helps...

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

    One question please: what if, in minute 5:23 , the name of the collum was like “A.genre” or “33.duration” ? We would have to put on brackets then?
    Thank you so much for this videos!!!

    • @dataschool
      @dataschool  2 года назад +1

      That's correct. Glad the videos are helpful to you!

  • @marklittlewood2418
    @marklittlewood2418 8 лет назад

    Great delivery and style Kevin well done and keep them coming. This session highlights what I dislike about Python. Why would you utilise 'and' within the language itself but '&' in Pandas ?. Why force bracket use when for the last 50 years we have had a clear well understood order of precedence where brackets are used only when needed. I do wish Perl had got its act together when it comes to data mining. No reflection on this series Kevin which is excellent.

    • @dataschool
      @dataschool  8 лет назад

      Thanks for your kind words about the videos! And, your point is well taken. There are pros and cons to every language, and for many people, the pros of Python outweigh the cons.

    • @marklittlewood2418
      @marklittlewood2418 8 лет назад

      As a University Computer Science lecturer for 27 years I have always been interested in what makes a good lecturer. Can I ask, did you model your style on anyone in particular, maybe from your student days or would you say your style is a simply a reflection of you.

    • @dataschool
      @dataschool  8 лет назад

      It's simply a reflection of me!

    • @marklittlewood2418
      @marklittlewood2418 8 лет назад +1

      Yes teachers are born, rarely made. Well done excellent series

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

      Python's and, or and not logical operators are designed to work with scalars. So Pandas had to do one better and override the bitwise operators to achieve a vectorized (element-wise) version of this functionality.
      exp1 and exp2 # logical AND
      exp1 & exp2 # element-wise logical AND
      using "and" You are implicitly asking Python to convert to a boolean value.
      NumPy arrays (of length greater than 1) and Pandas objects such as Series do not have a boolean value -- in other words, they raise
      ValueError when used as a boolean value. That's because it's unclear when it should be True or False.
      ValueError: The truth value of an array is ambiguous. Use a.empty, a.any() or a.all().
      stackoverflow.com/questions/21415661/logical-operators-for-boolean-indexing-in-pandas
      I hope this helps...

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

    got it ok.your talk is very clear and educative.Thank you.

  • @faisalzia2201
    @faisalzia2201 6 лет назад +1

    An incredible effort ...keep it up.

    • @dataschool
      @dataschool  6 лет назад

      Thanks very much for your kind words!

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

    ¡Gracias!

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

      Wow, thank you! That is so very kind of you, Daniel! 🙏

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

    Hey not sure if you would reply, but I was wondering if these filters can be used on pandastable to show me a filtered dataframe WITHOUT using the in built string query in pandastable gui

  • @Windiddy
    @Windiddy 6 лет назад

    Hi, when I did the step at 5:21 using my own dataset, it only returns the column names. Do you know why it does that?

    • @dataschool
      @dataschool  6 лет назад

      Maybe you have a typo somewhere in there? Or you have modified the DataFrame before this step?

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

    Excellent video, very well explained. One question. Isin is for exact match only? using you example if some row has "Crime." instead of "Crime" still consider that row? there is another method to incluid that variation on the write? thank you.

  • @吳維章-u2c
    @吳維章-u2c 6 лет назад

    This is great! Thank you so much, I was stuck in this problem before.

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

    Simply the best, so easy to understand to follow and to learn. Thank you.
    I have a question, what if I want to know which genres are associated to an actor?
    I mean, how can I split that column?

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

    Thanks for your valuable lesson. May I know which screen video recorder software do you use because clarity is great. Thanks

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

    wow. that was great you saved me from my struggle.
    one question though is where do you go to know the command syntax and the explanations for each part?
    Is there a website os something that you use?

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

    how do I display the unique values in the dataframe column and inplace them?

  • @ryanhaberle4884
    @ryanhaberle4884 6 лет назад

    awesome video series! Thanks for sharing the knowledge!

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

    thanks for the video. What about if you need to check two columns and if the value of the list isin either one?

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

    HiI!
    Could you please specify that how can we know that when to use " ( ) " or " [ ] " while running any function or method?

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

    You are a good teacher

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

    Thanks a lot,great video as usual.I just wanted to ask why exactly can't we use 'and' instead of '&'. I roughly get the idea that and is relational and & is bitwise but still?

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

      Python's and, or and not logical operators are designed to work with scalars. So Pandas had to do one better and override the bitwise operators to achieve a vectorized (element-wise) version of this functionality.
      exp1 and exp2 # logical AND
      exp1 & exp2 # element-wise logical AND
      using "and" You are implicitly asking Python to convert to a boolean value.
      NumPy arrays (of length greater than 1) and Pandas objects such as Series do not have a boolean value -- in other words, they raise
      ValueError: The truth value of an array is ambiguous. Use a.empty, a.any() or a.all().
      stackoverflow.com/questions/21415661/logical-operators-for-boolean-indexing-in-pandas
      I hope this helps...

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

      Excellent answer, Atanu!

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

      @@dataschool thanks a lot... Just love the way you are going... Already a fan!
      ps: just saw your series of playlists on statistical learning... if possible, do some series on "statistics" and "python libraries on statistics"
      And also on "deeplearning", "TensorFlow", "GANs" and other advanced topics in the field of Ai & ML
      Everyone is more of application and using it blindly approach...
      The theoretical step by step approach in depth is just what I was looking for, and I finally got to you, and am really happy :)

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

      @@mratanusarkar Thank you.

  • @manjulaannam257
    @manjulaannam257 10 месяцев назад

    Hello sir, is this enough to learn as a data analyst.....

  • @karthikudupa5475
    @karthikudupa5475 6 лет назад

    Thank you Kevin. df.Series.isin() method is really impressive!! Please keep up the good work.

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

    Very interesting and well explained, thank you!

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

    You are great!
    Wondering if you have a result of a large survey as multiple choice questions how would you best use pandas to clean the data. I would love to see video on that. Thanks!

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

      Thanks for your suggestion!

  • @bhaskarreddy2745
    @bhaskarreddy2745 7 лет назад

    Your the Awesome Teacher... Its really helpful... Thanks SO Much ..

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

    Thanks so much! Great video - you are an excellent teacher! :)

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

    Dear Sir, in the bonus tip - Multiple Filter , may we use the 'AND' in the 'isin' [ list ] instead of' OR' for the same result.
    Thanks.

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

      Not sure I understand your question, sorry!

  • @nirodhasamapatti3527
    @nirodhasamapatti3527 6 лет назад

    Hi ,
    i encounter an error as syntax error when using df[ df.col_1 > 0 ] where df is a dataframe with column name col_1 . Any idea , how to resolve. Thanks.

    • @dataschool
      @dataschool  6 лет назад

      Maybe col_1 is not numeric?

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

    I use and in python code. Are we not able to use it here because we are dealing with boolean?

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

    I want to filter 2 or more categories data in a single column so would I do that?

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

    Hi, how to apply multiple filter in loc rows ? ie: i tried movies.loc[[movies.dutation>=200],[movies.genre=='Drama'],['duration',['genre']] but it dint work , i can able to apply only one filter in rows like movies.loc[movies.duration>=200, [ 'duration','genre']]

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

      Try this:
      filter_criteria = (movies['duration'] >= 200) & (movies['genre'] == 'Drama')
      movies_filtered = movies[ filter_criteria ]
      Here is a video explanation that I created on this topic (see 2 min 30 sec specifically) ruclips.net/video/ni9ng4Jy3Z8/видео.html

  • @TheSoonAnn
    @TheSoonAnn 7 лет назад

    excellent tips, looking forward to more video from you

  • @scottlucas3710
    @scottlucas3710 6 лет назад

    Great Job Kevin !

    • @dataschool
      @dataschool  6 лет назад

      You're very welcome, Scott! Thanks for your support :)

  • @jmachado9875
    @jmachado9875 6 лет назад +1

    How articulate can one be! Thank you so much.

    • @dataschool
      @dataschool  6 лет назад

      Thanks very much for your kind words!

  • @philiperiskallaleal6010
    @philiperiskallaleal6010 6 лет назад

    Dear Kevin Markham,
    thank you for your videos. They have been most useful.
    In respect to this video entitled "How do I apply multiple filter criteria to a pandas DataFrame?"
    how could someone apply a double multy-criteria filtering process?
    I have been trying to use the the same example you show in this video (using a video dataframe).
    Here is an example of what I have been trying to do: "filter all movies under Crime, Drama and Action Criteria, whose duration would be larger or equal to 150 min".
    Here is the line code I tried in pandas, but unsuccessfully.
    line code:
    movies[movies.genre.isin(['Crime', 'Drama', 'Action']) & movies.duration>=150]
    Sincerely,

    • @dataschool
      @dataschool  6 лет назад

      I think this should work:
      movies[(movies.genre.isin(['Crime', 'Drama', 'Action'])) & (movies.duration>=150)]

  • @olabrew
    @olabrew 7 лет назад

    Quick question - can you apply the isin function together with another function? i.e. could you say:
    movies[(movies.genre.isin(['Crime', 'Drama', 'Action'])) & (movies.duration >= 180)] ?
    Thanks for the great videos!

    • @dataschool
      @dataschool  7 лет назад

      What you are suggesting should work... glad you like the videos!

    • @olabrew
      @olabrew 7 лет назад

      Data School thanks it did. Have you got any lesson on using the pivot function? Might be one to consider?

    • @dataschool
      @dataschool  7 лет назад

      I don't yet, but it's under consideration for the future :)

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

    Awesome!!! Very well done!!!

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

    What if you were to filter the title that has for example "Fight" on the title. How to do it?

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

    hi if i have two data frames with diff indexes,, same length, and i want to filter data from first using condition on a column of the second. Is it possible to implement in some way?? when i tried..df1[df2[4]>40]...i received this error.......(Unalignable boolean Series provided as indexer (index of the boolean Series and of the indexed object do not match),,i understand this is because of diff index...but is there a way??

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

      I think you would have to reset one or both of the indexes so that they match.

  • @sukhendutarafder381
    @sukhendutarafder381 7 лет назад

    Sir you are a great teacher, could you please make video on most important used 'import' based on type of tasks we generally do? thanks a lot!!!

    • @dataschool
      @dataschool  7 лет назад

      Thanks for your suggestion!

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

    Hi ,
    How to select particular column using mutiple filter criteria
    like movies[(movies["duration"]>=200) & (movies["genre"].isin(["Drama","Action"]))].title
    here i can get only title where these conditions are met but if i want to get title and star_rating then how to do that?

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

      It looks like you are on the right track. Just add two square pairs of square brackets [[ ]] with the names of the columns that you want returned. Be sure to put quotation marks around the column names.
      movies[(movies["duration"]>=200) & (movies["genre"].isin(["Drama","Action"]))][['title','star_rating']]