Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyspark.sql import SparkSession
- APP_NAME = "DataFrames"
- SPARK_URL = "local[*]"
- spark = SparkSession.builder.appName(APP_NAME) \
- .config('spark.ui.showConsoleProgress', 'false') \
- .getOrCreate()
- taxi = spark.read.load('/datasets/pickups_terminal_5.csv',
- format='csv', header='true', inferSchema='true')
- taxi = taxi.fillna(0)
- taxi.registerTempTable("taxi")
- print(spark.sql("SELECT CAST(date As DATE),SUM(pickups) FROM taxi GROUP BY CAST(date As DATE) ORDER BY SUM(pickups) DESC").show(5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement