Welcome to Microsoft Q&A platform and thanks for posting your query here.
To create a Databricks notebook from your Python file, start with this line:
# Databricks notebook source
For any header or markdown text in your notebook, add this right after the first line:
# MAGIC %md
To separate your cells, use the following line, making sure to include empty lines before and after:
# COMMAND ----------
That's all you need! Any Python code can just be added without any special commands because it’s already recognized as Python due to the .py file extension. So, your code should look like this:
# Databricks notebook source
# MAGIC %md # MAGIC
# Title
# COMMAND ----------
print("Any Python code!")
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.