Skip to content

BUG: sparse empty construction buggy #10079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jreback opened this issue May 7, 2015 · 0 comments · Fixed by #14913
Closed

BUG: sparse empty construction buggy #10079

jreback opened this issue May 7, 2015 · 0 comments · Fixed by #14913
Labels
Bug Sparse Sparse Data Type
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented May 7, 2015

From SO

trains = np.arange(100)
tresholds = [10, 20, 30, 40, 50, 60]
tuples = []
for i in trains:
    for j in tresholds:
        tuples.append((i, j))

index = pd.MultiIndex.from_tuples(tuples, names=['trains', 'tresholds'])
matrix = np.empty((len(index), len(trains)))
matrix.fill(np.nan)
df = pd.DataFrame(matrix, index=index, columns=trains, dtype=float)

Fails

df.to_sparse()

Ok

df.iloc[0] = 0
df.to_sparse()
@jreback jreback added Bug Sparse Sparse Data Type labels May 7, 2015
@jreback jreback added this to the Next Major Release milestone May 7, 2015
@kawochen kawochen mentioned this issue Jul 19, 2015
18 tasks
mroeschke added a commit to mroeschke/pandas that referenced this issue Dec 18, 2016
@jreback jreback modified the milestones: 0.20.0, Next Major Release Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant