cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I write Pandas dataframe into avro

sobhan
New Contributor II

I am trying to write Pandas core dataframe into avro format as below. But I get the following error:

AttributeError: 'DataFrame' object has no attribute 'write'

I have tried several options as below:

df_2018_pd.write.format("com.databricks.spark.avro").save("s3://folder/sub-folder/avro") df_2018_pd.write.format("avro").save("s3://folder/sub-folder/avro") df_2018_pd.write().format("com.databricks.spark.avro").save("s3://folder/sub-folder/avro") df_2018_pd.format("avro").save("s3://folder/sub-folder/avro")

All of the above gives error.

Any help would be appreciated.

3 REPLIES 3

JosieMundi
New Contributor II

Not sure if you could use something like:

https://github.com/ynqa/pandavro

they have a to_avro which writes pandas to avro

sobhan
New Contributor II

Yes i saw that pandavro pkg and installed with pip3 but still it did not resolve. So I had to convert into JSON dictionary object and proceed from there. I solved the problem not using Pandas dataframe into AVRO. May be some useful Pandas utility for this will come in future

Thanks for your response.

Brayden_Cook
New Contributor II

Very complicated question. I think you can get your answer on online sites. There are many online providers like managements writing solutions whose experts provide online help for every type of research paper. I got a lot of assistance from them. Nowadays it has become very easy to solve any type of questions with the help online websites.

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