AWS Glue - Unpivot columns into rows using python shell job

Today we will learn on how to unpivot columns into rows using AWS Glue python shell job
Pre-requisites:
Steps:
  • Upload the above downloaded libraries in a S3 bucket
  • Create a new AWS Glue job
    • Type: python shell
    • Version: 3
    • In the Security configuration, script libraries, and job parameters (optional) > specify the python library path to the above libraries followed by comma ","
      • E.g.: s3://library_1.whl, s3://library_2.whl
  • import the pandas and s3fs libraries 
  • Create a dataframe to hold the dataset
  • Call the dataframe.melt() function to unpivot columns into rows
  • Save and run the job
  • You are done.

Comments

Post a Comment