Skip to content

Commit

Permalink
Merge pull request #32 from datapartnership/update_notebook_info
Browse files Browse the repository at this point in the history
update notebooks
  • Loading branch information
msoltadeo authored Jun 4, 2024
2 parents e32f335 + db61f65 commit b3d4635
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
60 changes: 58 additions & 2 deletions notebooks/mobility/activity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,14 @@
"### By Special Economic Zones"
]
},
{
"cell_type": "markdown",
"id": "1880cae1-fabc-4633-8574-7211650b54fd",
"metadata": {},
"source": [
"#### Percentage Change"
]
},
{
"cell_type": "code",
"execution_count": 24,
Expand Down Expand Up @@ -2046,6 +2054,14 @@
"plt.savefig(\"percentage_change.png\")"
]
},
{
"cell_type": "markdown",
"id": "9587f296-6638-40f5-bf4b-8e4c7593b6f5",
"metadata": {},
"source": [
"#### Z-Score"
]
},
{
"cell_type": "code",
"execution_count": 26,
Expand Down Expand Up @@ -2120,6 +2136,14 @@
")"
]
},
{
"cell_type": "markdown",
"id": "78a9325d-2a4c-4a77-bda5-9edd8b624a5f",
"metadata": {},
"source": [
"#### Percentage Change"
]
},
{
"cell_type": "code",
"execution_count": 28,
Expand Down Expand Up @@ -2170,6 +2194,14 @@
"plt.savefig(\"percentage_change_admin1.png\")"
]
},
{
"cell_type": "markdown",
"id": "9b773bf9-fa68-497f-b603-44e242077502",
"metadata": {},
"source": [
"#### Z-Score"
]
},
{
"cell_type": "code",
"execution_count": 29,
Expand Down Expand Up @@ -2219,6 +2251,14 @@
"plt.savefig(\"z_score_admin1.png\")"
]
},
{
"cell_type": "markdown",
"id": "5e144119-e8ed-4227-bb22-b5af91d6ab2d",
"metadata": {},
"source": [
"### By Region"
]
},
{
"cell_type": "code",
"execution_count": 30,
Expand Down Expand Up @@ -2256,6 +2296,14 @@
"ACTIVITY[\"region\"] = ACTIVITY[\"admin1\"].apply(lambda x: region_dict[x])"
]
},
{
"cell_type": "markdown",
"id": "1b364faf-806a-400a-bbe6-94c30bff5cb5",
"metadata": {},
"source": [
"#### Percentage Change"
]
},
{
"cell_type": "code",
"execution_count": 38,
Expand Down Expand Up @@ -2306,6 +2354,14 @@
"plt.savefig(\"percentage_change_region.png\")"
]
},
{
"cell_type": "markdown",
"id": "8eed30b3-3c6c-49ab-818a-7e004921b7f4",
"metadata": {},
"source": [
"#### Z-Score"
]
},
{
"cell_type": "code",
"execution_count": 37,
Expand Down Expand Up @@ -3019,7 +3075,7 @@
],
"instance_type": "ml.m5.16xlarge",
"kernelspec": {
"display_name": "data-goods",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -3033,7 +3089,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
58 changes: 1 addition & 57 deletions notebooks/mobility/mobility.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -253,62 +253,6 @@
"plt.xticks(rotation=90);"
]
},
{
"cell_type": "markdown",
"id": "37a8b4e1-8816-4988-9a24-ad714f269b4e",
"metadata": {
"tags": [
"remove-input"
]
},
"source": [
"### ID type"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "abfe4f36-a7d0-4033-bfa3-7f7b0b9908ef",
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"path = \"./data/data*.parquet\"\n",
"columns = [\"uid\", \"datetime\", \"id_type\"]\n",
"ddf = dd.read_parquet(path, columns=columns)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "fac8ead5-a8c1-4de5-b518-ae2f476e282d",
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# ddf.groupby(['uid', 'id_type']).size().head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b6d90836-1f89-412b-a2fd-e89ce8455509",
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"agg_by_id_type"
]
},
{
"cell_type": "markdown",
"id": "8ce0dc2a-9628-4806-981f-adb0e618ed0a",
Expand Down Expand Up @@ -508,7 +452,7 @@
"metadata": {},
"source": [
"### Users suitable for a longitudinal analysis\n",
"In order to perform a longitudinal analysis, we are filtering the data to keep only useres that had at least 30 pings in a month, which are around 2,500,000. \n",
"In order to perform a longitudinal analysis, we are filtering the data to keep only useres that had at least 30 pings in a month, which are around 1,300,000. \n",
"Then, we check for how many months these users keep these level of connection intensity. We observe that 75% of the users were able to keep the 30 pings per month for less than 2 months of the total 51 months. None of the users were able to keep the 30 pings per month across the 4 years. \n"
]
},
Expand Down

0 comments on commit b3d4635

Please sign in to comment.