Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
How can I convert a sempy.fabric.fabricdataframe to spark df?
The following does not work
dataset = (fabric
.evaluate_dax(workspace= server,
dataset=db,
dax_string=query_string)
).to_pandas()
AttributeError: 'FabricDataFrame' object has no attribute 'to_pandas()'
Solved! Go to Solution.
dataset = (fabric
.evaluate_dax(workspace= server,
dataset=db,
dax_string=query_string)
)
spark_df = spark.createDataFrame(dataset)
This works for me.
I think you can treat the Fabric dataframe as a Pandas dataframe, and convert it to a Spark dataframe the same way you would convert a Pandas dataframe to a Spark dataframe.
"
The FabricDataFrame class:
"
dataset = (fabric
.evaluate_dax(workspace= server,
dataset=db,
dax_string=query_string)
)
spark_df = spark.createDataFrame(dataset)
This works for me.
I think you can treat the Fabric dataframe as a Pandas dataframe, and convert it to a Spark dataframe the same way you would convert a Pandas dataframe to a Spark dataframe.
"
The FabricDataFrame class:
"
Liked the 1-liner; took a longer route which I can happily discard
# data_as_dict = dataset.to_dict()
# columns = dataset.columns
# flattened_rows = [Row(**{col: data_as_dict[col][i] for col in columns}) for i in range(len(data_as_dict[columns[0]]))]
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Fabric update to learn about new features.
User | Count |
---|---|
17 | |
5 | |
4 | |
3 | |
2 |