From 326ad3c3a333d7d219311f747b4429fd6fc8f34f Mon Sep 17 00:00:00 2001 From: "Julia (Li) Wang" Date: Thu, 2 Sep 2021 15:06:55 -0400 Subject: [PATCH 1/2] Update my_funcs.py --- my_lib/my_funcs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/my_lib/my_funcs.py b/my_lib/my_funcs.py index f1742f4..3e1cdeb 100644 --- a/my_lib/my_funcs.py +++ b/my_lib/my_funcs.py @@ -1,3 +1,4 @@ +# Databricks notebook source def convertFtoC(unitCol, tempCol): from pyspark.sql.functions import when, col return when(col(unitCol) == "F", (col(tempCol) - 32) * (5/9)).otherwise(col(tempCol)).alias("temp_celcius") From 06422605cc87185a62b87fb4b3f74932c90850a1 Mon Sep 17 00:00:00 2001 From: "wangxbl56@gmail.com" Date: Thu, 2 Sep 2021 19:29:36 +0000 Subject: [PATCH 2/2] add count() --- temperatures.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/temperatures.py b/temperatures.py index b5b8778..8b7465f 100644 --- a/temperatures.py +++ b/temperatures.py @@ -52,3 +52,11 @@ # COMMAND ---------- display(df.select(convertFtoC("unit", "temp"))) + +# COMMAND ---------- + +df.count() + +# COMMAND ---------- + +