Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions danfojs-browser/src/core/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@ export class DataFrame extends Ndframe {
col_vals.forEach((col, i) => {
// self[col_names[i]] = new Series(col, { columns: col_names[i], index: self.index })
Object.defineProperty(self, col_names[i], {
configurable: true,
get() {
return new Series(col, { columns: col_names[i], index: self.index });
},
Expand Down
123 changes: 62 additions & 61 deletions danfojs-node/src/core/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,32 +597,32 @@ export class DataFrame extends Ndframe {
for (let j = 1; j < value.length; j++) {
let curr_val = value[j];
switch (ops) {
case "max":
if (curr_val > temp_val) {
temp_val = curr_val;
temp_data.push(curr_val);
} else {
temp_data.push(temp_val);
}
break;
case "min":
if (curr_val < temp_val) {
temp_val = curr_val;
temp_data.push(curr_val);
} else {
temp_data.push(temp_val);
}
break;
case "sum":
temp_val = temp_val + curr_val;
case "max":
if (curr_val > temp_val) {
temp_val = curr_val;
temp_data.push(curr_val);
} else {
temp_data.push(temp_val);

break;
case "prod":
temp_val = temp_val * curr_val;
}
break;
case "min":
if (curr_val < temp_val) {
temp_val = curr_val;
temp_data.push(curr_val);
} else {
temp_data.push(temp_val);
}
break;
case "sum":
temp_val = temp_val + curr_val;
temp_data.push(temp_val);

break;
case "prod":
temp_val = temp_val * curr_val;
temp_data.push(temp_val);

break;
break;
}
}
data.push(temp_data);
Expand Down Expand Up @@ -1657,24 +1657,24 @@ export class DataFrame extends Ndframe {
}

switch (logical_type) {
case "lt":
int_vals = tf.tensor(this.values).less(other).arraySync();
break;
case "gt":
int_vals = tf.tensor(this.values).greater(other).arraySync();
break;
case "le":
int_vals = tf.tensor(this.values).lessEqual(other).arraySync();
break;
case "ge":
int_vals = tf.tensor(this.values).greaterEqual(other).arraySync();
break;
case "ne":
int_vals = tf.tensor(this.values).notEqual(other).arraySync();
break;
case "eq":
int_vals = tf.tensor(this.values).equal(other).arraySync();
break;
case "lt":
int_vals = tf.tensor(this.values).less(other).arraySync();
break;
case "gt":
int_vals = tf.tensor(this.values).greater(other).arraySync();
break;
case "le":
int_vals = tf.tensor(this.values).lessEqual(other).arraySync();
break;
case "ge":
int_vals = tf.tensor(this.values).greaterEqual(other).arraySync();
break;
case "ne":
int_vals = tf.tensor(this.values).notEqual(other).arraySync();
break;
case "eq":
int_vals = tf.tensor(this.values).equal(other).arraySync();
break;
}
let bool_vals = utils.__map_int_to_bool(int_vals, 2);
let df = new DataFrame(bool_vals, {
Expand Down Expand Up @@ -1846,27 +1846,27 @@ export class DataFrame extends Ndframe {
let temp_col = col_values[col_idx];

switch (kwargs["dtype"]) {
case "float32":
temp_col.map((val) => {
new_col_values.push(Number(val));
});
col_values[col_idx] = new_col_values;
break;
case "int32":
temp_col.map((val) => {
new_col_values.push(Number(Number(val).toFixed()));
});
col_values[col_idx] = new_col_values;
case "float32":
temp_col.map((val) => {
new_col_values.push(Number(val));
});
col_values[col_idx] = new_col_values;
break;
case "int32":
temp_col.map((val) => {
new_col_values.push(Number(Number(val).toFixed()));
});
col_values[col_idx] = new_col_values;

break;
case "string":
temp_col.map((val) => {
new_col_values.push(String(val));
});
col_values[col_idx] = new_col_values;
break;
default:
break;
break;
case "string":
temp_col.map((val) => {
new_col_values.push(String(val));
});
col_values[col_idx] = new_col_values;
break;
default:
break;
}

let new_col_obj = {};
Expand Down Expand Up @@ -2074,6 +2074,7 @@ export class DataFrame extends Ndframe {
col_vals.forEach((col, i) => {
// self[col_names[i]] = new Series(col, { columns: col_names[i], index: self.index })
Object.defineProperty(self, col_names[i], {
configurable: true,
get() {
return new Series(col, { columns: col_names[i], index: self.index });
},
Expand Down