@datagrok/eda 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/eda",
3
3
  "friendlyName": "EDA",
4
- "version": "1.1.12",
4
+ "version": "1.1.13",
5
5
  "description": "Exploratory Data Analysis Tools",
6
6
  "dependencies": {
7
7
  "@datagrok-libraries/ml": "^6.4.5",
package/src/eda-ui.ts CHANGED
@@ -117,7 +117,7 @@ export function loadingScatterPlot(features: DG.ColumnList, xLoadings: Array<DG.
117
117
  export function addPLSvisualization(
118
118
  table: DG.DataFrame, samplesNames: DG.Column, features: DG.ColumnList, predict: DG.Column, plsOutput: any,
119
119
  ): void {
120
- const view = grok.shell.getTableView(table.name);
120
+ const view = (table.id !== null) ? grok.shell.getTableView(table.name) : grok.shell.addTableView(table);
121
121
 
122
122
  // 1. Predicted vs Reference scatter plot
123
123
  view.addViewer(predictedVersusReferenceScatterPlot(samplesNames, predict, plsOutput[0]));
package/src/package.ts CHANGED
@@ -67,12 +67,20 @@ export async function dbScan(df: DG.DataFrame, xCol: DG.Column, yCol: DG.Column,
67
67
  //input: int components = 2 {caption: Components} [Number of components.]
68
68
  //input: bool center = false [Indicating whether the variables should be shifted to be zero centered.]
69
69
  //input: bool scale = false [Indicating whether the variables should be scaled to have unit variance.]
70
- //output: dataframe result {action:join(table)}
71
- export async function PCA(table: DG.DataFrame, features: DG.ColumnList, components: number,
72
- center: boolean, scale: boolean): Promise<DG.DataFrame> {
70
+ export async function PCA(table: DG.DataFrame, features: DG.ColumnList, components: number, center: boolean, scale: boolean): Promise<void> {
73
71
  const pcaTable = await computePCA(table, features, components, center, scale);
74
72
  addPrefixToEachColumnName('PCA', pcaTable.columns);
75
- return pcaTable;
73
+
74
+ if (table.id === null) // table is loaded from a local file
75
+ grok.shell.addTableView(pcaTable);
76
+ else {
77
+ const cols = table.columns;
78
+
79
+ for (const col of pcaTable.columns) {
80
+ col.name = cols.getUnusedName(col.name);
81
+ cols.add(col);
82
+ }
83
+ }
76
84
  }
77
85
 
78
86