Skip to content

Commit

Permalink
Forms (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggx-jacechun authored Jun 29, 2023
1 parent 584be69 commit 3d3eda4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ggvlib/google/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import google.auth
from googleapiclient.discovery import build, Resource
import pandas as pd
import np
import numpy as np


DEFAULT_SCOPES = [
"https://www.googleapis.com/auth/drive",
Expand Down Expand Up @@ -113,7 +114,7 @@ def get_questions_as_df(form_id: str) -> pd.DataFrame:
for row in data["items"]:
if "questionItem" in row:
pair = list()
pair.append(row["title"])
pair.append(row["title"].strip())
pair.append(row["questionItem"]["question"]["questionId"])
pair.append("none")
return_df = pd.concat([return_df, pd.DataFrame(pair).T]).reset_index(
Expand All @@ -122,7 +123,7 @@ def get_questions_as_df(form_id: str) -> pd.DataFrame:
elif "questionGroupItem" in row:
for item in row["questionGroupItem"]["questions"]:
pair = list()
pair.append(row["title"])
pair.append(row["title"].strip())
pair.append(item["questionId"])
pair.append(item["rowQuestion"]["title"])
return_df = pd.concat([return_df, pd.DataFrame(pair).T]).reset_index(
Expand Down

0 comments on commit 3d3eda4

Please sign in to comment.