Legacy – DataFrame Operations
- 01:39
Learn about the different DataFrame Operations Available in Python.
Downloads
No associated resources to download.
Transcript
On the screen, we can see some data frame operations. So once the data frame is imported into Python using the pandas library, how do you view the data frame. So these operations are not restricted. It's just some examples. More examples can be found in the pandas documentation available on the Python website. So once the data frame is important, let's say that we imported the DataFrame as DF in order to view the data, but not the whole data set just the first few rows, and the first few columns views that head function. So we say df . head, if assuming that the data frame is imported as TF, in order to get some info about the data, we say DF . info, if we want to have a copy of the data frame, just to perform some further data analysis and data cleaning, but we don't want to affect the initial copy, we say data frame . append, so we save this as a new data frame. So let's say we are saving DF . append as DF one. Now in case the data frame has multiple duplicate values, and we don't want to have these duplicate values, we just use the function drop duplicates to get a data frame without any duplicate values and just all unique values. If we want to have the column names of the data frame, simply we just ask Python to return data frame dot columns. So if the data frame is saved as DF, we print DF . columns. And if we want to rename the columns, we simply use DF . rename. And in the brackets we include the renaming in quotations, either single or double