cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Save dataframe to the same variable

alesventus
Contributor

I would like to know if there is any difference if I save dataframe during tranformation to itself as first code or to new dataframe as second example.

Thanks

log_df = log_df.withColumn("process_timestamp",from_utc_timestamp(lit(current_timestamp()),"Europe/Amsterdam")) 

or 

new_df = log_df.withColumn("process_timestamp",from_utc_timestamp(lit(current_timestamp()),"Europe/Amsterdam")) 

 

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @alesventusWhen saving a DataFrame after transformation, there is no difference between saving it to itself or a new DataFrame. Both approaches will result in the same output.

Sources:
- [Docs: dataframes-python](https://docs.databricks.com/getting-started/dataframes-python.html)

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group