I have a query regarding replacing values in DataFrame. I have a dataset which consists of negative, positive, and zero values. I want to replace all the negatives with '*', zeros with '_' and positives with '**'.
Data is something like this:
C1 C2 C3 C4
R1 1.2 0.0 -0.2 3
R2 -0.5 3.4 0.0 4
R3 0.5 -4 -2.8 0.0
Result should come like:
C1 C2 C3 C4
R1 ** _ * **
R2 * ** _ **
R3 ** * * _
I tried a few options, given here Replace negative values by zero Unfortunately, once I replace a numeric DataFrame, then I cannot put any logical operation on it. So I Could just replace one of the values.
If anyone has an idea how to sort, please suggest. Thank you so much in advance.