-
Notifications
You must be signed in to change notification settings - Fork 26
Fix Image.set_metadata() bug
#648
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #648 +/- ##
========================================
Coverage 86.49% 86.49%
========================================
Files 109 109
Lines 8286 8286
========================================
Hits 7167 7167
Misses 1119 1119
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
j-c-c
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
| ) | ||
| else: | ||
| self._metadata[metadata_field] = series | ||
| self._metadata.update(series.astype(object)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's convenient!
garrettwrong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks Chris. Lets go ahead and merge this one too.
DataFrame.update()takes care of what we were trying to do previously, which was including new data but setting old data toNaN.https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.update.html
See #635 for the original issue.
Also, by casting the series to dtype
object, when the same column exists in both the original DF, and the new DF it is being updated from, the dtype will default to that of the original DF. This fixes the second issue mentioned in #635.https://stackoverflow.com/a/47145613/9584059