Skip to content
Snippets Groups Projects

read/write extra (meta) columns

Merged Bert Palm requested to merge handleExtraColumns into develop
2 unresolved threads

goal: read/write extra (meta) columns without necessarily knowing their names.

Closes #108 (closed)

Edited by Bert Palm

Merge request reports

Pipeline #8405 passed

Pipeline passed for 05af6738 on handleExtraColumns

Approval is optional

Merged by Bert PalmBert Palm 4 years ago (Sep 28, 2020 2:33pm UTC)

Merge details

Pipeline #8407 passed

Pipeline passed for c3159d8b on develop

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
281 281 raise ValueError(f"key(s) missing in flags: {failed}")
282 282 return field
283 283
284 def getExtraCols(self, field, loc=None):
  • I think, I prefer to implement this functionality into getFlags. This could be realized, for example, through an additional keyword, let's call it all=False. So per default getFlags would return a Series and with all=True a dictionary, that at least contains one item (e.g. {"flags": data_series}. In case of the DmpFlagger the return value could be something like {"flags": data_series, "comments": comments_series, "causes": causes_series}.

    This would prevent a further bloat of the flagger-interface and, more importantly, would allow a unified handling of the return values. In case of getExtraCols, the returned dict is potentially empty and we always need to check for validity before we can use it. Especially this would break:

    flagger = BaseFlagger(data)
    flagger.setFlagsWithExtracCols(field, loc, **flagger.getExtraCols(field, loc))

    If implement like proposed above, this would instead always work (and could even be the default internal usage):

    flagger = BaseFlagger(data)
    flagger.setFlags(field, loc, **flagger.getFlags(field, loc, all=True))
  • changed this line in version 4 of the diff

  • Please register or sign in to reply
  • 297 dict
    298 A dictionary holding the metadata. All items are pd.Series(), with an index equal to flags[loc,field]
    299 and all keys are known kwargs to `setFlagsWithExtraCols()`.
    300
    301 See Also
    302 --------
    303 setFlagsWithExtraCols : counterpart to this method to write extra columns.
    304
    305 Examples
    306 --------
    307 See `flagger.setFlagsWithExtraCols()` for an example.
    308 """
    309 assertScalar("field", self._check_field(field), optional=False)
    310 return dict()
    311
    312 def setFlagsWithExtraCols(self, field, loc=None, flags=None, inplace=False, **kwargs):
  • Bert Palm added 3 commits

    added 3 commits

    Compare with previous version

  • Bert Palm added 1 commit

    added 1 commit

    • 369ad713 - move functionality in set/getFlags

    Compare with previous version

  • Bert Palm added 1 commit

    added 1 commit

    • 05af6738 - comments and comannteasdbnasdikcalskvb

    Compare with previous version

  • Bert Palm unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Bert Palm mentioned in commit c3159d8b

    mentioned in commit c3159d8b

  • merged

  • Please register or sign in to reply
    Loading