Skip to content
Snippets Groups Projects
Commit ca13a41c authored by Dworatzyk, Katharina's avatar Dworatzyk, Katharina
Browse files

Remove invalid responses

parent a98e5737
No related branches found
No related tags found
1 merge request!7Resolve "Screen free text answers"
import re
from typing import Dict, List, Set
import matplotlib.pyplot as plt
......@@ -44,6 +45,20 @@ def _fix_typos(data_df: pd.DataFrame) -> pd.DataFrame:
return data_df
def _remove_answers_from_non_developers(data_df: pd.DataFrame) -> pd.DataFrame:
# cases in which respondents stated that they were not developing software
# and hence could not answer the respective questions properly
non_developers = [75, 100, 266, 324, 442, 506, 566, 572]
questions = [
question for question in data_df.columns if re.match(
r"^Q020|Q021|Q022|Q025|Q026|Q027|Q028|Q029|Q038|Q039|Q040|Q041|" +
"Q042|Q043|Q044", question
)
]
data_df.loc[non_developers, questions] = None
return data_df
def _prepare_q001(data_df: pd.DataFrame) -> pd.DataFrame:
"""Categorize affiliation mentioned in free text answers keeping "Other"
as default category."""
......@@ -1345,3 +1360,4 @@ data = _prepare_q037(data_df=data)
data = _prepare_q038(data_df=data)
data = _prepare_q043(data_df=data)
data = _prepare_q044(data_df=data)
data = _remove_answers_from_non_developers(data_df=data)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment