Great tips and tricks as always! do you have a tutorial video about writing efficient pandas code? for example implementing vectorization? I've watched plenty of your videos but I think I haven't seen one about the topic
Hi Kevin, Thanks for the insightful video. I love your videos and courses they are so subtle and impactful. Would it be possible for you to make a video on Python Class/objects? Its a daunting concept for someone like me (not from coding background) who has limited understanding of OOPs. Additionally I have observed that many coders use python classes for ML scripts/pipeline, scripting files on Github. So it would be helpful if you could make an video on the same. Thanks in advance !!
Thanks for your suggestion! I'll consider it for the future. For now, maybe start here: ru-vid.com/group/PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc Hope that helps!
Hi, for example I have a table, which I've got by left outer join: person - vehicle dad - car dad - motorcycle dad - bicycle mom - car mom - bicycle son - None/NA/NaN/NaT How to group by person and count with condition (car and motorcycle)? When I use for example: df = df.groupby(['person'])['vehicle'].apply(lambda x: x[x == 'car'].count()) But I can't use a list in condition lambda x: x[x in ['car']], pandas says: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
Cool. pandas and numpy seem to have a ton of functions and it’s hard to remember them all. Would appreciate a video focused on multilevel data frames, as I always forget how to index, etc those.
Hi Kevin. The most important question of all: How to remember all of those things? Do you have any means? Any way that lets you retain the tricks/knowledge in your mind for longer? Would you please share any thoughts on that? Thanks.
Great question! I don't have a system for memorization, rather it just comes naturally the more I use something. However, I also don't worry about forgetting, because I usually remember where to look in order to refresh my memory. Thus, my advice is (1) practice, and (2) keep track of good resources so that you can look up things easily whenever you forget. Hope that helps!
Great question! The assertion passed, thus no error was raised, thus no output was generated. If you're new to assertions, just try running assert(1==1) and assert(1==2) in Python, and you'll see that when an assertion passes, there is no output. Hope that helps!
Hi Kevin, Thank you for creating such amazing contents. These videos are really helpful for doing real time projects. I wanted to request you to make video on particular topic. if you can make video on how to use pandas to write, read and edit google sheets, that would be very helpful. It can include putting values in range of cells as well as one cell in google sheet, reading data, etc. If there is already any video you have made on this topic, let me know.
Thanks for the tips. Q: How crosstab provided the results compared to pivot where no target value 'Survived' is provided Unable to view the Notebook from link provided. Please re upload
Great question! With the pivot table, I just selected a column with no missing values (Survived in this case) and counted them. With crosstab, it automatically does a count, so you don't need to select a specific column. Regarding the notebook, you can view it here: github.com/justmarkham/pandas-videos/blob/master/21_more_pandas_tricks.ipynb Hope that helps!
On tips 14, I think a better solution is to use df.style to display all columns and rows of your DataFrame. If you have a lot of rows and are only interested in the columns just use df.head().style