mercredi 9 octobre 2019

How to write doctest in a function receiving and returning a panda dataframe

Let's say I have a function like the following:

def filter_dataframe(df):
    new_df = df[df['Value'] != 10]
    # a lot of more complex filterings here
    .....
    return new_df

How can I write a doctest here to test that my function is working correctly?

What is the cleanest way to write a test here?

Aucun commentaire:

Enregistrer un commentaire