Skip to content

Conversation

@ariostas
Copy link
Collaborator

@ariostas ariostas commented Nov 7, 2025

There was a missing import, which caused dataframes not not be writable to TTrees. (Same applied to numpy.recarray.)

@ariostas ariostas requested a review from ianna November 7, 2025 15:58
@ariostas ariostas changed the title fix: add missing imports so that dataframes can be written to ttrees with the old syntax fix: add missing imports so that dataframes can be written to ttrees Nov 7, 2025
@ariostas
Copy link
Collaborator Author

ariostas commented Nov 7, 2025

@ianna do you think it's worth having a hotfix release for this? I'm not sure how this wasn't caught by the CI. We do have tests that write simple dataframes, but somehow the import was made somewhere else so it looked fine.

def test_pandas(tmp_path):
pandas = pytest.importorskip("pandas")
newfile = os.path.join(tmp_path, "newfile.root")
df1 = pandas.DataFrame({"x": [1, 2, 3], "y": [1.1, 2.2, 3.3]})
df2 = pandas.DataFrame({"x": [4, 5, 6], "y": [4.4, 5.5, 6.6]})
with uproot.recreate(newfile, compression=None) as fout:
fout.mktree("tree", df1)
fout["tree"].extend(df2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uproot 5.6.8 fails to write simplest pandas DataFrames as root files

2 participants