Error in Databricks code?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 01:26 AM
https://www.databricks.com/notebooks/recitibikenycdraft/data-preparation.html
Could someone help to see in that Step 3: Prepare Calendar Info
# derive complete list of dates between first and last dates
dates = (
spark
.range(0,days_between).withColumnRenamed('id','days')
.withColumn('init_date', lit(first_date))
.selectExpr('cast(date_add(init_date, days) as timestamp) as date')
)
what does 'days' refer to in the last selectExpr sentence? it seems to be me not defined. is it meant to be 'days_between'? If i replace 'days' with 'days_between', it also breaks, because it expects a integer value, and not a variable.
Thanks.