sc.version ’2.0.0′ from pyspark import SparkContext, HiveContext context = HiveContext(sc) path = «file:///home/sergey/Py_SparkDataFrame_edx_CS105_CS110_CS120/data/201408_status_data.csv» df = context.read.csv(path, header=True).cache() df.printSchema() root |— station_id: string (nullable = true) |— bikes_available: string (nullable = true) |— docks_available: string (nullable = true) |— time: string (nullable = true) df.count() 18342210 df.show(5) +———-+—————+—————+——————-+ |station_id|bikes_available|docks_available| time| +———-+—————+—————+——————-+ | 2| 12| 15|2014-03-01 00:00:02|…

© 2014 In R we trust.
Top
Follow us: