1. 首页
  2. 文档
  3. Merge 2D tables

白皮书下载

实在智能Agent产品白皮书(7.2.0).pdf

Merge 2D tables

发刊日期:
2021/10/15

编辑团队:
实在学院

 

Function description

  You can refer to pandas for merging two-dimensional tables. This component only exposes the fields of the merge interface. The following is a brief introduction to merge.

instructions

  Pandas's merge method connects two dataframes based on common columns. Main parameters of merge method:

  •  Left / right: dataframe in the left / right position.
  •  How: how to merge data. Left: Data Consolidation Based on the left dataframe column; Right: Data Consolidation Based on the right dataframe column
  •  Outer: column based data outer merge (Union set); Inner: column based intra data consolidation (taking intersection); The default is & rsquo; inner’。
  •  On: the column name used for merging. This parameter needs to ensure that two dataframes have the same column name.
  •  left_ on/right_ On: the column name of the left / right dataframe merge. It can also be index, array and list.
  •  left_ index/right_ Index: whether to use index as the column name of data consolidation. True indicates yes.
  •  Sort: sort according to the keys merged by dataframe. The default is.
  •  Suffixes: if there is the same column and the column is not used as a consolidated column, you can set the suffix of the column through suffixes, generally tuple and list types; If the column has duplicate names, the suffix will be added automatically. The default is(“x","y")。
  •  Copy: the default value is true. Data is always copied to the data structure; In most cases, setting to false can improve performance
  •  Indicator: an indicator is added in 0.17.0 to display the source of consolidated data; If you only come to the left_only and both
  •  Validate: string. The default value is none. If specified, check whether the merge is of the specified type.
  •  “ one_ to_ one” Or & ldquo; 1:1”: Check whether the merge key is unique in the left and right data sets.
  •  “ one_ to_ many” Or & ldquo; 1:m”: Check whether the merge key is unique in the left dataset.
  •  “ many_ to_ one” Or & ldquo; m:1”: Check that the merge key is unique in the correct dataset.
  •  “ many_ to_ many” Or & ldquo; m:m”: Allowed, but not checked.

  Merges selects the connection mode of two dataframes by setting the how parameter, including internal connection, external connection, left connection and right connection.

  •  Inner how = & lsquo; inner’, The link mode of dataframe is internal connection. We can understand that the connection is based on the intersection of common columns. The parameter on sets the common column name of the connection; The data in the left and right tables will appear in the results.
  •  External connection how = & lsquo; outer’, The link mode of dataframe is external connection. We can understand that the connection is based on the union of common columns. The parameter on sets the common column name of the connection; All the data in the left and right tables will appear in the results. If they cannot be matched, it is Nan.
  •  Left connection how = & lsquo; left’, The dataframe link mode is left connection. We can understand that the connection is based on the dataframe column on the left. The parameter on sets the common column name of the connection; The data of the left table will appear in the result. If the right table cannot match, it will be Nan.
  •  Right connection how = & lsquo; right’, The dataframe link mode is left connection. We can understand that the connection is based on the dataframe column on the right. The parameter on sets the common column name of the connection; The data of the table on the right will appear in the result. If the data on the left cannot be matched, it will be Nan.

 

企业培训
技术支持
加入社群
公众号
实在智能Agent学习群
扫码关注微信公众号