From e0fcea91af8c30ead82131b6b431f6f450331daf Mon Sep 17 00:00:00 2001 From: "Carl F. Corneil" Date: Wed, 22 May 2024 10:20:32 +0200 Subject: [PATCH 1/5] fix date picker usage --- demo/01_enkleste_bruk.ipynb | 24 ++-- demo/02_bruke_filbeskrivelse.ipynb | 117 +++++++++++++++--- demo/03629_hentogsend.ipynb | 26 ++-- demo/03_alleparametre_datewidget.ipynb | 40 +++--- demo/04_hent_publisertdata.ipynb | 10 +- demo/214_mnr_hentogsend.ipynb | 20 +-- demo/312_stillnaring_csv.ipynb | 18 +-- demo/312_stillnaring_fellesdaplalagring.ipynb | 30 ++--- demo/fillna_dict_dev.ipynb | 42 +++---- src/statbank/client.py | 8 +- 10 files changed, 207 insertions(+), 128 deletions(-) diff --git a/demo/01_enkleste_bruk.ipynb b/demo/01_enkleste_bruk.ipynb index a1a5da9..c00426f 100644 --- a/demo/01_enkleste_bruk.ipynb +++ b/demo/01_enkleste_bruk.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "bcc1eb65-8b44-46a2-9b0b-a0d6a360e167", + "id": "0", "metadata": { "tags": [] }, @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6606ec68-0265-4253-9a58-31fdecf5653d", + "id": "1", "metadata": { "tags": [] }, @@ -28,7 +28,7 @@ }, { "cell_type": "markdown", - "id": "79da7f12-c21b-4450-90a6-5a30238d57ef", + "id": "2", "metadata": {}, "source": [ "### Få tak i data\n", @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b787de4-22b5-4cf2-af77-75ba915efe0a", + "id": "3", "metadata": { "tags": [] }, @@ -52,7 +52,7 @@ }, { "cell_type": "markdown", - "id": "d843bc4e-2703-4563-b539-4e7ca4e7b7c8", + "id": "4", "metadata": {}, "source": [ "### Lag statbank-client\n", @@ -62,7 +62,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6", + "id": "5", "metadata": { "tags": [] }, @@ -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", @@ -83,7 +83,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53a6eca7-3f2f-417a-8386-c9958d0da1e9", + "id": "7", "metadata": { "tags": [] }, @@ -95,7 +95,7 @@ }, { "cell_type": "markdown", - "id": "462800de-3a8e-46d3-9e7e-84a27b9228f1", + "id": "8", "metadata": {}, "source": [ "### Du kan validere rett på clienten?" @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d15ca447-1dae-48e4-9fd6-457168cf3614", + "id": "9", "metadata": { "tags": [] }, @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387", + "id": "10", "metadata": { "tags": [] }, @@ -127,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1492a81-2d1b-4947-a78e-749095e096a6", + "id": "11", "metadata": { "tags": [] }, diff --git a/demo/02_bruke_filbeskrivelse.ipynb b/demo/02_bruke_filbeskrivelse.ipynb index f16f995..52ee677 100644 --- a/demo/02_bruke_filbeskrivelse.ipynb +++ b/demo/02_bruke_filbeskrivelse.ipynb @@ -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" @@ -25,7 +24,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6", + "id": "2", "metadata": { "tags": [] }, @@ -37,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf9f0b9d-48ac-4ec8-9e7e-0f2df4443320", + "id": "3", "metadata": { "tags": [] }, @@ -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": [] }, @@ -59,7 +136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c33c3c6-6a23-4beb-8c4b-edf141e2bc3f", + "id": "11", "metadata": { "tags": [] }, @@ -71,7 +148,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e29ea7e-a47a-4c78-9141-074345619dff", + "id": "12", "metadata": { "tags": [] }, @@ -86,7 +163,7 @@ }, { "cell_type": "markdown", - "id": "68217364-31b6-48f3-b71b-66c32bf0afe7", + "id": "13", "metadata": { "tags": [] }, @@ -97,7 +174,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b787de4-22b5-4cf2-af77-75ba915efe0a", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +185,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b4b8e239-2e7f-45c0-b38f-1154177ca9a9", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -118,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce3a3ac4-f36b-4b74-ae76-bbe5e54468de", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -128,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "d696ba7e-1c12-4322-8d45-b4715bf25e2f", + "id": "17", "metadata": {}, "source": [ "### Validate data" @@ -137,7 +214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b56ce312-b634-443e-882f-d0e9231e5f9a", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -146,7 +223,7 @@ }, { "cell_type": "markdown", - "id": "0d8ab0cf-a9dc-488b-acac-557aabb5641f", + "id": "19", "metadata": {}, "source": [ "### Round data" @@ -155,7 +232,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f2d7ffd-ad4d-4e8b-9828-8350e493e19b", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -165,7 +242,7 @@ { "cell_type": "code", "execution_count": null, - "id": "723e0186-0bc3-40f2-ac6c-5867a080c4d8", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -179,7 +256,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d56a8b78-ea27-4d67-b030-ccf9868c0cd6", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -188,7 +265,7 @@ }, { "cell_type": "markdown", - "id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387", + "id": "23", "metadata": { "tags": [] }, @@ -199,7 +276,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1492a81-2d1b-4947-a78e-749095e096a6", + "id": "24", "metadata": {}, "outputs": [], "source": [ diff --git a/demo/03629_hentogsend.ipynb b/demo/03629_hentogsend.ipynb index 9ca568f..60fedf7 100644 --- a/demo/03629_hentogsend.ipynb +++ b/demo/03629_hentogsend.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4badaf79-1952-473c-a2a9-736dca97ca5b", + "id": "0", "metadata": { "tags": [] }, @@ -20,7 +20,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a0f20bda-9075-4bfc-900a-fe7563dd8b0d", + "id": "1", "metadata": { "tags": [] }, @@ -32,7 +32,7 @@ { "cell_type": "code", "execution_count": null, - "id": "287c811a-55bd-41c3-8dff-29532d08fcb3", + "id": "2", "metadata": { "tags": [] }, @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1434632d-f901-4aec-8892-808198953c90", + "id": "3", "metadata": { "tags": [] }, @@ -71,7 +71,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66132ddd-a0b4-4b83-87f4-3320029ed7d1", + "id": "4", "metadata": { "tags": [] }, @@ -84,7 +84,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e53de2d5-d6f0-48b5-a105-8c418f5f76f4", + "id": "5", "metadata": { "tags": [] }, @@ -96,7 +96,7 @@ { "cell_type": "code", "execution_count": null, - "id": "87c4a7ac-9f21-4053-a8a8-4c69737c9385", + "id": "6", "metadata": { "tags": [] }, @@ -115,7 +115,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b68e7af3-741a-4ada-bbee-5e7c243a7cba", + "id": "7", "metadata": { "tags": [] }, @@ -127,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "479327f1-b017-4991-a8f4-420a7d80e7d1", + "id": "8", "metadata": { "tags": [] }, @@ -139,7 +139,7 @@ { "cell_type": "code", "execution_count": null, - "id": "062db185-394a-4e77-b518-161542d7e32e", + "id": "9", "metadata": { "tags": [] }, @@ -151,7 +151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e408275f-937f-4917-a243-ecd15a630a68", + "id": "10", "metadata": { "tags": [] }, @@ -163,7 +163,7 @@ { "cell_type": "code", "execution_count": null, - "id": "04c5fc60-71d5-41a6-99cc-80de201305bd", + "id": "11", "metadata": { "tags": [] }, @@ -175,7 +175,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f879784-17ba-4ebd-be0d-7a49ab021ef3", + "id": "12", "metadata": { "tags": [] }, diff --git a/demo/03_alleparametre_datewidget.ipynb b/demo/03_alleparametre_datewidget.ipynb index 0b0f81b..96b38ca 100644 --- a/demo/03_alleparametre_datewidget.ipynb +++ b/demo/03_alleparametre_datewidget.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6606ec68-0265-4253-9a58-31fdecf5653d", + "id": "0", "metadata": {}, "outputs": [], "source": [ @@ -13,7 +13,7 @@ }, { "cell_type": "markdown", - "id": "d843bc4e-2703-4563-b539-4e7ca4e7b7c8", + "id": "1", "metadata": {}, "source": [ "### Create client" @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6", + "id": "2", "metadata": {}, "outputs": [], "source": [ @@ -36,7 +36,7 @@ }, { "cell_type": "markdown", - "id": "fca0f0a6-c50f-4d0c-ac9b-6ca008994784", + "id": "3", "metadata": {}, "source": [ "### Sett dato interaktivt med widget" @@ -45,7 +45,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f913728-f0c8-42f4-b529-70e563129288", + "id": "4", "metadata": { "tags": [] }, @@ -57,7 +57,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83fb410f-448e-4c50-b536-f2d0fd1efa14", + "id": "5", "metadata": { "tags": [] }, @@ -69,7 +69,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf9f0b9d-48ac-4ec8-9e7e-0f2df4443320", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -79,7 +79,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31b60cf5-faac-471e-90b0-2e2d8b127a72", + "id": "7", "metadata": { "tags": [] }, @@ -90,7 +90,7 @@ }, { "cell_type": "markdown", - "id": "f9c10515-ad8f-43b8-930c-952e0a15098f", + "id": "8", "metadata": { "tags": [] }, @@ -101,7 +101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c33c3c6-6a23-4beb-8c4b-edf141e2bc3f", + "id": "9", "metadata": { "tags": [] }, @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "68217364-31b6-48f3-b71b-66c32bf0afe7", + "id": "10", "metadata": {}, "source": [ "### Load data" @@ -121,7 +121,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b787de4-22b5-4cf2-af77-75ba915efe0a", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -132,7 +132,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce3a3ac4-f36b-4b74-ae76-bbe5e54468de", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -142,7 +142,7 @@ }, { "cell_type": "markdown", - "id": "d696ba7e-1c12-4322-8d45-b4715bf25e2f", + "id": "13", "metadata": {}, "source": [ "### Validate data" @@ -151,7 +151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b56ce312-b634-443e-882f-d0e9231e5f9a", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -160,7 +160,7 @@ }, { "cell_type": "markdown", - "id": "0d8ab0cf-a9dc-488b-acac-557aabb5641f", + "id": "15", "metadata": {}, "source": [ "### Round data" @@ -169,7 +169,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f2d7ffd-ad4d-4e8b-9828-8350e493e19b", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -179,7 +179,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d56a8b78-ea27-4d67-b030-ccf9868c0cd6", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -188,7 +188,7 @@ }, { "cell_type": "markdown", - "id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387", + "id": "18", "metadata": { "tags": [] }, @@ -199,7 +199,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1492a81-2d1b-4947-a78e-749095e096a6", + "id": "19", "metadata": {}, "outputs": [], "source": [ diff --git a/demo/04_hent_publisertdata.ipynb b/demo/04_hent_publisertdata.ipynb index dba6772..d7ee0ad 100644 --- a/demo/04_hent_publisertdata.ipynb +++ b/demo/04_hent_publisertdata.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6606ec68-0265-4253-9a58-31fdecf5653d", + "id": "0", "metadata": {}, "outputs": [], "source": [ @@ -14,7 +14,7 @@ { "cell_type": "code", "execution_count": null, - "id": "56e9e348-cbdd-4646-8285-060b0dcc5373", + "id": "1", "metadata": { "tags": [] }, @@ -27,7 +27,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48409c03-b132-47e2-ad0d-37be44a784be", + "id": "2", "metadata": { "tags": [] }, @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99cf7cd8-8af5-4ba6-a545-977bf009658a", + "id": "3", "metadata": { "jupyter": { "source_hidden": true @@ -108,7 +108,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db679ddf-dd8e-4907-b7ca-376267d0ec0c", + "id": "4", "metadata": { "tags": [] }, diff --git a/demo/214_mnr_hentogsend.ipynb b/demo/214_mnr_hentogsend.ipynb index 384b1df..9a9f129 100644 --- a/demo/214_mnr_hentogsend.ipynb +++ b/demo/214_mnr_hentogsend.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4badaf79-1952-473c-a2a9-736dca97ca5b", + "id": "0", "metadata": { "tags": [] }, @@ -21,7 +21,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73a7f889-7a04-43f9-959f-13258f464d18", + "id": "1", "metadata": { "tags": [] }, @@ -52,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e198e02-b28f-4078-b480-73c4ddcabca7", + "id": "2", "metadata": { "tags": [] }, @@ -64,7 +64,7 @@ { "cell_type": "code", "execution_count": null, - "id": "654ef935-0edb-4f09-966f-67190f947926", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e7818398-0eb9-4eeb-b4d7-986be15bd703", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -90,7 +90,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2975f719-eeaf-4818-8ca1-d64597d96e81", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -100,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6332734c-6928-4f7c-bc05-0f7f32052dcf", + "id": "6", "metadata": { "tags": [] }, @@ -112,7 +112,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9634653-a3b9-441f-95f8-45045a130ff1", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -122,7 +122,7 @@ { "cell_type": "code", "execution_count": null, - "id": "315fc925-d0e4-45d1-9f79-acc549ef6421", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -132,7 +132,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8cfbbbb2-2622-4347-9160-3f8c7b4f00b6", + "id": "9", "metadata": {}, "outputs": [], "source": [ diff --git a/demo/312_stillnaring_csv.ipynb b/demo/312_stillnaring_csv.ipynb index 1914a27..8bacabd 100644 --- a/demo/312_stillnaring_csv.ipynb +++ b/demo/312_stillnaring_csv.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81f8e595-1665-41f7-865a-df605eeb95eb", + "id": "0", "metadata": { "tags": [] }, @@ -16,7 +16,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc4ab1b2-bbff-427d-9b87-9813e633d8bc", + "id": "1", "metadata": { "tags": [] }, @@ -28,7 +28,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f6fa25f3-65b9-4b06-9fed-5d1697ad41b6", + "id": "2", "metadata": { "tags": [] }, @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d37c487-0d07-4b4f-9b60-57f41f3b761b", + "id": "3", "metadata": { "tags": [] }, @@ -52,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2abd9751-ba95-4cd2-85c9-07bb01c66fd7", + "id": "4", "metadata": { "tags": [] }, @@ -65,7 +65,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1fe8e477-7b8b-463d-b1e2-967a702620cd", + "id": "5", "metadata": { "tags": [] }, @@ -79,7 +79,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6ffbed2-8190-4414-8bed-a8e29284c773", + "id": "6", "metadata": { "tags": [] }, @@ -91,7 +91,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7b776a27-aa6c-4355-ada6-3e6b05dc8400", + "id": "7", "metadata": { "tags": [] }, @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "05b07569-248c-4375-84c7-dac292c7b5af", + "id": "8", "metadata": { "tags": [] }, diff --git a/demo/312_stillnaring_fellesdaplalagring.ipynb b/demo/312_stillnaring_fellesdaplalagring.ipynb index 344d926..76427bd 100644 --- a/demo/312_stillnaring_fellesdaplalagring.ipynb +++ b/demo/312_stillnaring_fellesdaplalagring.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c4f2ecfc", + "id": "0", "metadata": { "tags": [] }, @@ -17,7 +17,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8aec733", + "id": "1", "metadata": { "tags": [] }, @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b372e5b7", + "id": "2", "metadata": { "tags": [] }, @@ -42,7 +42,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5942dab5", + "id": "3", "metadata": { "tags": [] }, @@ -56,7 +56,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6822431d", + "id": "4", "metadata": { "tags": [] }, @@ -68,7 +68,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28abb8f8", + "id": "5", "metadata": { "tags": [] }, @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dda2e0d2", + "id": "6", "metadata": { "tags": [] }, @@ -92,7 +92,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bcdb93c", + "id": "7", "metadata": { "tags": [] }, @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "94af6dee", + "id": "8", "metadata": { "tags": [] }, @@ -116,7 +116,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6946199c", + "id": "9", "metadata": { "tags": [] }, @@ -128,7 +128,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b380d6f8", + "id": "10", "metadata": { "tags": [] }, @@ -140,7 +140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b988589", + "id": "11", "metadata": { "tags": [] }, @@ -151,7 +151,7 @@ }, { "cell_type": "markdown", - "id": "9bc25130-3869-4ec3-982c-417daba1488a", + "id": "12", "metadata": {}, "source": [ "### Det ligger mye interssant i resultatet av overføringen" @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83cd2bed-bcc4-4845-be13-fa2ed69dda6b", + "id": "13", "metadata": { "tags": [] }, @@ -172,7 +172,7 @@ { "cell_type": "code", "execution_count": null, - "id": "550e3d3d-3b8a-44e9-80ed-2e412c0111dc", + "id": "14", "metadata": { "tags": [] }, diff --git a/demo/fillna_dict_dev.ipynb b/demo/fillna_dict_dev.ipynb index 3535e61..965900b 100644 --- a/demo/fillna_dict_dev.ipynb +++ b/demo/fillna_dict_dev.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6606ec68-0265-4253-9a58-31fdecf5653d", + "id": "0", "metadata": { "tags": [] }, @@ -16,7 +16,7 @@ }, { "cell_type": "markdown", - "id": "d843bc4e-2703-4563-b539-4e7ca4e7b7c8", + "id": "1", "metadata": {}, "source": [ "### Create client" @@ -25,7 +25,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e03529d8-b5a4-493c-87a9-5f7f7d00e1a6", + "id": "2", "metadata": { "tags": [] }, @@ -37,7 +37,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf9f0b9d-48ac-4ec8-9e7e-0f2df4443320", + "id": "3", "metadata": { "tags": [] }, @@ -48,7 +48,7 @@ }, { "cell_type": "markdown", - "id": "f9c10515-ad8f-43b8-930c-952e0a15098f", + "id": "4", "metadata": { "tags": [] }, @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c33c3c6-6a23-4beb-8c4b-edf141e2bc3f", + "id": "5", "metadata": { "tags": [] }, @@ -71,7 +71,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d7a8e2a2-882d-45d4-bd63-9dbd1932d94f", + "id": "6", "metadata": { "tags": [] }, @@ -87,7 +87,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fbd3cc0-2b89-408b-9ac2-d75ebab3a50b", + "id": "7", "metadata": { "tags": [] }, @@ -99,7 +99,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e29ea7e-a47a-4c78-9141-074345619dff", + "id": "8", "metadata": { "tags": [] }, @@ -114,7 +114,7 @@ }, { "cell_type": "markdown", - "id": "68217364-31b6-48f3-b71b-66c32bf0afe7", + "id": "9", "metadata": { "tags": [] }, @@ -125,7 +125,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b787de4-22b5-4cf2-af77-75ba915efe0a", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -136,7 +136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b4b8e239-2e7f-45c0-b38f-1154177ca9a9", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -146,7 +146,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce3a3ac4-f36b-4b74-ae76-bbe5e54468de", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -156,7 +156,7 @@ }, { "cell_type": "markdown", - "id": "d696ba7e-1c12-4322-8d45-b4715bf25e2f", + "id": "13", "metadata": {}, "source": [ "### Validate data" @@ -165,7 +165,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b56ce312-b634-443e-882f-d0e9231e5f9a", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "0d8ab0cf-a9dc-488b-acac-557aabb5641f", + "id": "15", "metadata": {}, "source": [ "### Round data" @@ -183,7 +183,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f2d7ffd-ad4d-4e8b-9828-8350e493e19b", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -193,7 +193,7 @@ { "cell_type": "code", "execution_count": null, - "id": "723e0186-0bc3-40f2-ac6c-5867a080c4d8", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -207,7 +207,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d56a8b78-ea27-4d67-b030-ccf9868c0cd6", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -216,7 +216,7 @@ }, { "cell_type": "markdown", - "id": "8550bf8c-c9f8-4c9e-a46b-40fa3a670387", + "id": "19", "metadata": { "tags": [] }, @@ -227,7 +227,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1492a81-2d1b-4947-a78e-749095e096a6", + "id": "20", "metadata": {}, "outputs": [], "source": [ diff --git a/src/statbank/client.py b/src/statbank/client.py index 8963c32..0899a05 100644 --- a/src/statbank/client.py +++ b/src/statbank/client.py @@ -189,10 +189,12 @@ def set_publish_date(self, date: dt.datetime | str | widgets.DatePicker) -> None TypeError: If the date-parameter is of type other than datetime, string, or ipywidgets.DatePicker. """ if isinstance(date, widgets.DatePicker): - date_date: dt.datetime = dt.datetime.combine( - date.value.today(), + dt.datetime.combine( + date.value, dt.datetime.min.time(), - ) + ).astimezone( + OSLO_TIMEZONE, + ) + dt.timedelta(hours=1) elif isinstance(date, str): date_date = dt.datetime.strptime(date, "%Y-%m-%d").astimezone( OSLO_TIMEZONE, From f00f51a1c58ed5450c1cc7d788979845cc557914 Mon Sep 17 00:00:00 2001 From: "Carl F. Corneil" Date: Wed, 22 May 2024 10:20:55 +0200 Subject: [PATCH 2/5] bump patch version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bbe9efa..3685bbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dapla-statbank-client" -version = "1.2.2" +version = "1.2.3" description = "Handles data transfer Statbank <-> Dapla for Statistics Norway" authors = ["Statistics Norway", "Carl F. Corneil "] license = "MIT" From b980c749f197b31196179621197e141bd67c7fbf Mon Sep 17 00:00:00 2001 From: "Carl F. Corneil" Date: Wed, 22 May 2024 10:46:47 +0200 Subject: [PATCH 3/5] forgot to assign to variable --- src/statbank/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statbank/client.py b/src/statbank/client.py index 0899a05..113316a 100644 --- a/src/statbank/client.py +++ b/src/statbank/client.py @@ -189,7 +189,7 @@ def set_publish_date(self, date: dt.datetime | str | widgets.DatePicker) -> None TypeError: If the date-parameter is of type other than datetime, string, or ipywidgets.DatePicker. """ if isinstance(date, widgets.DatePicker): - dt.datetime.combine( + date_date = dt.datetime.combine( date.value, dt.datetime.min.time(), ).astimezone( From 4f12ca6b90a0278639d1aa007e4fa808724dcf92 Mon Sep 17 00:00:00 2001 From: "Carl F. Corneil" Date: Wed, 22 May 2024 10:54:37 +0200 Subject: [PATCH 4/5] black does not like my fromatting --- src/statbank/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/statbank/client.py b/src/statbank/client.py index 113316a..8857a58 100644 --- a/src/statbank/client.py +++ b/src/statbank/client.py @@ -192,9 +192,7 @@ def set_publish_date(self, date: dt.datetime | str | widgets.DatePicker) -> None date_date = dt.datetime.combine( date.value, dt.datetime.min.time(), - ).astimezone( - OSLO_TIMEZONE, - ) + dt.timedelta(hours=1) + ).astimezone(OSLO_TIMEZONE,) + dt.timedelta(hours=1) elif isinstance(date, str): date_date = dt.datetime.strptime(date, "%Y-%m-%d").astimezone( OSLO_TIMEZONE, From 784814a325e3d0e97351d818bcb05e4d43890b9e Mon Sep 17 00:00:00 2001 From: "Carl F. Corneil" Date: Wed, 22 May 2024 10:57:14 +0200 Subject: [PATCH 5/5] arghblargh --- src/statbank/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statbank/client.py b/src/statbank/client.py index 8857a58..87de841 100644 --- a/src/statbank/client.py +++ b/src/statbank/client.py @@ -192,7 +192,7 @@ def set_publish_date(self, date: dt.datetime | str | widgets.DatePicker) -> None date_date = dt.datetime.combine( date.value, dt.datetime.min.time(), - ).astimezone(OSLO_TIMEZONE,) + dt.timedelta(hours=1) + ).astimezone(OSLO_TIMEZONE) + dt.timedelta(hours=1) elif isinstance(date, str): date_date = dt.datetime.strptime(date, "%Y-%m-%d").astimezone( OSLO_TIMEZONE,