I have a lambda function in Python 3.6 which I compressed into a zip file to upload to S3 (total function folder size is 180MB ,that's why). Inside the zip I have 1 csv file ('example.csv') which I want to read in the lambda handler function.
How to read this file? I tried:
filename = 'example.csv'
filepath = os.environ['LAMBDA_TASK_ROOT'] + '/' + filename
df = pd.read_csv(filepath, dtype=str)
# Failed with OSError: Initializing from file failed
Example of the content of my lambda function folder:
root:
-- lambda_function.py
-- example.csv
-- bunch of library folders
Content of my csv file:
id | value | something | else
-----------------------------------
0 | lol | ok | bye
1 | omg | foo | bar
2 | thx | baz | qux
What is the path to my csv file?