5 Most Popular Pandas Functions

Here are some of the most frequently used Pandas commands, grouped by their primary functions:

1. Data Loading and Saving:

  • pd.read_csv(): Reads data from a CSV file into a DataFrame.
  • pd.read_excel(): Reads data from an Excel file into a DataFrame.
  • pd.read_json(): Reads data from a JSON file into a DataFrame.
  • pd.to_csv(): Saves a DataFrame to a CSV file.
  • pd.to_excel(): Saves a DataFrame to an Excel file.
  • pd.to_json(): Saves a DataFrame to a JSON file.

2. Data Inspection and Selection:

  • df.head(): Displays the first few rows of a DataFrame.
  • df.tail(): Displays the last few rows of a DataFrame.
  • df.shape: Returns the dimensions (rows and columns) of a DataFrame.
  • df.info(): Provides summary information about the DataFrame’s columns, including data types and missing values.
  • df.describe(): Calculates descriptive statistics for numerical columns.
  • df.columns: Returns a list of column names.
  • df.loc[]: Selects data by label.
  • df.iloc[]: Selects data by position.

3. Data Cleaning and Handling Missing Values:

  • df.isnull(): Identifies missing values in a DataFrame.
  • df.fillna(): Fills missing values with specified values.
  • df.dropna(): Drops rows or columns with missing values.

4. Data Manipulation and Transformation:

  • df.sort_values(): Sorts a DataFrame by one or more columns.
  • df.groupby(): Groups data by one or more columns and applies aggregate functions.
  • df.apply(): Applies a function to each row or column of a DataFrame.
  • df.merge(): Combines DataFrames based on common columns (like SQL joins).
  • df.concat(): Concatenates DataFrames along rows or columns.

5. Data Aggregation and Summary:

  • df.sum(): Calculates the sum of values in a column.
  • df.mean(): Calculates the mean of values in a column.
  • df.median(): Calculates the median of values in a column.
  • df.count(): Counts the number of non-null values in a column.
  • df.max(): Finds the maximum value in a column.
  • df.min(): Finds the minimum value in a column.

Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Related Posts

neuralink brain chip

Neuralink: Revolutionizing Human-Computer Interaction with Brain-Computer Interfaces

What is Neuralink? Neuralink is a revolutionary technology developed by Elon Musk and his team of neuroscientists and engineers. The primary goal of Neuralink is to create…

vector storage

Advantages of Vector Storage for LLMs and AI

In the rapidly evolving landscape of artificial intelligence (AI) and machine learning (ML), one technology stands out as a game-changer: vector storage. This specialized form of data…

GRIT

Implementing GRIT in the Workplace: A Step-by-Step Guide

This Article is based on the Book GRIT by Angela Duckworth, The Power of Passion and Perseverance, As employees, we’ve all faced challenges and obstacles that can…

behaviour-experiment

Understanding Behavioral Experiments

Behavioral experiments are practical, low-risk interventions designed to test and implement new behaviors within an organization. They are a strategic approach to driving cultural and operational change…

Can AI Help Your Company Innovate

Can AI Help Your Company Innovate?

As a business leader, you’re constantly looking for ways to innovate and stay ahead of the competition. But with the rapid pace of technological change, it can…

how AI can revolutionize olympics

How AI Can Revolutionize the Olympics

The Olympic Games, a premier international multi-sport event, has been a symbol of human achievement and excellence for over a century. As technology continues to advance, the…

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading