Look at the ESM data and test JSON expansion.
parent
0f7d182f40
commit
5cb527986b
|
@ -0,0 +1,37 @@
|
|||
# ---
|
||||
# jupyter:
|
||||
# jupytext:
|
||||
# formats: ipynb,py:percent
|
||||
# text_representation:
|
||||
# extension: .py
|
||||
# format_name: percent
|
||||
# format_version: '1.3'
|
||||
# jupytext_version: 1.11.2
|
||||
# kernelspec:
|
||||
# display_name: straw2analysis
|
||||
# language: python
|
||||
# name: straw2analysis
|
||||
# ---
|
||||
|
||||
# %%
|
||||
import os
|
||||
import sys
|
||||
|
||||
nb_dir = os.path.split(os.getcwd())[0]
|
||||
if nb_dir not in sys.path:
|
||||
sys.path.append(nb_dir)
|
||||
import participants.query_db
|
||||
from features.esm import *
|
||||
|
||||
# %%
|
||||
df_esm_nokia = get_esm_data(["nokia_0000003"])
|
||||
print(df_esm_nokia)
|
||||
|
||||
# %%
|
||||
df_esm_nokia_json = pd.json_normalize(df_esm_nokia["esm_json"]).drop(columns=["esm_trigger"])
|
||||
df_esm_nokia_full = df_esm_nokia.join(df_esm_nokia_json)
|
||||
|
||||
# %%
|
||||
df_esm_nokia_full.loc[df_esm_nokia_full["esm_user_answer"].str.contains("Remove"),"esm_user_answer"].value_counts()
|
||||
|
||||
# %%
|
|
@ -22,7 +22,7 @@ def get_esm_data(usernames: Collection) -> pd.DataFrame:
|
|||
Returns
|
||||
-------
|
||||
df_esm: pd.DataFrame
|
||||
A dataframe of call data.
|
||||
A dataframe of esm data.
|
||||
"""
|
||||
query_esm = (
|
||||
session.query(ESM, Participant.username)
|
||||
|
|
Loading…
Reference in New Issue