-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
series __finalized__ not correctly called in merge? #6923
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
Comments
I think you are misunderstanding what I wrote on SO. with a patch (#6924), the following will work - it will propogate metadata on the combination ONLY
What i think you may want is to use a multi-level frame where the filename is a level |
Interesting, so when I assign metadata/attributes to each series within a dataframe there's no mechanism to keep it? Metadata is only kept on series when treated independently from a dataframe? If so, I should still be able to keep dataframe-level metadata as a dict of {Series name: attribute value}, which should still be propagated, correct? |
@d10genes yes, you could do that if you wanted to. The entire problem arises from how to combine them. Imagine we supported this:
what is you might look at https://github.com/kjordahl/geopandas they did a full sub-class of DataFrame/Series and DO propogate metadata. |
That makes sense, I'll take a look. Thanks. |
gr8 thanks! |
I got some help from Jeff on stackoverflow, but either I'm misunderstanding the way
__finalized__
works, or there's a bug in how it's called. My intent was to preserve series metadata after 2 dataframes being merged, and I believe__finalize__
should be able to handle this.I define a couple dataframes, and assign metadata values to all the series:
Then I assign metadata field
filename
to seriesNow, I'm defining
__finalize__
for series, which I understand is able to propagate metadata from one series to the other, for example when I want to merge. But when I define a__finalize__
that prints off the metadata that I've already assigned, it looks like by the time it calls__finalize__
, it no longer has the metadata.When I call
merge
, I never see the correct metadata printed offIt appears the metadata is lost before it gets to the
__finalize__
call, though it's still in the original seriesIs this expected or is there a bug?
The text was updated successfully, but these errors were encountered: