Skip to content

Resources to help with using pandas or numpy with aws lambda - follow the YouTube video linked

Notifications You must be signed in to change notification settings

brandonserna/aws-pandas-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Pandas and AWS Lambda

Appending your lambda_function.py to the deployment zip bundle

zip -g ./function.zip lambda_function.py

Sample

import pandas as pd
import json


def lambda_handler(event, context):
    df = pd.read_json("https://swapi.dev/api/planets")
    planets = pd.DataFrame(df["results"].to_list())

    # cleaning
    planets = planets.set_index("name")
    planets["population"] = pd.to_numeric(planets["population"], errors="coerce")

    # max pop
    print(planets[planets.population == planets.population.max()]["population"])

    return {"statusCode": 200, "body": "job completed"}

Resources

Star Wars API: https://swapi.dev

About

Resources to help with using pandas or numpy with aws lambda - follow the YouTube video linked

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages