What do I need to know about the pandas index? (Part 1)

  Рет қаралды 133,648

Data School

Data School

Күн бұрын

The DataFrame index is core to the functionality of pandas, yet it's confusing to many users. In this video, I'll explain what the index is used for and why you might want to store your data in the index. I'll also demonstrate how to set and reset the index, and show how that affects the DataFrame's shape and contents.
SUBSCRIBE to learn data science with Python:
kzbin.info?su...
JOIN the "Data School Insiders" community and receive exclusive rewards:
/ dataschool
== RESOURCES ==
GitHub repository for the series: github.com/justmarkham/pandas...
"loc" documentation: pandas.pydata.org/pandas-docs/...
"set_index" documentation: pandas.pydata.org/pandas-docs/...
"reset_index" documentation: pandas.pydata.org/pandas-docs/...
Indexing and selecting data: pandas.pydata.org/pandas-docs/...
== LET'S CONNECT! ==
Newsletter: www.dataschool.io/subscribe/
Twitter: / justmarkham
Facebook: / datascienceschool
LinkedIn: / justmarkham

Пікірлер: 252
@avantikasingh4576
@avantikasingh4576 4 жыл бұрын
Thanks for being so effortless and keeping it to the base level .... it is more understandable!
@MaryMacor
@MaryMacor 4 жыл бұрын
You are so articulate and never give me a headache like most of the others
@WanderPalateAdventure
@WanderPalateAdventure 4 жыл бұрын
You made my life easy. I am new to this language word and was struggling to understand the concepts. Your videos just saved me.
@BiranchiNarayanNayak
@BiranchiNarayanNayak 4 жыл бұрын
Data School is the ultimate place to learn about Pandas. Thanks for the excellent tutorials on Pandas.
@nataliaagudelo8635
@nataliaagudelo8635 5 жыл бұрын
I am so glad I found your channel, always very thankful for you and your capacity to share your knowledge with us!
@dataschool
@dataschool 5 жыл бұрын
Thanks, Natalia! :)
@nathanzorndorf8214
@nathanzorndorf8214 7 жыл бұрын
Dude your videos are so f&*@n clear, they put the MOOCs I'm in to shame.
@dataschool
@dataschool 7 жыл бұрын
Ha! Thanks so much, I'm glad to hear!
@anabelsa
@anabelsa 7 жыл бұрын
I totally agree with Nathan. I am following a MOOC from Harvard, and I have to come here to understand many things that remain totally obscure (at least for me) there. Thanks so much!!!
@AsadAli-ck6fv
@AsadAli-ck6fv 7 жыл бұрын
I'm following an online data science course - and your material is far clearer - keep up your good work!
@marinajin8797
@marinajin8797 4 жыл бұрын
Best of the best, I can follow you step by step, which makes the learning process so efficient and fun. Thanks a MILL
@dataschool
@dataschool 4 жыл бұрын
Thank you! 😊
@sararabiee8610
@sararabiee8610 6 жыл бұрын
You are an amazing teacher. I am new to this field and your videos are great help. Thanks a million 🙏🏽
@dataschool
@dataschool 6 жыл бұрын
You're very welcome! Thanks very much for your kind words! :)
@tomasfanta9768
@tomasfanta9768 5 жыл бұрын
Nice, clear and very helpful, especially "pd.DataFrame.reset_index" usage, thank you!
@dataschool
@dataschool 5 жыл бұрын
You're very welcome!
@khanyasser
@khanyasser 3 жыл бұрын
wooow so glad I chose this video over others! So thorough and clear! Easy to follow! I was struggling and now my code is working. thank you.
@dataschool
@dataschool 3 жыл бұрын
Glad it helped!
@adventuresunlimited4483
@adventuresunlimited4483 5 жыл бұрын
I really appreciate the hard work you put in in your videos. I am taking a class in Python and your videos really helped me develop a finer understanding of what is being taught in my classes. These are the best videos for Pandas, I totally love them. I have subscribed and visit your channel almost everyday and each day I get what I was looking for. All the best to you. Keep up the good work.
@dataschool
@dataschool 5 жыл бұрын
Awesome! Thanks so much for your kind words! :)
@armenlevonian5204
@armenlevonian5204 7 жыл бұрын
Super clear and helpful!! I so agree with others who commented as such. Thank you!!
@dataschool
@dataschool 7 жыл бұрын
You're very welcome! It's exactly the kind of video I wish was available when I was learning pandas, and that's why I made it :)
@niteshmaruthi8784
@niteshmaruthi8784 4 жыл бұрын
Brilliant- This made the exact function of indexes very clear - I am binge watching these videos now!
@dataschool
@dataschool 3 жыл бұрын
Awesome! 🙌
@sep69
@sep69 5 жыл бұрын
Thanks so for this video. It made me understand something I was struggling with. I'm going to watch you other video's right away :)
@dataschool
@dataschool 5 жыл бұрын
Awesome! Great to hear :)
@zennologyofeverything7265
@zennologyofeverything7265 6 жыл бұрын
THANK YOU! I just started with python datascience projects. My first project is the famous iris dataset. this helps a lot
@dataschool
@dataschool 6 жыл бұрын
You're very welcome!
@akashpoudel571
@akashpoudel571 5 жыл бұрын
i dont understand who is that super human who dislikes your videos Sir.....i thinnk we are blessed u are giving your time to teach
@dataschool
@dataschool 5 жыл бұрын
Thanks very much for your kind words! 😊
@aqilraza
@aqilraza 7 жыл бұрын
Excellent! Excellent! Excellent! way of explaining the concept of index - you rock!
@dataschool
@dataschool 7 жыл бұрын
Wow, thank you! :)
@bingochipspass08
@bingochipspass08 3 жыл бұрын
Perfect explanation! Even the documentation doesn't do such a good job!
@dataschool
@dataschool 3 жыл бұрын
Thank you! 🙏
@leonardoferigutti9039
@leonardoferigutti9039 3 жыл бұрын
Excelent job!! It's amazing the quality of your job!! Thanks
@dataschool
@dataschool 3 жыл бұрын
Thank you very much!
@aqilraza
@aqilraza 7 жыл бұрын
Now I understand how to use set_index(). Excellent way of explaining key concepts.
@dataschool
@dataschool 7 жыл бұрын
I'm glad to hear it was helpful to you!
@susansilver1334
@susansilver1334 6 жыл бұрын
Very clear. So good. Subscribed! I will gladly give you my time. You are a good teacher.
@dataschool
@dataschool 6 жыл бұрын
Awesome, thanks!
@Honest_Reply900
@Honest_Reply900 2 жыл бұрын
Thanks a lot for the detailed explanation. I appreciate you hard work and sharing your knowledge
@dataschool
@dataschool 2 жыл бұрын
Thanks!
@rvma77
@rvma77 7 жыл бұрын
Your videos are great! Thank you for sharing your knowledge.
@dataschool
@dataschool 7 жыл бұрын
Thanks so much!
@farooq36901
@farooq36901 2 жыл бұрын
You are a fantastic teacher.
@dataschool
@dataschool 2 жыл бұрын
Thank you!
@christat13
@christat13 7 жыл бұрын
Many, many thanks for all of your awesome videos. Super helpful, quick and easy to follow! Wish I found your site sooner, it would have saved me a lot of aggravation!
@dataschool
@dataschool 7 жыл бұрын
You're very welcome! Thanks for your kind words :)
@reshaknarayan3944
@reshaknarayan3944 5 жыл бұрын
Excellent bro! Keep up the good work.
@dataschool
@dataschool 5 жыл бұрын
Thanks!
@ossenaar
@ossenaar 6 жыл бұрын
Great videos series in pandas. For scalar selections (individual elements) in a large data frame, there is a faster alternative for using loc (labels based) and iloc (integer position based): at and iat.
@dataschool
@dataschool 6 жыл бұрын
I did not know that... thanks for sharing!
@sunilarora1750
@sunilarora1750 4 жыл бұрын
Dude, you have best communication skills among Data Science Coaches
@dataschool
@dataschool 4 жыл бұрын
Thank you!
@lukeemrose
@lukeemrose 6 жыл бұрын
Great videos mate! Keep up the good work
@dataschool
@dataschool 6 жыл бұрын
Thanks! :)
@ganxe
@ganxe 7 жыл бұрын
Very nice, very clear, thank you bro. I subscribe!
@dataschool
@dataschool 7 жыл бұрын
Thanks for subscribing!
@zes7215
@zes7215 5 жыл бұрын
no such thing as cx or nx or not, any can be perfx
@akramsystems
@akramsystems 6 жыл бұрын
reset_index() exactly what I was looking for to make a new set of indices in order of your current DataFrame :D thanks!
@dataschool
@dataschool 6 жыл бұрын
You're welcome!
@datascienceds7965
@datascienceds7965 6 жыл бұрын
You deserve million subscription. I got an answer that I was looking for ages!!! reseting index to column. You saved my time. Thank you so much. I was wondering if you have done any percentage plotting. Sorry if it is a wrong way of asking !!
@dataschool
@dataschool 6 жыл бұрын
Thanks! I'm not sure what you mean by percentage plotting, sorry!
@datascienceds7965
@datascienceds7965 6 жыл бұрын
No worries. I got answer that I was looking. Thanks for taking time to reply.
@husseinshuriye6380
@husseinshuriye6380 6 жыл бұрын
Excellent Explanations, Thank bro
@dataschool
@dataschool 6 жыл бұрын
You're welcome!
@rsiqueir2
@rsiqueir2 5 жыл бұрын
Thank you! Your video helped me so much!!
@dataschool
@dataschool 5 жыл бұрын
Awesome!
@mahmudhasanmunna9314
@mahmudhasanmunna9314 3 жыл бұрын
your video help me a lot. thank you
@dataschool
@dataschool 2 жыл бұрын
You're very welcome!
@peterfrantz477
@peterfrantz477 8 ай бұрын
What a great tutorial!
@dataschool
@dataschool 8 ай бұрын
Thank you!
@kanokpornpoomsirivilai7018
@kanokpornpoomsirivilai7018 3 жыл бұрын
thanks a lot. very thorough.
@dataschool
@dataschool 3 жыл бұрын
You're welcome!
@slavrine
@slavrine 6 жыл бұрын
It must be python 3, but drink.index shows up differently: RangeIndex(start=0, stop=193, step=1). As for the quality of your presentation, this should be a paid course! You're presenting the material so well! Would love to see you do more python courses - Matplotlib, etc
@dataschool
@dataschool 6 жыл бұрын
The index difference is due to the pandas version. Thanks for your very kind comment! I appreciate it!
@BadriNathJK
@BadriNathJK 8 жыл бұрын
Please do videos on merge concatenate and split of data frames. That would be extremely helpful.
@dataschool
@dataschool 8 жыл бұрын
Thanks for the suggestion!
@rajeshd3574
@rajeshd3574 4 жыл бұрын
@@dataschool Eagerly waiting for this video
@nabazgharib
@nabazgharib 8 жыл бұрын
Thank you for your videos. You are amazingly explaining the commands in pandas, this is what I was looking for. I hope you give a tutor on datetime datatype, and how to parse string to datetime and vice versa in pandas. and how to create a time series.
@dataschool
@dataschool 8 жыл бұрын
Thank you so much for your kind words! I have a video coming out on July 19 discussing the datetime format... I'll let you know when it comes out!
@dataschool
@dataschool 8 жыл бұрын
My video on the datetime format has been released, and should be helpful to you! kzbin.info/www/bejne/r3TKe3qpnJWLl5Y
@redcat7467
@redcat7467 3 жыл бұрын
The tip is amazing.
@dataschool
@dataschool 3 жыл бұрын
Thanks!
@rachellelancer3577
@rachellelancer3577 6 жыл бұрын
Super helpful. Thanks so much
@dataschool
@dataschool 6 жыл бұрын
You're welcome!
@PankajKumar-ot3mg
@PankajKumar-ot3mg Жыл бұрын
super amazing teacher
@dataschool
@dataschool Жыл бұрын
Thanks so much!
@vishalaggarwal8783
@vishalaggarwal8783 6 жыл бұрын
When you are making the Data Visualisation series.Please do that ,it is highly required.
@dataschool
@dataschool 6 жыл бұрын
Thanks for the suggestion! I'm not sure when I'll be creating it.
@dulangikanchana8237
@dulangikanchana8237 4 жыл бұрын
Hello awesome videos, can you kindly make some videos for numpy, and sklearn libraries, and k-means clustering, and supervised learning algorithms,R, and maybe Tensor Flow you are one of the best data science teachers at KZbin, Best of Luck, don't stop making videos.
@dataschool
@dataschool 4 жыл бұрын
Here are my scikit-learn videos: kzbin.info/aero/PL5-da3qGB5ICeMbQuqbbCOQWcS6OYBr5A
@user-co8ki3ce5n
@user-co8ki3ce5n 3 жыл бұрын
Hello Dear, Respect for the the elegance , respect for the simplicity I am Egyptian arabic speaker with good english competence,I 've started to teach some pandas videos in arabic (learn data analysis from a beginner:), You are my role model , wonder if dataset links here is open source? can i use them in my videos? Regards
@ramakanthrayanchi8888
@ramakanthrayanchi8888 8 жыл бұрын
Excellent video !! Cheers
@dataschool
@dataschool 8 жыл бұрын
Thanks!
@albertteplitsky7629
@albertteplitsky7629 6 жыл бұрын
Hello Kevin, I love your videos and they have helped me improve my programming skills to an entirely new level. I was wondering if you would be able to provide links or availability on how to access more complicated science-based data-sets because often the hardest thing to do is just find data sets with the necessary complexity to practice on. Continue the good work!!!
@dataschool
@dataschool 6 жыл бұрын
Glad I have been helpful! Regarding datasets for practice, I like this source: www.kaggle.com/datasets
@albertteplitsky7629
@albertteplitsky7629 6 жыл бұрын
Data School thank you very much Kevin!! I greatly appreciate this I will be doing some fun projects with these 👍
@dataschool
@dataschool 6 жыл бұрын
You are very welcome! :)
@yucelozyazgan
@yucelozyazgan 7 жыл бұрын
Simply life saver videos for new programmers like me! How can i and others like me support you to keep you on this way ? i mean is there any way to make simple supports to you ? ( like tip box )
@dataschool
@dataschool 7 жыл бұрын
Thanks for your kind words, and for your generous offer! On my channel page, there is a blue button on the right side that says "Support", which allows you to make a donation of any size: kzbin.info Also, I have a PayPal link at the bottom of this page: www.dataschool.io/about/ Thanks again! :)
@DimasAnggaFM
@DimasAnggaFM 6 жыл бұрын
this video is great great!!
@dataschool
@dataschool 6 жыл бұрын
Thanks!
@Martin-dw4eo
@Martin-dw4eo 2 жыл бұрын
Thank you!
@dataschool
@dataschool 2 жыл бұрын
You're welcome!
@MagnusAnand
@MagnusAnand 2 жыл бұрын
Great video
@dataschool
@dataschool 2 жыл бұрын
Thanks!
@asneogy
@asneogy 8 жыл бұрын
Hey Kevin! I think it would be important to emphasize here, when you converted the country to an Index, that the values in the index need to be unique (primary keys). Otherwise (does it give an error?) it totally ruins the purpose of identification / selection / alignment / merging. That way you could also reconnect to the unique() and nunique() methods as pre-requisites before setting the index. Awesome video as always.
@dataschool
@dataschool 8 жыл бұрын
Actually, index values do not need to be unique! In fact, there may be cases in which you desire a non-unique index, and you can still use it for identification etc.
@asneogy
@asneogy 8 жыл бұрын
thats very interesting! could you give an example where that would be useful?
@dataschool
@dataschool 8 жыл бұрын
Sure. Imagine a dataset of web server logs. Perhaps you want to use the IP address of the requesting computer as the index, in order to make it most convenient to filter the dataset by IP address. Or perhaps you want to use the datetime of requests as the index, even though it's possible for multiple requests to come in at the same time.
@fet1612
@fet1612 4 жыл бұрын
4:31 "Why does the index exist? And there are 3 main reasons." 1) identification 2) selection 3) alignment
@karthikudupa5475
@karthikudupa5475 5 жыл бұрын
you are awesome bro!!
@dataschool
@dataschool 5 жыл бұрын
Thanks!
@baixartv
@baixartv 5 жыл бұрын
Hello from Brazil :)
@dataschool
@dataschool 5 жыл бұрын
Hello from the USA! :)
@waela3637
@waela3637 3 жыл бұрын
thank you, I was stuck how to change the header of my dataset
@dataschool
@dataschool 3 жыл бұрын
You're welcome!
@nimesharya909
@nimesharya909 7 жыл бұрын
amazing, best explantion. do u have tutorials for video analytics, machine learning, tableau
@dataschool
@dataschool 7 жыл бұрын
Thanks! Here's my video series on machine learning with scikit-learn: kzbin.info/aero/PL5-da3qGB5ICeMbQuqbbCOQWcS6OYBr5A
@dawjid6092
@dawjid6092 5 жыл бұрын
Thanks for your video its really help, please i want to divide a huge data-set base on date snapshot for time-series neural network
@dataschool
@dataschool 5 жыл бұрын
I won't be able to help... good luck!
@vipinmadathil
@vipinmadathil 4 жыл бұрын
Can you post a video on creating dataframe from dictionaries nested at multiple levels
@TadeuszKurpiel
@TadeuszKurpiel 10 ай бұрын
time 11:10 - resetting the index IS POSSIBLE even when the index does not have the name - in that case the column created from index will be named 'level_0' - at least it works that way in pandas ver.2.0.3
@dataschool
@dataschool 10 ай бұрын
Got it, thanks for letting me know!
@s2kcolin780
@s2kcolin780 5 жыл бұрын
thank you
@dataschool
@dataschool 5 жыл бұрын
You're welcome!
@sivakavin2872
@sivakavin2872 3 жыл бұрын
Addicted to your way of teaching brother #kevin
@dataschool
@dataschool 3 жыл бұрын
Thank you! 🙏
@LiveCustoms
@LiveCustoms 4 жыл бұрын
How do you get values in the data frame when the index values are always changing? I.e every time I update my csv file the dates will be updated?
@danielebaldoni2181
@danielebaldoni2181 2 жыл бұрын
Thank you for the great work. How coukd do if i have an array (suppose the score of a pca with 3 components) and i would select just the index of the elememts who respect a certain condition?
@karimmanseri8619
@karimmanseri8619 3 жыл бұрын
Hi, Thanks for your videos, Could you make a video how to sort values from two different data frames, then store them in new data frames. For example data frame 1 has 2 columns name of product and column 2 the country where is made data frame 2 has two columns which are as well product and country, but in this second data frame we will include similar few similar products and country as first data frame. could you write a script to iterate through dataframe 1 and 2 then find the identical product , then append it to data frame 3 along with country column. Thank you
@haisonduong4726
@haisonduong4726 7 жыл бұрын
@,@ The Jupyter Notebook lesson is excellent. They're free and better than my not-free books. @,@
@dataschool
@dataschool 7 жыл бұрын
Thanks so much for your kind comment!
@nagarjunanaidupayyavula4256
@nagarjunanaidupayyavula4256 6 жыл бұрын
Great stuff Dude...where can I get your's full vedios on python programming?
@dataschool
@dataschool 6 жыл бұрын
I don't have a video series on basic Python programming - is that what you are looking for?
@Andorich77
@Andorich77 4 жыл бұрын
Let’s say you have column headers that contain dates and the actual data frame rows contains values specific to each date and you wish to plot each value for each date. Ultimately creating a line graph from all the values. X axis being the dates and y axis being the values. How would approach this. I’ve looked at variety of your videos but can’t seem to find a definite way of doing this.
@dataschool
@dataschool 4 жыл бұрын
Sorry, it's hard for me to understand precisely what you are trying to do... good luck!
@sanmaymishra204
@sanmaymishra204 5 жыл бұрын
can you share an example of importing nested json (as complicated as you can think of) into a pandas dataframe
@dataschool
@dataschool 5 жыл бұрын
I don't have an example handy, sorry!
@vikaskulshreshtha
@vikaskulshreshtha 4 жыл бұрын
Can you please tell me how to convert strings into numbers. Word to number system.
@chengqian4350
@chengqian4350 5 жыл бұрын
good vedio! just one suggestion. either remove the subtitle or make the code above the subtitle.
@dataschool
@dataschool 5 жыл бұрын
Thanks for your suggestion!
@christopherlyons7613
@christopherlyons7613 4 жыл бұрын
Thanks for the vids. What if I want to use a column as an index (like country) but I also want it to be a column in the dataset so the values can be accessed using standard access techniques (i.e. df[column], df.column, getting subsets of the data with [:], data use with .loc & .iloc, etc.). Is there a way to tell pandas to use a column as an index AND leave it as a column? Or would you have to copy the column to a new name to keep the data acessible?
@dataschool
@dataschool 4 жыл бұрын
Great question! A column of data is either a column (in the DataFrame) or its the index, but not both. Definitely don't make a copy and include it twice. It sounds to me like you should leave it in the DataFrame as a column... is there a particular reason that you need it to be the index?
@diegrootam
@diegrootam 6 жыл бұрын
Hello from Brazil 8:56 :D
@dataschool
@dataschool 6 жыл бұрын
Hello to you as well!
@amitunemelody5612
@amitunemelody5612 4 жыл бұрын
sir how can i use the default index values(i.e.0,1,2,3,4......) as one my column values. For example: I have columns such as ID, Name,Faculty. And here i want, ID column to be filled with the values of default index values(i.e 0,1,2,3,4.....).Hope for the postive response.
@kadiryasar2225
@kadiryasar2225 7 жыл бұрын
Hi, thank you so much for this very informative video series. My question is: suppose that we re-index the dataframe but the new index column contains same values for some rows. I tried and pandas allowed to do it, but it does not make sense for me. If smthng is index for my data, it shall be unique. Thanks.
@dataschool
@dataschool 7 жыл бұрын
It is true that pandas does not require that the index is unique. I realize that might not make sense if you are using to using the index as a unique identifier. But in pandas, the index is just supposed to be an identifier, and the user can decide if they want it to be unique. In other words, pandas is providing the user with flexibility. Hope that explanation helps!
@_proton5
@_proton5 3 жыл бұрын
Silly question: How do I get the neat separation black lines in my table of the df? I only get one line below the column headers.
@dataschool
@dataschool 2 жыл бұрын
Depends on the version of Jupyter Notebook
@saradag6939
@saradag6939 4 жыл бұрын
Hlo... Sr. How to convert rows into colomns nd colomns into rows in dataset
@fizzakhan9497
@fizzakhan9497 3 жыл бұрын
Sir kindly tell me [corrmat=dataset.corr() top_corr_features=corrmat.index] What does .index function works and how this code working
@adritaanwar2279
@adritaanwar2279 3 жыл бұрын
If I have a 3000×563 raw dataset without any column names and a list of 563 features. How can I name my columns using dataframe?
@DavitBarbakadze
@DavitBarbakadze 7 жыл бұрын
Are you on Patreon? I'd personally pledge for such detailed explanations :)
@dataschool
@dataschool 7 жыл бұрын
Thanks so much for offering! No, I'm not currently on Patreon, though I will consider it for the future! However, I'd love it if you would join my email newsletter: www.dataschool.io/subscribe/
@dataschool
@dataschool 6 жыл бұрын
Hi Davit, I finally launched a Patreon campaign! I would love your support! www.patreon.com/dataschool/overview
@Druzian
@Druzian 3 жыл бұрын
How you can found the index number of a row?
@bsemailaccount615
@bsemailaccount615 6 жыл бұрын
HI, I have a question please: what is the difference between using delimiter and sep? Are they interchangeable? Thank you.
@dataschool
@dataschool 6 жыл бұрын
They are equivalent.
@imapublicagent
@imapublicagent 6 жыл бұрын
Great video, but I don't think you fully answered the question. The user specifically asked about multi-indexing. Is there any advantage to including "continent" as an additional index? More than one index seems to add confusion.
@dataschool
@dataschool 6 жыл бұрын
You're right, I chose not to cover MultiIndexes in order to limit the scope of the video. The short answer is that how you choose what to use as an index depends on how you expect to use the DataFrame. Most of the time, one index is best.
@dataschool
@dataschool 5 жыл бұрын
You might be interested in my new video about the pandas MultiIndex: kzbin.info/www/bejne/qpS1eJRoqNSWY8U
@brendafosmire6519
@brendafosmire6519 4 жыл бұрын
What happens when the column you set as the index has >1 instance of that value? Like what if there was more than one row for Country?
@dataschool
@dataschool 4 жыл бұрын
The pandas index does not have to be unique. Does that help?
@pratimtalukdar618
@pratimtalukdar618 5 жыл бұрын
why do the drinks.columns return the column names appended with the character 'u'?
@dataschool
@dataschool 5 жыл бұрын
That indicates a Unicode string in Python 2.
@anugantisuresh5935
@anugantisuresh5935 4 жыл бұрын
Am getting output like below: drinks.index RangeIndex(start=0, stop=193, step=1) how to get like your output?
@hassanalkotob390
@hassanalkotob390 5 жыл бұрын
Thanks a lot for this helpful series of videos if i want to query from drinks_df the top 5 countries with maximum wine_servings for each continent any helpful tips make me thankful
@dataschool
@dataschool 5 жыл бұрын
I can't think of how to do this off-hand, sorry!
@hardikvegad3508
@hardikvegad3508 3 жыл бұрын
Sir if we have hundreds of columns without the name. Then how can we name them using pandas and a for loop or lambda function because if we try to name them using names=[] it will be a very time-consuming process. The name of the columns can be col1, col2 , col3...etc.
@Theasifaliamiri
@Theasifaliamiri 5 жыл бұрын
How do I compare a mean value for two values in a column, for example, check if the mean value of 'beer servings' for Europe and Asia are same or not?
@dataschool
@dataschool 5 жыл бұрын
I'm not sure I understand your question - Are you asking how to write an equality statement?
@Theasifaliamiri
@Theasifaliamiri 5 жыл бұрын
Data School sir thank you for replying. Now I got the answer from one of your other videos. Love from Pakistan.
@dataschool
@dataschool 5 жыл бұрын
Great to hear!
@anugantisuresh5935
@anugantisuresh5935 4 жыл бұрын
Have a question, drinks.head( ) getting nice table format but am not getting. How to get with table?
@patelhastik7887
@patelhastik7887 5 жыл бұрын
hello, how can I fetch column name and column index form excel table using panda package??
@dataschool
@dataschool 5 жыл бұрын
This should help: pandas.pydata.org/pandas-docs/stable/generated/pandas.read_excel.html
@ghanemimehdi1063
@ghanemimehdi1063 8 жыл бұрын
Hello, i would like to know how to convert a string value in dataframe in float or int (labelisation) in order to visualize my data and can do classification Thanks in advance !
@dataschool
@dataschool 8 жыл бұрын
If you're asking about how to convert data types in pandas, I recommend this video: kzbin.info/www/bejne/jGGkiKywi7KZa5Y If you're asking how to convert non-numeric data into numeric data for use with a machine learning model, I recommend part 5 of this notebook: github.com/justmarkham/DAT8/blob/master/notebooks/10_linear_regression.ipynb Hope that helps!
@ghanemimehdi1063
@ghanemimehdi1063 8 жыл бұрын
Thank you very much !! :-) it helps me a lot
@sayakpaul3152
@sayakpaul3152 7 жыл бұрын
Could you explain ix operator?
@dataschool
@dataschool 7 жыл бұрын
I discuss it in this video: kzbin.info/www/bejne/rqfTf3Rtl6hrmdU Hope that helps!
@sayakpaul3152
@sayakpaul3152 7 жыл бұрын
Extremely sorry I commented without watching. Thanks.
@dataschool
@dataschool 6 жыл бұрын
Since you asked previously about ix, I just wanted to let you know that it has been deprecated... which I discuss in my newest video: kzbin.info/www/bejne/qpaYe6WJeLxggrs Enjoy!
@FabioRBelotto
@FabioRBelotto Жыл бұрын
Can I have a non unique values for index? What would happen?
@dataschool
@dataschool Жыл бұрын
Great question! That's usually not what you want to do, but a non-unique index is currently allowed.
@zapy422
@zapy422 5 жыл бұрын
What about multi-indexing?
@dataschool
@dataschool 5 жыл бұрын
I'll have a video about that coming out soon... make sure you are subscribed :)
@vman049
@vman049 Жыл бұрын
🔥
@dataschool
@dataschool Жыл бұрын
Thanks!
@nandinivetal8569
@nandinivetal8569 5 жыл бұрын
Need help for adding new row in dataframe with next character index. I want to add row in dataframe which have character index like a,b,c .Now I want to add next row in dataframe with index 'd'.I want append new row with append() having index 'd'.
@dataschool
@dataschool 5 жыл бұрын
I'm not sure the best way to do this, sorry!
@nandinivetal8569
@nandinivetal8569 5 жыл бұрын
@@dataschool i got the answer..Thanks for reply
@peterabdou6169
@peterabdou6169 7 жыл бұрын
is it a must to make sure that pandas index has unique values?
@dataschool
@dataschool 7 жыл бұрын
Actually, the pandas index doesn't have to use unique values.
@kostasnikoloutsos5172
@kostasnikoloutsos5172 6 жыл бұрын
Can we change the location of a column?
@dataschool
@dataschool 6 жыл бұрын
Sure, there are many ways: stackoverflow.com/questions/13148429/how-to-change-the-order-of-dataframe-columns
What do I need to know about the pandas index? (Part 2)
10:38
Data School
Рет қаралды 67 М.
How do I select multiple rows and columns from a pandas DataFrame?
21:47
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 61 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Heartwarming: Stranger Saves Puppy from Hot Car #shorts
00:22
Fabiosa Best Lifehacks
Рет қаралды 13 МЛН
How do I handle missing values in pandas?
14:28
Data School
Рет қаралды 196 М.
How do I use the MultiIndex in pandas?
25:01
Data School
Рет қаралды 172 М.
Boolean indexing in Pandas made simple
8:23
Python and Pandas with Reuven Lerner
Рет қаралды 1,7 М.
How do I make my pandas DataFrame smaller and faster?
19:06
Data School
Рет қаралды 66 М.
Database Indexing for Dumb Developers
15:59
Laith Academy
Рет қаралды 44 М.
How do I work with dates and times in pandas?
10:21
Data School
Рет қаралды 184 М.
Indexing and Selecting - Pandas
16:03
Data Talks
Рет қаралды 8 М.