Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
xPAGCOE authored Feb 9, 2024
1 parent 601c93f commit 019a20a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions SAC DataFrame/sacdataframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,25 @@ var getScriptPromisify = (src) => {

return df;
}

// Merge
merge(dataframe_1, dataframe_2, on_columns, merging_mode) {

var df1 = null;
var df2 = null;
var df = null;

if((dataframe_1 != null) && (dataframe_2 != null)) {

df1 = this.newDataFrame(dataframe_1.$data, {columns: dataframe_1.$columns});
df2 = this.newDataFrame(dataframe_2.$data, {columns: dataframe_2.$columns});

df = this.dfd.merge({ left: df1, right: df2, on: on_columns, how: merging_mode});

}

return df;
}
}

window.customElements.define('com-sap-sample-sacdataframe', SACDataFrame);
Expand Down
10 changes: 9 additions & 1 deletion SAC DataFrame/sacdataframe.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"vendor": "SAP",
"license": "",
"id": "com.sap.sample.sacdataframe",
"version": "0.0.8",
"version": "0.0.9",
"name": "JavaScript DataFrame for SAC",
"newInstancePrefix": "SACDataFrame",
"description": "A widget that provides DataFrame-like functions",
Expand Down Expand Up @@ -222,6 +222,14 @@
"description": "Concatenate DataFrames along an axis",
"parameters": [ {"name": "dataframes", "type": "Selection[]", "description": "Array of DafaFrames to concatenate"},
{"name": "axis", "type": "integer", "description": "0 for row, 1 for column"} ]
},
"merge": {
"returnType": "Selection",
"description": "Merge DataFrame with a database-style join done on columns or indexes",
"parameters": [ {"name": "dataframe_1", "type": "Selection", "description": "First DataFrame"},
{"name": "dataframe_2", "type": "Selection", "description": "Second DataFrame"},
{"name": "on_columns", "type": "string[]", "description": "Column names to join on. Must be found in both the left and right DataFrame"},
{"name": "merging_mode", "type": "string", "description": "Merging mode as 'left','right','outer', 'inner' with defaults to 'inner'"} ]
}
},
"events": {
Expand Down

0 comments on commit 019a20a

Please sign in to comment.