Using Azure Blob Storage and Parquet
My attempt to interact with Parquet files on Azure Blob Storage. Reading and writing Pandas dataframes is straightforward, but only the reading part is working with Spark 2.4.0.
My attempt to interact with Parquet files on Azure Blob Storage. Reading and writing Pandas dataframes is straightforward, but only the reading part is working with Spark 2.4.0.
This notebook contains a small example that interpolates the values for a sparse dataframe and calculates the difference with a smaller dataframe.
A short example on how to interact with S3 from Pyspark.
In this short tutorial I show how I developed my first Glue scripts for the AWS platform.
This tutorial explains how to write a lambda functions in Python, test it locally, deploy it to AWS and test it in the cloud using Amazon's SAM. The README.md inside the cookiecutter template folder is used as the base of this tutorial.
This article was originally posted on the MarketInvoice blog.
Write a pandas dataframe to a single CSV file on S3.
import boto3
from io import StringIO
DESTINATION = 'my-bucket'
def _write_dataframe_to_csv_on_s3(dataframe, filename):
""" Write a dataframe to a CSV on S3 """
print("Writing {} records to {}".format(len(dataframe), filename))
# Create buffer
csv_buffer = StringIO()
# Write dataframe to buffer
dataframe.to_csv(csv_buffer, sep="|", index=False)
# Create S3 object
s3_resource = boto3.resource("s3")
# Write buffer to S3 object
s3_resource.Object(DESTINATION, filename).put(Body=csv_buffer.getvalue())
_write_dataframe_to_csv_on_s3(my_df, 'my-folder')
Write a pandas dataframe to a single Parquet file on S3.
# Note: make sure `s3fs` is installed in order to make Pandas use S3.
# Credentials for AWS in the normal location ~/.aws/credentials
DESTINATION = 'my-bucket'
def _write_dataframe_to_parquet_on_s3(dataframe, filename):
""" Write a dataframe to a Parquet on S3 """
print("Writing {} records to {}".format(len(dataframe), filename))
output_file = f"s3://{DESTINATION}/{filename}/data.parquet"
dataframe.to_parquet(output_file)
_write_dataframe_to_parquet_on_s3(my_df, 'my-folder')
A simple example on interaction with Parquet files on AWS S3.
After numerous restarts and resets of my VPS and executing over 20 different tutorials, I finally have my receipe to get my single node Kubernetes cluster with a proper load balancer working. Please note that the last version of my Kubernetes experiment can be found on my Git repo. Remember that this repository mainly contains a variety of YAML files that got the system working. What worked for me, might not work for anyone else.