I have the dataset, where I want to replace values in one of the columns from numeric to character values. For example I want this dataframe:
to become this:
My flow is as follows:
In my Python script node, I have the following code:
The node runs with a green status, however, when I open the table, the values are not changed, they are still numeric.
What am I doing wrong?
Is there a node that I can use as an alternative to this?
When I run the script it works. I’m not sure what’s happening on your end:
What happens if you run the script line by line and examine the output? For example, this is what I see when I run the first 2 lines:
If you’re looking for alternatives, there are a few options I can think of. If you only have a handful of replacements to make, I’d use either a series of String Replacer nodes (one for each string), or some if…then expressions in the Column Expressions node.
If you have a lot of replacements to make, I would use a String Replacer (Dictionary) node.
sure you can use Python for this but seems like a proper job for Cell Replacer node
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.