Skip to content
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

BUG: Copying an empty DataFrame with index results in a broken BlockManager #5932

Closed
filmor opened this issue Jan 14, 2014 · 2 comments · Fixed by #5935

Comments

@filmor
Copy link
Contributor

commented Jan 14, 2014

The following line illustrates the problem:

df = pd.DataFrame(index=[0]).copy()
df["a"] = 0

This results in an AttributeError since the function BlockManager.make_empty initialises df._data.blocks with a numpy array object instead of an empty list. Thus subsequent calls to blocks.pop and blocks.append fail.

I have a patch coming up.

@filmor

This comment has been minimized.

Copy link
Contributor Author

commented Jan 14, 2014

Maybe not, the patch is at filmor@2c9f7d3, but a test fails (https://travis-ci.org/filmor/pandas/jobs/16920606). What is the rationale behind having a dtype for the BlockManager?

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2014

@filmor thanks for reporting......BlockManager does not have a dtype. BUT SingleBlockManager provides the property to refer to the dtype of its single block (its the implementation for a series)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.