Workflow Error: How to Resolve Pipedream Internal Error?

This topic was automatically generated from Slack. You can find the original thread here.

My workflow throws an none speaking error:
Pipedream Internal Error
Please retry your event or reach out to Pipedream support at https://pipedream.com/support/

Hi , can you please share more details on your workflow?
What are the steps it in?

Step 1: New Row Added (Instant) from Google Sheets
Step 2: Get Values from same Google Sheet
Step 3: run python code (which worked for a while and then threw this error)

Btw hi Andrew

Thanks for the info! So the inputs to the python code are the values from the Google Sheet row?

Can you share your python code here? Feel free to remove any sensitive information

This is correct

import pandas as pnd

from prophet import Prophet

import json

def handler(pd: “pipedream”):
#get data from previous step. Google Sheet content
df = pnd.DataFrame(pd.steps[“get_values”][“$return_value”], columns=pd.steps[“get_values”][“$return_value”][0])
print(pd.steps[“get_values”][“$return_value”])
print(df.head())
print(df.info())
print(df.columns)
df.drop(df.tail(2).index,inplace=True)
df.drop(df.head(1).index,inplace=True)
df[‘Datum: Tag.Monat.Jahr’] = pnd.to_datetime(df[‘Datum: Tag.Monat.Jahr’], format=‘%d.%m.%Y’, errors=‘coerce’)
df = df.drop(“Gesamt”, axis=‘columns’)
df = df.drop(“Ø”, axis=‘columns’)
df[‘Anzahl’] = df[‘Anzahl’].str.replace(‘,’, ‘.’).astype(float)
df = df.rename(columns={“Datum: Tag.Monat.Jahr”: “ds”, “Anzahl”: “y”}, errors=“raise”)

m = Prophet(yearly_seasonality=**True**)
m.add_country_holidays(country_name='DE')
m.fit(df)
future = m.make_future_dataframe(periods=7)
forecast = m.predict(future)

forecast['day_of_week'] = forecast['ds'].dt.day_name()

forecast['fact'] = df['y'].reset_index(drop = **True**)

forecast['anomaly'] = 0
forecast.loc[(forecast['fact'] > forecast['yhat_upper']) & (forecast['fact'] < 100), 'anomaly'] = 1
forecast.loc[forecast['fact'] < forecast['yhat_lower'], 'anomaly'] = -1

_#anomaly importances_
forecast['importance'] = 0
forecast.loc[forecast['anomaly'] ==1, 'importance'] = (forecast['fact'] - forecast['yhat_upper'])/forecast['fact']
forecast.loc[forecast['anomaly'] ==-1, 'importance'] = (forecast['yhat_lower'] - forecast['fact'])/forecast['fact']

**return** {"forecast": [forecast.to](http://forecast.to)_numpy().tolist()}

Hi Manuel, if you’re using Python to only export step data, we recommend using this structure instead:

The def handler method is less stable

ok thanks for the Feedback I will try this!

It did work! Many thanks