(mandatory_fields, data)
Validate parsed CSV fields against mandatory fields.

    Args:
        mandatory_fields: a list of fields that must be present.
        data: a DataFrame built from the ingested file.

    Raises:
        RuntimeError: if there are missing fields.
Validate parsed CSV fields against mandatory fields.
Validate parsed CSV fields against mandatory fields .
def _validate_csv_fields(mandatory_fields, data):
    """Validate parsed CSV fields against mandatory fields.

    Args:
        mandatory_fields: a list of fields that must be present.
        data: a DataFrame built from the ingested file.

    Raises:
        RuntimeError: if there are missing fields.
    """
    mandatory_set = set(mandatory_fields)
    parsed_set = set(data.columns)

    if mandatory_set.issubset(parsed_set):
        return

    raise RuntimeError('Missing fields in CSV header: {0:s}'.format(
        ','.join(list(mandatory_set.difference(parsed_set)))))
def _validate_csv_fields ( mandatory_fields , data ) : mandatory_set = set ( mandatory_fields ) parsed_set = set ( data . columns ) if mandatory_set . issubset ( parsed_set ) : return raise RuntimeError ( 'Missing fields in CSV header: {0:s}' . format ( ',' . join ( list ( mandatory_set . difference ( parsed_set ) ) ) ) )