7. Bind

Concatenate or Merge DataFrames

  1. Click Bind from the Data Analysis category.

  1. Bind type: Select a bind type.

    1. Concat: Concatenates dataframes in the row or column direction.

    2. Merge: Merge two dataframes based on a common column.


Concat

  1. DataFrame: Select the dataframes you want to combine.

  2. Join: Choose a join method.

    1. Outer: When concatenating dataframes, unmatched indices are filled with NaNs.

    2. Inner: Concatenate only data with matching indexes (non-matching data will be removed).

  3. Axis: Select the direction of the connection.

    1. Index: Concatenates data in the row direction (vertical).

    2. Column: Concatenate data in the column direction (horizontal).

  4. Sort: Choose whether you want to sort the indexes. Sorting is done in ascending order by index number, which may change the order of the data.

  5. User Option: You can add options beyond what Visual Python provides.

  6. Allocate to: Specify a variable name to assign to the result.

  7. Reset Index: Reset the index to specify a new default integer index.

  8. Code View: Preview the code that will be output.

  9. Data View: Preview the output that will be printed.

  10. Run: Print and run the code.


Merge

  • Merge two dataframes based on a standard column, creating two new columns for the values from each dataframe.

  1. Left Data, Right Data: Select the two dataframes you want to merge.

  2. How: Choose a merge method.

    1. Inner: Merge based on common values in key columns, only common values will be kept.

    2. Outer: Merge based on all rows in the key column, and values that are not common and do not exist in either dataframe will be filled with NaN.

    3. Left: Merge based on all rows in the key column in the left dataframe.

    4. Right: Merge based on all rows in the key column in the right dataframe.

    5. Cross: Outputs all combinations of data, regardless of the value in the key column.

  3. On: Allows you to merge based on specific columns. The columns selected must exist in both dataframes in common.

  4. Left on, Right on: You can select the columns in both dataframes that you want to base the merge on, respectively.

  5. Suffixes: If you have columns with the same name other than the common key column, add a suffix to differentiate them.

  6. User Option: You can add options beyond what Visual Python provides.

  7. Allocate to: Specify a variable name to assign to the result.

  8. Reset Index: Reset the index to specify a new default integer index.

  9. Code View: Preview the code that will be output.

  10. Data View: Preview the output that will be printed.

  11. Run: Print and run the code.

Last updated