Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 07:58 AM
Hello Experts,
I am unable to replace nulls with 0 in a dataframe ,please refer to the screen shot
from pyspark.sql.functions import col
emp_csv_df = emp_csv_df.na.fill(0).withColumn("Total_Sal",col('sal')+col('comm'))
display(emp_csv_df)erorr
desired output
any suggestions ?
Regards,
Rakesh
Labels:
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 12:44 PM
I bet that it is not real null but the string "null". Please check what is in the source and try luck with replacing it.
My blog: https://databrickster.medium.com/