0% found this document useful (0 votes)
130 views3 pages

Pandas and NumPy Functions Guide

This document provides an overview of commonly used functions and methods for working with Pandas DataFrames and Numpy arrays. It outlines functions for reading and writing data, accessing and selecting data, cleaning and transforming data, grouping and summarizing data, merging data, and generating basic statistics and plots. Key functions covered include pd.read_csv(), df.head(), df.info(), df.describe(), df.shape, df.columns, df.isna(), df.dropna(), df.fillna(), df.groupby(), df.pivot_table(), df.merge(), df.sort_values(), df['column_name'], df.iloc[] and df.loc[], df.apply(), df['new_column'] = ...,

Uploaded by

rithika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views3 pages

Pandas and NumPy Functions Guide

This document provides an overview of commonly used functions and methods for working with Pandas DataFrames and Numpy arrays. It outlines functions for reading and writing data, accessing and selecting data, cleaning and transforming data, grouping and summarizing data, merging data, and generating basic statistics and plots. Key functions covered include pd.read_csv(), df.head(), df.info(), df.describe(), df.shape, df.columns, df.isna(), df.dropna(), df.fillna(), df.groupby(), df.pivot_table(), df.merge(), df.sort_values(), df['column_name'], df.iloc[] and df.loc[], df.apply(), df['new_column'] = ...,

Uploaded by

rithika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Pandas

1. pd.read_csv(): Used to read data from a CSV file and create a DataFrame.

2. df.head(): Displays the first few rows of the DataFrame, giving you a quick overview of
the data.

3. df.info(): Provides a concise summary of the DataFrame, including the data types of
columns and missing values.

4. df.describe(): Generates summary statistics of the numerical columns in the


DataFrame, such as mean, median, and quartiles.

5. df.shape: Returns the number of rows and columns in the DataFrame.

6. df.columns: Returns a list of column names in the DataFrame.

7. df.isna(): Checks for missing values in the DataFrame and returns a boolean DataFrame
indicating the presence of missing data.

8. df.dropna(): Removes rows or columns containing missing values from the DataFrame.

9. df.fillna(): Fills missing values in the DataFrame with a specified value or method.

10. df.groupby(): Groups the DataFrame by one or more columns and allows you to
perform aggregate operations on the groups.

11. df.pivot_table(): Creates a pivot table from the DataFrame, summarizing data based on
specified rows and columns.

12. df.merge(): Combines two DataFrames based on a common column or index.

13. df.sort_values(): Sorts the DataFrame based on one or more columns.


14. df['column_name']: Accesses a specific column in the DataFrame.

15. df.iloc[] and df.loc[]: Used for indexing and selecting rows and columns by integer
location or label, respectively.

16. df.apply(): Applies a function along either the rows or columns of the DataFrame.

17. df['new_column'] = ...: Creates a new column in the DataFrame or modifies an existing
one.

18. df.drop(): Removes specified rows or columns from the DataFrame.

19. df.rename(): Renames columns in the DataFrame.

20. df.plot(): Generates various types of plots directly from the DataFrame using
Matplotlib integration.

21. df.to_csv(): Writes the DataFrame to a CSV file.

22. df.to_excel(): Writes the DataFrame to an Excel file.


Numpy

1. np.array(): Creates a NumPy array from a Python list or other iterable.

2. np.arange(): Generates an array of evenly spaced values within a specified range.

3. np.zeros() and np.ones(): Creates arrays filled with zeros or ones, respectively, with a
specified shape.

4. np.linspace(): Generates an array of values with evenly spaced intervals over a


specified range.

5. np.reshape(): Reshapes an array to a specified shape, potentially changing the number


of dimensions.

6. np.random.rand() and np.random.randn(): Generates arrays of random values from a


uniform or normal distribution.

7. np.min() and np.max(): Calculates the minimum and maximum values in an array.

8. np.mean() and np.median(): Calculates the mean and median of the values in an array.

You might also like