Last active
July 11, 2022 13:57
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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