title: Can I copy-paste Jupyter Notebook code into a Lambda Handler and keep the same functionality?
body: <p>I am looking to build an AWS architecture where I upload a .csv file with sales data into Amazon S3. I then want a Lambda function to be triggered using my Python code to clean the data and send it to a &quot;clean&quot; S3 bucket upon arrival.</p>
  <p>My current solution involves reading the S3 object in SageMaker and manually running the Jupyter Notebook script, as shown:</p>
  <pre><code># Sales data S3 location
  input_data_location = 's3://BUCKET_NAME/DIRECTORY/salesdata.csv'
  
  # Read the file
  df = pd.read_csv(input_data_location)
  
  # Remove unwanted feature names.
  df = df[['timestamp', 'store_num', 'actual_sales', 'manager_generated_forecast']]
  
  # Change timestamp column to datetime object.
  df['timestamp'] = pd.to_datetime(df['timestamp'].str.split(' - ').str[1]) 
  
  # Feature engineering.
  df['month_of_year'] = pd.DatetimeIndex(df['timestamp']).month
  df['day_of_week'] = pd.DatetimeIndex(df['timestamp']).dayofweek
  df['day_of_year'] = pd.DatetimeIndex(df['timestamp']).dayofyear
  df['week_of_month'] = ((pd.DatetimeIndex(df['timestamp']).day-1)//(7))+1
  df['day_of_month'] = pd.DatetimeIndex(df['timestamp']).day
  df['year_of_sales'] = pd.DatetimeIndex(df['timestamp']).year
  
  # Set timestamp to index.
  df.set_index(&quot;timestamp&quot;, inplace = True)
  </code></pre>
  <p>I am not too familiar with creating Lambda Handlers. Is it possible to simply copy-paste this code into the handler or do I need to make adjustments?</p>
  <p>Thanks</p>