From 338d3e9cc2a0470ac8bc8f3d67fbda63da38085d Mon Sep 17 00:00:00 2001 From: mmaurostoffel <166130318+mmaurostoffel@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:10:53 +0100 Subject: [PATCH] Untersuchung Vorbuchungszeit abgeschlossen --- .gitignore | 2 + src/data/database.py | 12 + src/mauro/dok/fullPreoDF.csv | 1312 ++++++++++++++++++++++++++++++++++ src/mauro/vorbuchungsZeit.py | 111 ++- 4 files changed, 1422 insertions(+), 15 deletions(-) create mode 100644 src/mauro/dok/fullPreoDF.csv diff --git a/.gitignore b/.gitignore index 43547e0..3cae330 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ *.ipr .idea/ + # eclipse project file .settings/ .classpath @@ -65,3 +66,4 @@ env3.*/ # duckdb *.duckdb +/src/mauro/dok/ diff --git a/src/data/database.py b/src/data/database.py index 6db3965..490e1eb 100644 --- a/src/data/database.py +++ b/src/data/database.py @@ -71,6 +71,18 @@ class Database: regions.name """) + def propIds_with_region(self): + return self.connection.sql(""" + SELECT + properties.id, seed_id, regions.name + FROM + consultancy_d.properties + LEFT JOIN + consultancy_d.seeds ON seeds.id = properties.seed_id + LEFT JOIN + consultancy_d.regions ON regions.id = seeds.region_id + """) + def properties_unreachable(self): return self.connection.sql(""" SELECT diff --git a/src/mauro/dok/fullPreoDF.csv b/src/mauro/dok/fullPreoDF.csv new file mode 100644 index 0000000..668676d --- /dev/null +++ b/src/mauro/dok/fullPreoDF.csv @@ -0,0 +1,1312 @@ +column_0,column_1 +1,20.93548387096774 +2,17.0 +3,26.55 +4,25.06896551724138 +5,25.161290322580644 +7,18.166666666666668 +8,22.65714285714286 +9,18.77777777777778 +10,0.358974358974359 +11,15.307692307692308 +12,22.869565217391305 +14,12.387096774193548 +15,20.340425531914892 +17,3.2857142857142856 +18,14.5 +19,13.352941176470589 +20,3.903225806451613 +22,4.291666666666667 +23,15.653846153846153 +24,35.07692307692308 +25,6.9523809523809526 +26,20.0 +27,0.4827586206896552 +28,3.2142857142857144 +29,15.923076923076923 +30,21.904761904761905 +31,6.538461538461538 +32,16.6046511627907 +33,19.916666666666668 +35,0.0 +36,7.565217391304348 +37,17.25 +38,9.806451612903226 +39,16.87878787878788 +40,23.444444444444443 +42,0.0 +43,6.0 +44,5.0 +45,27.0 +47,24.79310344827586 +48,14.0 +50,22.09090909090909 +51,11.8 +52,15.827586206896552 +53,22.8 +54,7.0 +56,15.02127659574468 +57,0.0 +58,7.439024390243903 +59,17.392857142857142 +60,21.470588235294116 +61,17.73913043478261 +62,4.0 +63,18.525 +64,2.7241379310344827 +65,17.857142857142858 +66,2.4545454545454546 +67,15.928571428571429 +68,2.7058823529411766 +69,19.38888888888889 +70,20.2 +71,22.214285714285715 +73,15.45945945945946 +74,25.0 +75,0.0 +76,7.636363636363637 +77,7.321428571428571 +78,11.545454545454545 +79,22.8 +80,10.0 +81,6.264705882352941 +82,20.605263157894736 +83,14.45945945945946 +84,0.0 +85,26.88888888888889 +86,22.5 +87,26.75 +89,6.5 +90,25.0 +91,0.0 +92,8.071428571428571 +93,13.166666666666666 +94,19.823529411764707 +95,19.40740740740741 +96,0.0 +97,34.76190476190476 +98,11.930232558139535 +99,5.285714285714286 +100,0.0 +101,3.7142857142857144 +102,1.0 +103,3.8421052631578947 +104,30.41176470588235 +106,0.631578947368421 +107,13.523809523809524 +108,13.444444444444445 +109,7.35 +110,10.578947368421053 +112,14.666666666666666 +113,27.344827586206897 +114,0.058823529411764705 +115,27.523809523809526 +116,0.0 +117,18.46153846153846 +118,0.6341463414634146 +119,15.958333333333334 +120,28.8 +122,11.818181818181818 +123,23.333333333333332 +124,18.636363636363637 +125,26.708333333333332 +127,13.619047619047619 +128,18.727272727272727 +129,16.52 +130,22.48780487804878 +131,17.333333333333332 +132,3.6666666666666665 +134,24.20689655172414 +135,20.304347826086957 +136,24.58823529411765 +138,17.956521739130434 +139,3.4347826086956523 +140,7.175 +141,0.0 +142,8.6 +144,34.875 +145,0.0 +146,15.45 +147,4.375 +148,3.5555555555555554 +149,0.0 +150,13.0625 +151,19.846153846153847 +152,0.08571428571428572 +153,14.647058823529411 +154,31.391304347826086 +155,33.583333333333336 +156,24.38095238095238 +157,4.882352941176471 +159,12.0 +160,26.545454545454547 +161,2.263157894736842 +162,30.857142857142858 +163,3.5789473684210527 +164,14.13953488372093 +165,16.571428571428573 +166,14.0 +167,7.75 +168,12.84 +169,4.5 +170,0.1 +172,9.023809523809524 +174,13.2 +175,19.482758620689655 +176,10.411764705882353 +177,12.8 +178,23.181818181818183 +179,4.15 +180,0.0 +181,21.153846153846153 +182,4.041666666666667 +183,10.619047619047619 +184,24.833333333333332 +185,25.625 +186,4.0 +190,32.57142857142857 +192,22.27027027027027 +193,19.285714285714285 +194,9.571428571428571 +195,26.3125 +196,16.951219512195124 +197,17.972972972972972 +198,20.02173913043478 +199,26.59375 +200,10.68 +201,19.941176470588236 +202,2.217391304347826 +203,18.7 +204,23.035714285714285 +205,12.333333333333334 +206,25.685714285714287 +207,14.08 +208,22.733333333333334 +209,21.482758620689655 +210,19.511111111111113 +211,21.608695652173914 +212,19.8 +213,19.608695652173914 +214,15.71875 +215,21.833333333333332 +216,19.78787878787879 +217,18.681818181818183 +218,19.848484848484848 +219,21.347826086956523 +220,20.225 +221,17.91891891891892 +222,25.741935483870968 +223,15.894736842105264 +224,17.65909090909091 +225,22.541666666666668 +226,10.826086956521738 +227,29.48 +228,19.275862068965516 +229,22.733333333333334 +230,21.323529411764707 +231,27.46875 +232,27.724137931034484 +233,27.24137931034483 +234,20.454545454545453 +235,21.227272727272727 +236,16.25925925925926 +237,24.53125 +238,3.2325581395348837 +239,32.857142857142854 +240,21.647058823529413 +241,20.340425531914892 +242,19.0 +243,12.114285714285714 +244,9.954545454545455 +245,10.0 +246,19.95 +247,21.583333333333332 +248,20.652173913043477 +249,19.2 +250,10.055555555555555 +251,4.518518518518518 +252,19.61904761904762 +253,13.178571428571429 +254,22.454545454545453 +255,26.2 +256,23.6 +257,19.475 +258,22.0 +259,10.25 +260,22.03448275862069 +261,14.925925925925926 +262,24.103448275862068 +263,13.25 +264,12.766666666666667 +265,3.25 +266,27.0 +267,20.444444444444443 +268,24.03125 +269,26.74074074074074 +270,22.106382978723403 +271,28.75 +272,6.888888888888889 +273,18.285714285714285 +274,6.973684210526316 +275,27.764705882352942 +277,26.344827586206897 +278,28.208333333333332 +279,7.166666666666667 +280,17.166666666666668 +281,24.205882352941178 +282,19.4 +283,12.722222222222221 +284,22.76923076923077 +285,21.11111111111111 +287,20.93103448275862 +288,3.9565217391304346 +289,25.764705882352942 +290,15.892857142857142 +291,26.571428571428573 +292,28.47826086956522 +293,12.703703703703704 +294,5.12 +295,21.58695652173913 +296,7.6 +297,7.32258064516129 +298,20.771428571428572 +299,21.148936170212767 +300,0.0 +301,17.31578947368421 +302,19.4 +303,15.82857142857143 +304,20.705882352941178 +305,16.73076923076923 +306,25.161290322580644 +307,17.0 +308,20.322580645161292 +309,0.0 +310,19.88 +311,12.23076923076923 +313,29.576923076923077 +314,22.416666666666668 +315,30.192307692307693 +316,21.192307692307693 +317,13.482758620689655 +319,12.588235294117647 +320,27.0 +321,8.875 +322,15.36 +323,6.0 +324,14.875 +325,2.6176470588235294 +326,22.106382978723403 +327,20.137931034482758 +329,16.22222222222222 +330,20.76595744680851 +331,22.106382978723403 +332,13.5 +333,6.0 +334,14.666666666666666 +335,21.295454545454547 +336,20.452380952380953 +337,9.705882352941176 +338,23.636363636363637 +339,1.9615384615384615 +340,17.681818181818183 +341,30.076923076923077 +342,21.57894736842105 +343,18.647058823529413 +344,13.916666666666666 +345,22.106382978723403 +347,17.15625 +348,7.538461538461538 +349,15.68 +350,14.32258064516129 +351,22.106382978723403 +352,18.02127659574468 +353,9.055555555555555 +354,18.333333333333332 +355,19.022727272727273 +356,19.864864864864863 +357,21.146341463414632 +358,25.59259259259259 +359,10.242424242424242 +360,7.6 +361,12.74074074074074 +362,14.128205128205128 +363,20.24 +364,2.41025641025641 +365,18.166666666666668 +366,20.612903225806452 +367,9.886363636363637 +368,14.615384615384615 +369,17.655172413793103 +370,24.05263157894737 +371,6.928571428571429 +372,23.441860465116278 +373,9.428571428571429 +374,15.771428571428572 +375,0.0 +376,7.780487804878049 +377,26.13157894736842 +378,27.58823529411765 +379,27.88888888888889 +380,15.205128205128204 +381,11.764705882352942 +382,21.185185185185187 +383,19.058823529411764 +384,25.103448275862068 +385,19.466666666666665 +386,19.414634146341463 +387,20.926829268292682 +388,16.55 +389,13.361702127659575 +390,17.484848484848484 +392,20.08823529411765 +393,21.105263157894736 +394,0.0 +395,0.0 +396,0.92 +397,1.0833333333333333 +398,22.897435897435898 +399,21.608695652173914 +400,23.384615384615383 +401,33.25 +402,15.151515151515152 +403,27.5 +405,24.025641025641026 +406,3.948717948717949 +407,8.217391304347826 +408,33.10526315789474 +409,17.638297872340427 +411,24.973684210526315 +412,25.642857142857142 +415,0.0 +416,8.909090909090908 +417,19.74074074074074 +418,20.825 +419,17.142857142857142 +420,14.973684210526315 +421,3.872340425531915 +422,3.588235294117647 +423,17.11904761904762 +424,10.117647058823529 +425,19.638297872340427 +426,25.095238095238095 +427,12.176470588235293 +428,32.10526315789474 +429,11.736842105263158 +430,17.025 +431,21.448275862068964 +433,26.210526315789473 +434,6.326086956521739 +435,19.775 +436,21.4375 +437,18.05128205128205 +438,17.685714285714287 +439,30.73913043478261 +440,6.791666666666667 +441,11.461538461538462 +442,20.5531914893617 +443,18.375 +444,22.2 +445,25.115384615384617 +446,21.153846153846153 +447,19.65714285714286 +448,23.35135135135135 +449,3.347826086956522 +450,3.3 +451,21.58695652173913 +452,28.454545454545453 +453,7.410256410256411 +454,15.473684210526315 +455,16.575 +456,0.0 +457,3.1621621621621623 +458,18.5 +459,15.625 +460,17.238095238095237 +461,16.642857142857142 +462,3.5555555555555554 +463,17.294117647058822 +464,0.0 +465,9.0 +466,6.526315789473684 +467,13.555555555555555 +468,13.413793103448276 +469,5.644444444444445 +470,6.0 +471,11.125 +472,21.25 +473,20.59090909090909 +474,4.357142857142857 +476,21.58695652173913 +477,14.6 +478,15.67741935483871 +480,7.423076923076923 +481,10.75 +482,21.17391304347826 +483,3.4285714285714284 +484,2.4857142857142858 +485,1.8157894736842106 +486,23.863636363636363 +487,7.115384615384615 +488,20.475 +490,18.0 +491,17.5 +492,8.333333333333334 +493,36.5 +494,13.8 +495,17.25 +497,22.333333333333332 +498,4.538461538461538 +499,19.869565217391305 +500,16.714285714285715 +501,14.11111111111111 +502,6.043478260869565 +504,22.310344827586206 +506,2.7222222222222223 +507,10.114285714285714 +508,38.0 +509,0.0 +511,4.333333333333333 +512,28.2 +513,1.5 +514,3.45 +515,6.342105263157895 +516,1.303030303030303 +517,13.333333333333334 +518,20.77777777777778 +519,13.714285714285714 +520,19.444444444444443 +521,11.840909090909092 +522,7.541666666666667 +523,37.5 +524,4.625 +525,7.0 +526,0.0 +527,17.166666666666668 +528,22.106382978723403 +529,7.4 +530,11.175 +531,32.25 +532,11.833333333333334 +533,7.9 +534,22.75 +535,12.0 +536,18.5 +537,23.6 +538,1.0810810810810811 +539,16.0 +541,9.075 +542,1.0714285714285714 +543,4.571428571428571 +544,6.0 +545,21.857142857142858 +546,8.11111111111111 +547,0.0 +549,20.59090909090909 +551,8.44 +553,8.5 +554,20.613636363636363 +555,1.1136363636363635 +556,10.545454545454545 +557,17.11111111111111 +558,14.030303030303031 +559,0.0 +561,27.666666666666668 +562,10.294117647058824 +563,5.9375 +564,21.11111111111111 +566,0.0 +567,10.181818181818182 +568,14.625 +569,15.075 +570,18.52173913043478 +571,5.285714285714286 +572,22.069767441860463 +573,0.0 +574,17.96 +575,0.3 +576,6.0 +577,16.555555555555557 +578,0.0 +579,16.0 +580,23.5 +581,0.0 +582,0.0 +583,21.0 +584,10.428571428571429 +586,0.0 +588,0.0 +589,8.117647058823529 +590,6.054054054054054 +591,12.777777777777779 +592,0.0 +593,31.166666666666668 +594,34.5 +595,11.0 +597,0.0 +598,27.454545454545453 +599,27.75 +600,12.8 +601,0.0 +602,9.25 +603,3.6 +604,8.4 +605,9.571428571428571 +606,26.833333333333332 +607,9.25 +608,15.857142857142858 +610,1.2758620689655173 +613,3.75 +614,4.0 +615,8.0 +616,0.0 +617,15.0 +618,12.0 +619,2.161290322580645 +621,35.833333333333336 +622,24.46153846153846 +624,21.2 +625,18.0 +627,0.5714285714285714 +628,17.586206896551722 +629,0.0 +630,8.2 +647,16.586206896551722 +648,22.333333333333332 +649,17.928571428571427 +650,37.0 +651,27.071428571428573 +652,16.24390243902439 +653,23.305555555555557 +654,11.25531914893617 +656,10.27659574468085 +657,7.523809523809524 +658,21.914893617021278 +660,1.0 +661,8.222222222222221 +664,7.829787234042553 +665,10.043478260869565 +666,16.0 +668,18.666666666666668 +669,22.106382978723403 +670,9.97872340425532 +671,22.666666666666668 +672,7.583333333333333 +673,19.545454545454547 +674,4.1063829787234045 +675,12.382978723404255 +676,16.53191489361702 +677,4.191489361702128 +678,6.285714285714286 +679,19.333333333333332 +680,17.545454545454547 +681,23.096774193548388 +683,21.58695652173913 +684,19.24137931034483 +685,1.7272727272727273 +686,31.666666666666668 +687,20.105263157894736 +688,0.0 +689,2.0 +690,10.97872340425532 +691,11.064516129032258 +692,20.52 +693,17.363636363636363 +694,10.106382978723405 +695,13.533333333333333 +696,6.127659574468085 +697,17.934782608695652 +698,13.538461538461538 +700,14.130434782608695 +701,7.739130434782608 +702,2.0 +703,6.0212765957446805 +704,22.56 +705,20.76595744680851 +706,25.210526315789473 +707,2.869565217391304 +709,0.02127659574468085 +710,4.413043478260869 +711,23.944444444444443 +712,8.91304347826087 +713,3.723404255319149 +714,7.872340425531915 +715,0.2127659574468085 +716,36.0 +717,12.042553191489361 +718,22.106382978723403 +720,7.48936170212766 +721,36.5 +722,10.170212765957446 +723,19.72340425531915 +724,18.085106382978722 +725,2.5106382978723403 +727,11.565217391304348 +728,35.5 +729,29.214285714285715 +730,21.76595744680851 +731,20.29787234042553 +732,0.0 +733,20.4 +734,8.444444444444445 +735,10.6 +736,2.3617021276595747 +737,1.1 +738,16.3 +739,7.2 +742,14.11111111111111 +743,21.19148936170213 +744,7.875 +745,10.76595744680851 +746,21.76595744680851 +747,20.8125 +748,26.68421052631579 +749,8.212765957446809 +750,24.5 +751,9.27659574468085 +752,2.7142857142857144 +754,7.638297872340425 +755,0.0 +756,15.333333333333334 +757,19.085106382978722 +758,9.277777777777779 +759,25.0 +760,31.45 +761,5.191489361702128 +762,13.928571428571429 +763,24.125 +764,2.4 +766,0.0 +767,18.097560975609756 +768,14.875 +769,8.5 +770,5.48936170212766 +771,0.08695652173913043 +772,36.9 +773,0.0 +774,19.95744680851064 +775,29.0 +776,6.808510638297872 +777,4.361702127659575 +778,1.9361702127659575 +779,22.04255319148936 +780,19.285714285714285 +781,13.736842105263158 +782,3.6382978723404253 +783,7.0212765957446805 +784,8.41304347826087 +785,3.2127659574468086 +786,36.0 +787,1.7173913043478262 +788,4.195652173913044 +789,7.48936170212766 +791,15.829787234042554 +792,0.02127659574468085 +794,39.5 +795,0.2826086956521739 +796,0.02127659574468085 +797,0.02127659574468085 +798,22.106382978723403 +799,23.42105263157895 +800,7.595744680851064 +801,12.333333333333334 +802,6.340425531914893 +803,4.0212765957446805 +804,15.222222222222221 +806,2.3191489361702127 +807,3.2777777777777777 +808,22.106382978723403 +810,11.5 +811,6.48936170212766 +812,20.823529411764707 +813,1.2708333333333333 +814,27.235294117647058 +815,12.212765957446809 +816,11.382978723404255 +817,22.666666666666668 +818,0.021739130434782608 +819,2.595744680851064 +820,2.6818181818181817 +821,19.285714285714285 +822,25.25 +823,2.0 +824,4.260869565217392 +825,11.76595744680851 +826,9.717391304347826 +827,0.3125 +828,0.0 +829,4.659574468085107 +830,0.10638297872340426 +831,25.0 +832,6.565217391304348 +833,0.0 +834,26.0 +835,21.133333333333333 +836,13.777777777777779 +837,9.225 +840,12.909090909090908 +841,20.26086956521739 +842,1.2380952380952381 +843,12.0 +845,4.795454545454546 +846,14.923076923076923 +847,23.771428571428572 +848,0.022727272727272728 +849,6.363636363636363 +850,10.391304347826088 +851,15.75 +852,18.488372093023255 +853,0.1 +854,28.04 +855,13.552631578947368 +856,12.837837837837839 +857,11.129032258064516 +858,16.25 +859,17.404761904761905 +860,14.794117647058824 +861,14.714285714285714 +862,13.666666666666666 +863,19.142857142857142 +866,19.72 +875,17.0 +876,19.35483870967742 +877,14.5 +878,15.0 +879,23.14814814814815 +880,22.17391304347826 +881,16.02857142857143 +882,20.09090909090909 +887,6.6 +889,9.0 +891,10.65 +892,0.9 +893,19.5 +894,20.5 +895,0.0 +896,2.0 +897,20.5 +898,12.12 +900,4.117647058823529 +901,20.5 +902,8.047619047619047 +903,13.894736842105264 +904,18.59259259259259 +906,7.2 +907,0.0 +908,19.5 +909,21.875 +910,12.45 +911,12.76 +912,19.52 +913,0.0 +914,0.0 +915,7.4 +916,12.481481481481481 +917,17.694444444444443 +918,16.236842105263158 +919,10.424242424242424 +920,18.225806451612904 +921,0.47619047619047616 +922,2.2758620689655173 +924,18.533333333333335 +925,7.3125 +926,14.681818181818182 +927,4.125 +928,0.26666666666666666 +929,12.172413793103448 +930,26.22222222222222 +932,16.48 +933,15.333333333333334 +934,3.25 +935,10.210526315789474 +936,15.666666666666666 +937,13.666666666666666 +938,17.805555555555557 +939,21.96153846153846 +940,13.4375 +941,18.916666666666668 +942,9.882352941176471 +944,9.45 +945,17.256410256410255 +946,14.058823529411764 +947,7.777777777777778 +948,22.0625 +949,10.434782608695652 +950,10.882352941176471 +951,17.08823529411765 +952,20.6 +953,17.5 +954,3.391304347826087 +955,21.555555555555557 +956,0.13636363636363635 +957,2.1666666666666665 +959,0.09090909090909091 +960,0.047619047619047616 +961,0.0 +962,4.6923076923076925 +963,14.93939393939394 +964,18.0 +965,7.368421052631579 +966,0.8484848484848485 +968,9.722222222222221 +970,17.514285714285716 +972,13.518518518518519 +973,17.555555555555557 +974,16.166666666666668 +975,17.333333333333332 +976,14.266666666666667 +977,11.26086956521739 +978,14.972972972972974 +979,11.666666666666666 +980,0.0 +981,17.35483870967742 +982,5.625 +983,2.411764705882353 +984,5.6 +988,17.08108108108108 +989,9.513513513513514 +990,0.0 +991,24.5 +992,17.08108108108108 +993,0.0 +994,9.114285714285714 +995,8.0 +996,8.162162162162161 +998,0.0 +999,19.142857142857142 +1001,18.0 +1004,19.142857142857142 +1005,13.777777777777779 +1006,19.346153846153847 +1009,10.75 +1010,5.764705882352941 +1020,1.5 +1023,18.0 +1024,13.3 +1025,0.6666666666666666 +1028,11.11111111111111 +1029,12.2 +1031,17.0 +1032,7.5 +1033,0.0 +1034,18.928571428571427 +1035,7.666666666666667 +1036,11.222222222222221 +1037,13.4 +1038,17.0 +1040,13.416666666666666 +1041,8.444444444444445 +1042,22.23076923076923 +1046,17.4 +1047,13.5 +1048,18.5 +1049,3.5454545454545454 +1050,0.0 +1051,7.264705882352941 +1052,1.1 +1053,15.5 +1054,15.5 +1055,8.071428571428571 +1056,3.8 +1057,15.090909090909092 +1058,0.0 +1059,11.478260869565217 +1060,16.88888888888889 +1061,4.2 +1062,10.285714285714286 +1063,11.64 +1064,20.8 +1065,13.5 +1066,14.586206896551724 +1067,11.055555555555555 +1068,7.0476190476190474 +1069,13.521739130434783 +1070,13.61111111111111 +1071,3.206896551724138 +1072,20.40909090909091 +1073,0.5769230769230769 +1074,10.333333333333334 +1075,15.08695652173913 +1076,12.263157894736842 +1077,14.785714285714286 +1078,17.294117647058822 +1079,14.714285714285714 +1080,18.80952380952381 +1081,13.090909090909092 +1082,19.95 +1083,16.526315789473685 +1084,13.956521739130435 +1085,15.875 +1086,19.846153846153847 +1087,18.5 +1088,11.058823529411764 +1089,24.928571428571427 +1090,13.736842105263158 +1091,7.4 +1092,9.75 +1093,19.833333333333332 +1094,13.0 +1095,15.928571428571429 +1096,9.8 +1097,6.684210526315789 +1098,10.0 +1099,18.11111111111111 +1100,19.41176470588235 +1101,17.846153846153847 +1102,14.88 +1103,13.318181818181818 +1104,15.636363636363637 +1105,16.607142857142858 +1106,12.0 +1107,8.696969696969697 +1108,19.571428571428573 +1109,18.318181818181817 +1110,11.333333333333334 +1111,10.0 +1112,7.484848484848484 +1113,15.5 +1114,16.0 +1115,15.222222222222221 +1116,5.484848484848484 +1117,15.5 +1118,16.75 +1119,15.875 +1120,7.454545454545454 +1121,12.875 +1122,16.1875 +1123,13.121212121212121 +1126,10.933333333333334 +1127,17.263157894736842 +1128,14.92 +1129,8.0 +1130,10.35 +1131,7.357142857142857 +1132,16.44 +1133,14.1 +1134,17.14814814814815 +1135,14.89655172413793 +1136,16.26923076923077 +1137,11.35 +1138,12.0 +1139,13.636363636363637 +1141,16.5 +1142,15.636363636363637 +1143,13.866666666666667 +1144,15.75 +1145,16.0 +1146,2.4545454545454546 +1147,14.115384615384615 +1148,16.0 +1149,14.785714285714286 +1150,18.44 +1151,16.321428571428573 +1152,16.333333333333332 +1153,3.2857142857142856 +1154,9.25 +1155,8.823529411764707 +1156,18.0 +1157,12.944444444444445 +1158,11.105263157894736 +1159,3.75 +1162,18.2 +1165,0.0 +1166,13.548387096774194 +1167,0.125 +1168,14.517241379310345 +1169,14.096774193548388 +1174,0.0 +1175,0.8421052631578947 +1176,0.0 +1177,0.0 +1180,0.0 +1181,0.3333333333333333 +1183,12.931034482758621 +1187,1.2 +1188,0.3333333333333333 +1189,0.0 +1191,0.0 +1193,3.5 +1195,9.090909090909092 +1196,13.6 +1197,14.5 +1198,10.48 +1199,0.1 +1200,0.0 +1201,0.0 +1202,0.0 +1203,6.678571428571429 +1204,19.647058823529413 +1205,13.068965517241379 +1206,13.068965517241379 +1208,12.055555555555555 +1211,9.238095238095237 +1215,0.0 +1216,11.76923076923077 +1217,4.857142857142857 +1219,0.8 +1222,8.88888888888889 +1223,13.0 +1224,13.0 +1225,12.074074074074074 +1227,13.0 +1228,11.148148148148149 +1229,17.0 +1230,20.454545454545453 +1231,16.692307692307693 +1232,12.65 +1233,9.642857142857142 +1234,3.5 +1235,13.08 +1236,8.333333333333334 +1237,6.571428571428571 +1239,13.590909090909092 +1240,7.857142857142857 +1242,10.76923076923077 +1243,6.076923076923077 +1244,17.0 +1245,9.0 +1247,6.411764705882353 +1248,11.409090909090908 +1249,12.4 +1250,6.818181818181818 +1251,11.0 +1253,14.333333333333334 +1254,4.5 +1256,11.576923076923077 +1258,11.0 +1259,13.0 +1260,14.5 +1261,9.76923076923077 +1262,0.0 +1263,10.909090909090908 +1264,12.0 +1265,4.708333333333333 +1268,10.583333333333334 +1270,3.75 +1271,10.583333333333334 +1272,6.0 +1273,11.5 +1274,8.272727272727273 +1275,11.5 +1276,13.285714285714286 +1277,10.181818181818182 +1278,2.8666666666666667 +1279,0.75 +1280,8.333333333333334 +1282,9.0 +1284,15.23076923076923 +1285,10.869565217391305 +1286,8.142857142857142 +1287,10.5 +1289,13.8125 +1290,10.0 +1291,10.857142857142858 +1292,13.5 +1293,11.0 +1294,10.5 +1295,10.08695652173913 +1297,10.5 +1298,0.3076923076923077 +1300,0.0 +1301,7.375 +1302,6.7272727272727275 +1303,10.45 +1304,3.3636363636363638 +1305,10.5 +1306,9.047619047619047 +1307,8.5 +1308,9.625 +1309,1.2352941176470589 +1310,10.0 +1311,9.5 +1312,6.888888888888889 +1313,9.095238095238095 +1314,9.095238095238095 +1315,9.5 +1316,3.3333333333333335 +1317,6.05 +1318,10.0 +1319,3.3 +1320,2.6923076923076925 +1321,4.55 +1322,0.0 +1323,8.666666666666666 +1324,5.052631578947368 +1325,0.0 +1326,9.058823529411764 +1327,9.444444444444445 +1328,7.0588235294117645 +1329,10.375 +1331,3.7333333333333334 +1332,2.769230769230769 +1333,8.5 +1334,4.125 +1335,4.142857142857143 +1336,9.3 +1337,8.0 +1338,8.0 +1343,5.5 +1344,5.538461538461538 +1348,6.142857142857143 +1349,0.0 +1350,5.0 +1351,6.0 +1352,4.714285714285714 +1353,3.4615384615384617 +1354,8.0 +1355,1.2 +1356,7.0 +1357,6.75 +1358,4.066666666666666 +1359,4.25 +1360,11.0 +1361,7.0 +1363,6.642857142857143 +1364,1.9090909090909092 +1365,6.5 +1366,3.3333333333333335 +1367,7.0 +1368,4.5 +1369,7.0 +1370,7.0 +1371,7.0 +1372,4.583333333333333 +1373,6.933333333333334 +1374,7.0 +1376,6.818181818181818 +1377,3.2 +1378,3.909090909090909 +1379,3.2 +1380,5.25 +1381,5.6 +1383,5.363636363636363 +1384,6.933333333333334 +1385,5.923076923076923 +1386,7.0 +1387,6.153846153846154 +1388,2.066666666666667 +1390,7.5 +1391,13.0 +1393,7.0 +1394,2.8666666666666667 +1395,5.0 +1396,6.545454545454546 +1397,4.1 +1398,3.933333333333333 +1399,2.1 +1401,5.571428571428571 +1402,4.533333333333333 +1403,6.933333333333334 +1404,5.571428571428571 +1405,4.733333333333333 +1406,2.6 +1407,5.5 +1408,2.1333333333333333 +1409,6.571428571428571 +1410,3.375 +1411,1.8666666666666667 +1412,7.0 +1413,5.909090909090909 +1414,4.625 +1415,8.636363636363637 +1416,7.0 +1417,8.0 +1418,7.0 +1419,12.0 +1420,2.769230769230769 +1421,7.0 +1422,5.111111111111111 +1423,0.0 +1433,5.5 +1434,7.0 +1435,4.5 +1436,0.0 +1437,5.5 +1438,5.0 +1440,3.0 +1441,6.5 +1442,0.0 +1443,6.923076923076923 +1444,0.0 +1445,4.714285714285714 +1447,6.5 +1448,6.5 +1449,6.5 +1450,6.0 +1451,3.272727272727273 +1452,1.9090909090909092 +1453,1.625 +1454,3.2222222222222223 +1455,6.0 +1456,1.25 +1457,3.2 +1458,4.666666666666667 +1459,6.0 +1461,0.6153846153846154 +1462,5.5 +1463,5.5 +1464,0.0 +1465,0.0 +1466,5.5 +1467,3.25 +1468,5.0 +1469,0.5454545454545454 +1470,5.5 +1471,6.333333333333333 +1472,5.0 +1474,1.5454545454545454 +1475,0.0 +1476,4.5 +1477,5.0 +1478,4.714285714285714 +1479,2.6666666666666665 +1480,5.0 +1481,4.9 +1482,4.5 +1483,2.625 +1484,1.0 +1485,4.625 +1486,4.0 +1487,1.5 +1488,5.0 +1489,2.8 +1490,4.0 +1491,3.8 +1495,4.5 +1496,3.0 +1497,4.5 +1498,4.0 +1499,4.142857142857143 +1500,3.5714285714285716 +1501,2.5714285714285716 +1502,4.5 +1503,4.5 +1505,3.375 +1506,3.0 +1507,3.5 +1508,3.4285714285714284 +1509,1.6666666666666667 +1510,3.5 +1511,0.5 +1512,2.5 +1513,2.5 +1517,0.75 +1518,2.5 +1519,1.0 +1520,1.5 +1521,1.0 +1525,1.0 +1526,0.3333333333333333 +1527,1.0 +1528,1.0 +1530,0.0 +1531,1.0 +1532,1.0 +1537,1.5 +1538,0.3333333333333333 +1539,0.3333333333333333 +1540,1.0 +1541,0.5 +1545,0.0 +1546,0.0 +1550,0.0 +1551,0.0 diff --git a/src/mauro/vorbuchungsZeit.py b/src/mauro/vorbuchungsZeit.py index c0b6675..245c087 100644 --- a/src/mauro/vorbuchungsZeit.py +++ b/src/mauro/vorbuchungsZeit.py @@ -1,34 +1,115 @@ import data from data import etl_pipelines as ep import polars as pl +from datetime import datetime, timedelta +import pandas as pd ''' -#Create Data +# Get Data from DB inst = data.load() df = inst.extractions().pl() -df = ep.liveDates_Pipeline(df) +df = ep.expansion_Pipeline(df) -df.write_csv('dok/liveDates.csv') +df.write_csv('dok/flatDates.csv') print(df) ''' +''' +#Load Data from DF +dfLive = pl.read_csv('dok/liveDates.csv') +dfFlat = pl.read_csv('dok/flatDates.csv') -#Load Data -df = pl.read_csv('dok/liveDates.csv') -propIds = df.get_column('property_id').unique() +# Step 1 Get all occupied dates in live data +dfLive = dfLive.filter(pl.col("calendar_value") == 0) +dfLive = dfLive.with_columns(pl.col("created_at").str.to_date("%Y-%m-%d")) +dfLive = dfLive.with_columns(pl.col("calendar_date").str.to_date("%Y-%m-%d")) +#print(dfLive) -createdAt = df.get_column('created_at').unique() +dfFlat = dfFlat.with_columns(pl.col("created_at").str.to_date("%Y-%m-%d")) +dfFlat = dfFlat.with_columns(pl.col("calendar_date").str.to_date("%Y-%m-%d")) + +propIds = dfLive.get_column('property_id').unique() +createdAt = dfLive.get_column('created_at').unique() +#print(createdAt) + +fullPreorderMatrix = [] for propId in propIds: - for createdAt in createdAt: - temp = df.filter(pl.col("created_at") == createdAt) - temp = temp.filter(pl.col("property_id") == propId) - if temp.shape[0] > 0: - print(temp.get_column('calendar_value')[0]) - else: - print(0) + curPreorderList = [] + print("Property ID = " + str(propId)) + tempPropFlatDf = dfFlat.filter(pl.col("property_id") == propId) + tempPropLiveDf = dfLive.filter(pl.col("property_id") == propId) + allLiveOccupiedDates = tempPropLiveDf.filter(pl.col("calendar_value") == 0).get_column('created_at') + #print("allLiveOccupiedDates = ",allLiveOccupiedDates) + for date in allLiveOccupiedDates: + calLiveDate = tempPropLiveDf.filter(pl.col("created_at") == date).get_column('calendar_date')[0] + #print("Occupied Date = " + str(date), "with Calendar Date =", str(calLiveDate)) + numOfScrapedPreordered = 0 + foundLastDate = False + for createDate in createdAt: + if date > createDate: + #print("Finding Flat Date with CreateDate =",createDate, "and Calendar Date =", calLiveDate) + tempFlatDf = tempPropFlatDf.filter(pl.col("created_at") == createDate) + tempFlatDf = tempFlatDf.filter(pl.col("calendar_date") == calLiveDate) + #print("tempLiveDf = ", tempFlatDf) + + calVal = tempFlatDf.get_column('calendar_value') + if len(calVal) > 0: + if calVal[0] == 0: + # Still Occupied + if not foundLastDate: + numOfScrapedPreordered += 1 + else: + # Found last Date where not occupied + foundLastDate = True + #print("number of Scrapes already occupied =", numOfScrapedPreordered) + #break + #else: + #print("Skipped: Live Date = ",date, "Flat Date =",createDate) + #print(propId, date, numOfScrapedPreordered) + curPreorderList.append(numOfScrapedPreordered) + if len(curPreorderList) > 0: + mean = sum(curPreorderList) / len(curPreorderList) + else: mean = 0 + #fullPreorderMatrix.append([propId, mean, curPreorderList]) + fullPreorderMatrix.append([propId, mean]) + +print(fullPreorderMatrix) +fullPreoDF = pl.DataFrame(fullPreorderMatrix,orient="row") +fullPreoDF.write_csv('dok/fullPreoDF.csv') +print(fullPreoDF) +''' + +# Filter Props to locations and calculate Means per location +inst = data.load() + +propDf = inst.propIds_with_region().pl() +print(propDf) +propDf = propDf.select( + pl.col("id").cast(pl.Int64), + pl.col("seed_id").cast(pl.Int64), +) + +preoDF = pl.read_csv('dok/fullPreoDF.csv') +preoDF = preoDF.rename({"column_0": "id", "column_1": "meanPreorderScrapeNum"}) -#Hier weiter \ No newline at end of file +merge = preoDF.join(propDf, how='inner', on='id') +print(merge) + +print("Global meanPreorderTime = ",round(merge.get_column("meanPreorderScrapeNum").mean()*3,2)) + +# 1 = Heidiland +heidi = merge.filter(pl.col("seed_id") == 1) +print("Heidiland meanPreorderTime = ",round(heidi.get_column("meanPreorderScrapeNum").mean()*3,2)) +# 2 = Davos +Davos = merge.filter(pl.col("seed_id") == 2) +print("Davos meanPreorderTime = ",round(Davos.get_column("meanPreorderScrapeNum").mean()*3,2)) +# 3 = Engadin +Engadin = merge.filter(pl.col("seed_id") == 3) +print("Engadin meanPreorderTime = ",round(Engadin.get_column("meanPreorderScrapeNum").mean()*3,2)) +# 4 = St. Moritz +Moritz = merge.filter(pl.col("seed_id") == 4) +print("St. Moritz meanPreorderTime = ",round(Moritz.get_column("meanPreorderScrapeNum").mean()*3,2)) \ No newline at end of file