Why does my Notebook fails if I try to load a function from another Notebook in Repos in Databricks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2022 01:26 AM
My function in func.py
def lower_events(df):
return df.withColumn("event",f.lower(f.col("event")))
My main notebook
import pyspark.sql.functions as f
from pyspark.sql.functions import udf, col, lower
import sys
sys.path.append("..")
from folder.func. import lower_events
#from folder import func
df_clean = lower_events(df)
I am getting this error
NameError: name 'f' is not defined
Labels:
- Labels:
-
Main Notebook
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2022 05:25 AM
@Shubham Biswas, so func.py is a plain Python file, not a Databricks notebook?
Can you also check the following topic?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 10:23 PM
@Kaniz Fatma https://community.databricks.com/s/question/0D58Y00008ouo6xSAA/how-to-fetch-environmental-variables-...
Can you please look into this

