Skip to content

Commit

Permalink
Merge pull request #130 from statisticsnorway/fix_date_picker_timezone
Browse files Browse the repository at this point in the history
Fix date picker timezone
  • Loading branch information
aecorn authored May 22, 2024
2 parents d5f0bb1 + 784814a commit b0e0a14
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 129 deletions.
24 changes: 12 additions & 12 deletions demo/01_enkleste_bruk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "bcc1eb65-8b44-46a2-9b0b-a0d6a360e167",
"id": "0",
"metadata": {
"tags": []
},
Expand All @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6606ec68-0265-4253-9a58-31fdecf5653d",
"id": "1",
"metadata": {
"tags": []
},
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "markdown",
"id": "79da7f12-c21b-4450-90a6-5a30238d57ef",
"id": "2",
"metadata": {},
"source": [
"### Få tak i data\n",
Expand All @@ -40,7 +40,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2b787de4-22b5-4cf2-af77-75ba915efe0a",
"id": "3",
"metadata": {
"tags": []
},
Expand All @@ -52,7 +52,7 @@
},
{
"cell_type": "markdown",
"id": "d843bc4e-2703-4563-b539-4e7ca4e7b7c8",
"id": "4",
"metadata": {},
"source": [
"### Lag statbank-client\n",
Expand All @@ -62,7 +62,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6",
"id": "5",
"metadata": {
"tags": []
},
Expand All @@ -73,7 +73,7 @@
},
{
"cell_type": "markdown",
"id": "1e0e62dd-2427-4501-bf7a-c0f060c439f4",
"id": "6",
"metadata": {},
"source": [
"### Vi må vite hvilke deltabeller hver dataframe representerer\n",
Expand All @@ -83,7 +83,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "53a6eca7-3f2f-417a-8386-c9958d0da1e9",
"id": "7",
"metadata": {
"tags": []
},
Expand All @@ -95,7 +95,7 @@
},
{
"cell_type": "markdown",
"id": "462800de-3a8e-46d3-9e7e-84a27b9228f1",
"id": "8",
"metadata": {},
"source": [
"### Du kan validere rett på clienten?"
Expand All @@ -104,7 +104,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d15ca447-1dae-48e4-9fd6-457168cf3614",
"id": "9",
"metadata": {
"tags": []
},
Expand All @@ -115,7 +115,7 @@
},
{
"cell_type": "markdown",
"id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387",
"id": "10",
"metadata": {
"tags": []
},
Expand All @@ -127,7 +127,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c1492a81-2d1b-4947-a78e-749095e096a6",
"id": "11",
"metadata": {
"tags": []
},
Expand Down
117 changes: 97 additions & 20 deletions demo/02_bruke_filbeskrivelse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6606ec68-0265-4253-9a58-31fdecf5653d",
"id": "0",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"from statbank import StatbankClient"
]
},
{
"cell_type": "markdown",
"id": "d843bc4e-2703-4563-b539-4e7ca4e7b7c8",
"id": "1",
"metadata": {},
"source": [
"### Create client"
Expand All @@ -25,7 +24,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6",
"id": "2",
"metadata": {
"tags": []
},
Expand All @@ -37,7 +36,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cf9f0b9d-48ac-4ec8-9e7e-0f2df4443320",
"id": "3",
"metadata": {
"tags": []
},
Expand All @@ -46,9 +45,87 @@
"print(client)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"date = client.date_picker()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import datetime as dt"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"OSLO_TIMEZONE = dt.timezone(dt.timedelta(hours=1))\n",
"dt.datetime.combine(\n",
" date.value,\n",
" dt.datetime.min.time(),\n",
" ).astimezone(\n",
" OSLO_TIMEZONE,\n",
" ) + dt.timedelta(hours=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"date.value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"client.set_publish_date(\"2024-05-25\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"client.date"
]
},
{
"cell_type": "markdown",
"id": "f9c10515-ad8f-43b8-930c-952e0a15098f",
"id": "10",
"metadata": {
"tags": []
},
Expand All @@ -59,7 +136,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6c33c3c6-6a23-4beb-8c4b-edf141e2bc3f",
"id": "11",
"metadata": {
"tags": []
},
Expand All @@ -71,7 +148,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6e29ea7e-a47a-4c78-9141-074345619dff",
"id": "12",
"metadata": {
"tags": []
},
Expand All @@ -86,7 +163,7 @@
},
{
"cell_type": "markdown",
"id": "68217364-31b6-48f3-b71b-66c32bf0afe7",
"id": "13",
"metadata": {
"tags": []
},
Expand All @@ -97,7 +174,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2b787de4-22b5-4cf2-af77-75ba915efe0a",
"id": "14",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -108,7 +185,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b4b8e239-2e7f-45c0-b38f-1154177ca9a9",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -118,7 +195,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ce3a3ac4-f36b-4b74-ae76-bbe5e54468de",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -128,7 +205,7 @@
},
{
"cell_type": "markdown",
"id": "d696ba7e-1c12-4322-8d45-b4715bf25e2f",
"id": "17",
"metadata": {},
"source": [
"### Validate data"
Expand All @@ -137,7 +214,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b56ce312-b634-443e-882f-d0e9231e5f9a",
"id": "18",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -146,7 +223,7 @@
},
{
"cell_type": "markdown",
"id": "0d8ab0cf-a9dc-488b-acac-557aabb5641f",
"id": "19",
"metadata": {},
"source": [
"### Round data"
Expand All @@ -155,7 +232,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1f2d7ffd-ad4d-4e8b-9828-8350e493e19b",
"id": "20",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -165,7 +242,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "723e0186-0bc3-40f2-ac6c-5867a080c4d8",
"id": "21",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -179,7 +256,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d56a8b78-ea27-4d67-b030-ccf9868c0cd6",
"id": "22",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -188,7 +265,7 @@
},
{
"cell_type": "markdown",
"id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387",
"id": "23",
"metadata": {
"tags": []
},
Expand All @@ -199,7 +276,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c1492a81-2d1b-4947-a78e-749095e096a6",
"id": "24",
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit b0e0a14

Please sign in to comment.