Untitled

 avatar
unknown
plain_text
a year ago
773 B
5
Indexable
def _step_load_dataset(**kwargs):
    df = pd.read_csv('data/qrdata/ebola_survey.csv')
    # Ensure quarantine is of type int
    df['quarantine'] = df['quarantine'].fillna(0).astype(int)
    return df

# Define the step function to explore the dataset
def _step_exploration(df, **kwargs):
    # Print column types
    print(df.dtypes)
    # Calculate the number of entries, the number of positive and negative responses, and their proportions
    no_of_entries = df['quarantine'].count()
    no_of_positive = df['quarantine'].sum()
    no_of_negative = no_of_entries - no_of_positive
    positive_prop = no_of_positive / no_of_entries
    negative_prop = no_of_negative / no_of_entries
    return no_of_entries, no_of_positive, no_of_negative, positive_prop, negative_prop
Editor is loading...
Leave a Comment