- Use
df.head()
to display the first few rows of a DataFrame. - Use
df.tail()
to display the last few rows of a DataFrame. - Use
df.info()
to display the column data types and non-null values in a DataFrame. - Use
df.describe()
to generate summary statistics for each column in a DataFrame. - Use
df.columns
to view the column labels of a DataFrame. - Use
df.index
to view the index labels of a DataFrame. - Use
df.rename()
to rename columns or index labels in a DataFrame. - Use
df.sort_values()
to sort a DataFrame by one or more columns. - Use
df.drop()
to drop columns or rows from a DataFrame. - Use
df.loc[]
to select rows or columns by label. - Use
df.iloc[]
to select rows or columns by position. - Use
df.isnull()
ordf.notnull()
to check for missing or non-missing values in a DataFrame. - Use
df.fillna()
to fill missing values in a DataFrame with a specified value. - Use
df.dropna()
to drop rows or columns with missing values in a DataFrame. - Use
df.pivot_table()
to create a pivot table from a DataFrame. - Use
df.groupby()
to group a DataFrame by one or more columns and perform an aggregation. - Use
df.merge()
to combine two or more DataFrames based on common columns or index labels. - Use
df.join()
to merge two or more DataFrames based on their index labels. - Use
df.apply()
to apply a function to each row or column of a DataFrame. - Use
df.to_csv()
to write a DataFrame to a CSV file.
Note: This article is actually written by chatGPT (https://chat.openai.com/chat)🤩
Top comments (0)