early returns from function doesnt add history column

The following discussion from !338 (merged) should be addressed:

  • @schaefed started a discussion: (+5 comments)

    This is a general concern with our flag handling and related to the code comment:

    Functions with an early return like:

    if data[field].empty:
        return data, flags

    don't set any flags at all and therefore leave no traits in the History. This unfortunate as some flagging schemes depend on a complete history. I fixed the early-returning functions I found with something like:

    if data[field].empty:
        flags[field] = UNFLAGGED
        return data, flags

    which is ... IDK, at least prone to errors. So maybe we should handle this here with something like:

    if new_history.empty:
        new_history = History(old_history.index).append(UNFLAGGED)

    (or maybe something more straightforward...). What do you think?

Edited by David Schäfer