Remix.run Logo
kazinator a day ago

> This is of course an impossible task—the problem is the missing data, not the code.

We cannot with certainty assert that. If the datum is expected to be missing, such that the frame without the datum is still considered valid and must be handled rather than flagged as an error, the code has to do exactly that. Perhaps a missing value in the dictionary can be supplanted with a zero.

  df['new_column'] = df.get('index_value', 0) + 1
  # there might be no column ‘index_value’;
  # requirements say that zero should be substituted.