pandas: Dataframe.replace() with regex
问题 I have a table which looks like this: df_raw = pd.DataFrame(dict(A = pd.Series(['1.00','-1']), B = pd.Series(['1.0','-45.00','-']))) A B 0 1.00 1.0 1 -1 -45.00 2 NaN - I would like to replace '-' to '0.00' using dataframe.replace() but it struggles because of the negative values, '-1', '-45.00'. How can I ignore the negative values and replace only '-' to '0.00' ? my code: df_raw = df_raw.replace(['-','\*'], ['0.00','0.00'], regex=True).astype(np.float64) error code: ValueError: invalid