using this command:
pd.to_numeric(
df_rental['by_day'].str.replace('$', ''), errors='coerce')
Some values in the select column are turning nan using the above command with or without `.str.replace('$', '')
How should I change '-' to zero and basically change the displayed columns from object to numeric.
CodePudding user response:
Here're my take:
$is a special regex character indicating end-of-string, you need.str.replace('\$', '').- The
errors='coerce'option will replace-withnan. If you want, you can.fillna(0)after conversion; or you can do.str.replace('\$','').replace('-', '0')before conversion. - Also, please do not include your data as images, include as text.

