https://dagster.io/ logo
#ask-community
Title
# ask-community
d

Dmitry Mogilevsky

07/03/2022, 8:25 PM
I frequently find myself using the following pattern when collecting outputs of a dynamic fan
Copy code
@op
def join_data_and_add_calculated_columns(dataframes:List[CustomDataFrameType1])->CustomDataFrameType2:
    if not dataframes:
        return pd.DataFrame()
    full_df = pd.concat(dataframes)
Before I started using custom types created by
create_dagster_pandas_dataframe_type
this was no problem. Now its an issues because
return pd.DataFrame()
does not pass validation. What's the recommended behaviour when you don't have inputs and want to return an empty dataframe?
i

Ismael Rodrigues

07/03/2022, 11:31 PM
The type Dagster.Type.Nothing can help, I think
p

prha

07/05/2022, 9:13 PM
Do you rely on the fact that it is an empty dataframe in your downstream ops? I wonder if you might be able to conditionally return
None
by making the datatype Optional