This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import shutil | |
import deltalake as dl | |
import pandas as pd | |
import pyarrow.dataset as ds | |
from pyspark.sql import SparkSession | |
from delta import * | |
import chispa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
person_name | person_country | |
---|---|---|
a | China | |
b | China | |
c | China | |
d | China | |
e | China | |
f | China | |
g | China | |
h | China | |
i | China |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
website_url | website_type | main_language | |
---|---|---|---|
news.ycombinator.com | aggregator | ||
mungingdata.com | blog | spark | |
m.signalvnoise.com | blog | rails | |
pgexercises.com | train | postgres | |
codequizzes.com | train | ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.coalesce(1).write | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.save("s3n://some_bucket/data/states/all_states/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val accessKeyId = System.getenv("AWS_ACCESS_KEY_ID") | |
val secretAccessKey = System.getenv("AWS_SECRET_ACCESS_KEY") | |
sc.hadoopConfiguration.set("fs.s3n.awsAccessKeyId", accessKeyId) | |
sc.hadoopConfiguration.set("fs.s3n.awsSecretAccessKey", secretAccessKey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val df = sqlContext.read | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.load("s3n://some_bucket/data/states/*.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val df = sqlContext.read | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.load(System.getProperty("user.home") + "/Desktop/people/*.gz") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val df = sqlContext.read | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.load(System.getProperty("user.home") + "/Desktop/people/*.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tx_cities.coalesce(1).write | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.save(System.getProperty("user.home") + "/Desktop/texas_cities") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val df = sqlContext.read | |
.format("com.databricks.spark.csv") | |
.option("header", "true") | |
.option("inferSchema", "true") | |
.load(System.getProperty("user.home") + "/Desktop/cities.csv") |