Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def extract_questions(df1, question): # Herve
- """
- df1 = pd.read_csv("path/du/fichier.csv")
- -----
- question peut prendre deux types de valeur
- int : numero de la colonne entre 10 et 41
- str : question en format string
- """
- if isinstance(question, int):
- question1 = df1.columns[question]
- col = df1.columns[:10].tolist() + [question1]
- return df1[~df1[question1].isnull()][col]
- elif isinstance(question, str):
- col = df1.columns[:10].tolist() + [question]
- return df1[~df1[question].isnull()][col]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement