I am currently working with AWS Lambda. Here is an excerpt of the code:
import pandas as pd
import re
import nltk
from stop_words import get_stop_words
stopwords = get_stop_words('en')
nltk.download('punkt')
nltk.download('wordnet')
wn = nltk.WordNetLemmatizer()
def lemmatization(txt):
text = ([wn.lemmatize(word) for word in txt])
return text
def lambda_handler(event,context):
bucket = "aaabbb"
key = "cccddd"
s3_client = boto3.client('s3')
s3_file = s3_client.get_object(Bucket=bucket, Key=key)
s3_file_data = s3_file['Body'].read()
s3_file_data = io.BytesIO(s3_file_data)
df = pd.read_csv(s3_file_data)
df['ABC'] = df['ABC'].apply(lambda x: lemmatization(x))
print(df)
However, I am always getting the error:
Unable to import module 'lambda_function': No module named 'regex._regex'
I have already imported nltk and regex packages. Could you please help me with it?