Skip to content

Instantly share code, notes, and snippets.

@jdye64
Last active July 11, 2022 13:57
Show Gist options
  • Save jdye64/d986bb758b5670a90a39adc176239457 to your computer and use it in GitHub Desktop.
Save jdye64/d986bb758b5670a90a39adc176239457 to your computer and use it in GitHub Desktop.
Dask DataFrame assign on empty DataFrame against non-empty DataFrame produces an empty DataFrame
import pandas as pd
import dask.dataframe as dd
# Create an empty dask.dataframe
df = dd.from_pandas(pd.DataFrame(), npartitions=1)
mappings = {'a': 1}
# Assign the new columns and data
df = df.assign(**mappings)
# Columns show up but '1' is not present and DataFrame shows up as empty
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment