I am trying to run a Jupyter Notebook within another, in Databricks.
The code below fails, the error is 'df3 is not defined'. But, df3 is defined.
input_file = pd.read_csv("/dbfs/mnt/container_name/input_files/xxxxxx.csv")
df3 = input_file
%run ./NotebookB
The first line of code in NotebookB is below (all Markdowns are shown in Databricks with no issues):
df3.iloc[:,1:] = df3.iloc[:,1:].clip(lower=0)
I do not get such an error in my Jupyter Notebook, e.g. the code below works:
input_file = pd.read_csv("xxxxxx.csv")
df3 = input_file
%run "NotebookB.ipynb"
Basically, it seems as if when running NotebookB in Databricks, the definition of df3 is not used or forgotten, leading to the 'not defined' error.
Both Jupyter Notebooks belong in the same Workspace folder in Databricks.