Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2026 02:20 AM
The builtin `display` function is very helpful. but we're moving code from notebooks into python modules.
Here, it seems that `display` is defined differently which results in poor visualization.
Example:
```
df = spark.createDataFrame([{'x': 1}])
display(df)
```
--> nice visual
But when I move the display-code to a module:
def df_show(df😞
display(df)
And using it by
from foo import df_show
df_show(df)
it only shows the __repr__ ouput.
My target picture:
- have a wrapper version for all calls of `display` which:
* refers to builtin-display when running in databricks
* refers to a custom print when running in python environment outside of databricks
Thanks for your support