Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing a value with 0 with dataframe.replace throws an error #621

Open
Ren-Logronio opened this issue Dec 16, 2023 · 1 comment
Open

Comments

@Ren-Logronio
Copy link

DataFrame.prototype.replace = function (oldValue, newValue, options) {
var _this = this;
var _a = __assign({ inplace: false }, options), columns = _a.columns, inplace = _a.inplace;
if (!oldValue && typeof oldValue !== 'boolean') {
throw Error("Params Error: Must specify param 'oldValue' to replace");
}
if (!newValue && typeof newValue !== 'boolean') {
throw Error("Params Error: Must specify param 'newValue' to replace with");
} <--- this is true for newValue = 0..

I do not see why this is intentional given that the nature of the error is that I specify a newValue to replace an old value. And thats what I was intending to do, to replace values to 0.

@Reaganak40
Copy link

I encountered the same issue when replacing a value with NaN

this.df.replace('-', NaN)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants