< All Topics

Pandas manipulation methods

Comprehensive list of the Pandas manipulation methods:

  1. Data selection:
    • loc: Select rows and columns by labels.
    • iloc: Select rows and columns by integer indices.
    • at: Fast access to scalar values by label.
    • iat: Fast access to scalar values by integer position.
    • xs: Select cross-section by label or integer index.
    • get: Access a value from a DataFrame or Series object by key.
  2. Filtering:
    • query: Select rows based on a query expression.
    • where: Replace values where the condition is False.
    • mask: Replace values where the condition is True.
    • isin: Determine whether each element is in a list of values.
    • between: Determine whether each element is between two values.
    • duplicated: Determine which rows are duplicates.
    • drop_duplicates: Remove duplicate rows.
  3. Grouping and Aggregation:
    • groupby: Group rows by one or more columns.
    • agg: Aggregate data by applying one or more functions to each group.
    • apply: Apply a function to each row or column.
    • transform: Apply a function to each group and return a new DataFrame.
    • pivot_table: Create a spreadsheet-style pivot table.
  4. Joining and Merging:
    • merge: Join two DataFrames on one or more columns.
    • concat: Concatenate two or more DataFrames along a particular axis.
    • join: Join two DataFrames on their index.
    • append: Append rows to a DataFrame.
    • merge_ordered: Merge two ordered DataFrames.
    • merge_asof: Merge two DataFrames on nearest dates.
  5. Reshaping:
    • stack: Convert a DataFrame from wide to long format.
    • unstack: Convert a DataFrame from long to wide format.
    • melt: Unpivot a DataFrame from wide to long format.
    • pivot: Pivot a DataFrame from long to wide format.
    • pivot_table: Create a spreadsheet-style pivot table.
  6. Cleaning:
    • fillna: Replace missing values.
    • replace: Replace values with other values.
    • dropna: Remove missing values.
    • ffill: Fill missing values forward.
    • bfill: Fill missing values backward.

These are some of the most commonly used Pandas manipulation methods. There are many more methods available in Pandas, depending on the specific data manipulation task you need to perform.

Table of Contents