Closed armgilles closed 3 years ago
Avec l'update de https://github.com/armgilles/vcub_keeper/commit/54b5c28fd67acb64d763255edb5158e3bb040c9b
Notebook : notebooks/02_Features/07_visualisation_map_stations #49.ipynb
Attention les données de station_control
sont simulées et provienne du projet vcub_watcher
.
plot_map_station_with_plotly(station_control=station_control, offline_plot=False)
# Focus sur une station particulière :
plot_map_station_with_plotly(station_control=station_control, offline_plot=False, station_id=6)
plot_map_station_with_kepler(station_control=station_control)
plot_map_station_with_kepler(station_control=station_control, station_id=6)
Prendre en compte dans le preprocess des données des graphiques les stations qui ne sont pas monitorer par les algos afin de pouvoir les afficher d'une certaine couleur (stations avec trop peu d'activités)
Faire attention pour les graphiques liés à KeplerGL
, car les couleurs sont liées à l'ordre dans le DataFrame. De plus s’il n'y a pas de station en anomalie ET/OU inactive, cela peut changer les couleurs de l'état de fonctionnement de la station sur le graphique.
Données de station_control
avec l'ajout des vélos dispo sur les stations en provenance du Back de `Vcub_watcher``
simulated_data="""station_id,mean_activity,is_anomaly,is_inactive,last_date_anomaly,anomaly_since,available_bikes
181,0.0,0,0,,,9
160,0.0,0,0,,,4
161,0.01,0,0,,,7
180,0.01,0,0,,,11
92,0.01,0,0,,,7
167,0.01,0,0,,,10
168,0.01,0,0,,,8
183,0.01,0,0,,,9
81,0.02,0,0,,,3
150,0.02,0,0,,,4
72,0.02,0,0,,,0
71,0.02,0,0,,,8
91,0.02,0,0,,,8
80,0.02,0,0,,,3
165,0.02,0,0,,,6
156,0.02,0,0,,,10
157,0.03,0,0,,,6
87,0.03,0,0,,,9
182,0.03,0,0,,,9
93,0.03,0,0,,,9
94,0.03,0,0,,,8
149,0.04,0,0,,,4
82,0.04,0,0,,,2
88,0.05,0,0,,,3
164,0.05,0,0,,,5
76,0.05,0,0,,,12
77,0.05,0,0,,,13
158,0.05,0,0,,,10
148,0.05,0,0,,,11
79,0.05,0,0,,,9
95,0.05,0,0,,,8
151,0.05,0,0,,,8
86,0.06,0,0,,,8
153,0.06,0,0,,,7
159,0.06,0,0,,,11
85,0.06,0,0,,,8
162,0.06,0,0,,,10
169,0.07,0,0,,,7
177,0.07,0,0,,,11
78,0.07,0,0,,,10
147,0.07,0,0,,,11
97,0.07,0,0,,,6
84,0.08,0,0,,,14
163,0.08,0,0,,,6
63,0.09,0,0,,,10
146,0.09,0,0,,,14
166,0.1,0,0,,,13
89,0.1,0,0,,,5
152,0.1,0,0,,,12
143,0.1,0,0,,,8
115,0.1,0,0,,,13
142,0.11,0,0,,,5
64,0.11,0,0,,,4
74,0.12,0,0,,,8
144,0.12,0,0,,,10
51,0.12,0,0,,,6
114,0.13,0,0,,,15
145,0.13,0,0,,,10
83,0.13,0,0,,,6
113,0.13,0,0,,,12
251,0.13,0,0,,,21
38,0.13,0,0,,,13
70,0.14,0,0,,,15
75,0.14,0,0,,,8
175,0.14,0,0,,,14
178,0.16,0,0,,,17
32,0.16,0,0,,,8
12,0.17,0,0,,,10
90,0.17,0,0,,,2
50,0.17,0,0,,,13
49,0.18,0,0,,,10
155,0.18,0,0,,,5
129,0.18,0,0,,,9
52,0.18,0,0,,,12
26,0.18,0,0,,,12
31,0.18,0,0,,,7
29,0.19,0,0,,,7
53,0.2,0,0,,,8
30,0.2,0,0,,,10
154,0.2,0,0,,,11
35,0.2,0,0,,,6
126,0.2,0,0,,,4
176,0.21,0,0,,,6
25,0.21,0,0,,,6
117,0.21,0,0,,,17
122,0.21,0,0,,,4
137,0.21,0,0,,,10
96,0.22,0,0,,,16
73,0.23,0,0,,,12
141,0.23,0,0,,,10
27,0.23,0,0,,,7
69,0.23,0,0,,,11
14,0.23,0,0,,,23
179,0.23,0,0,,,3
47,0.24,0,0,,,6
13,0.24,0,0,,,9
46,0.24,0,0,,,9
116,0.24,0,0,,,22
48,0.24,0,0,,,13
67,0.25,0,0,,,12
121,0.25,0,0,,,5
173,0.25,0,0,,,10
17,0.26,0,0,,,6
140,0.27,0,0,,,2
107,0.27,0,0,,,4
171,0.27,0,0,,,1
33,0.27,0,0,,,0
61,0.27,0,0,,,16
34,0.27,0,0,,,5
170,0.28,0,0,,,0
132,0.28,0,0,,,7
128,0.28,0,0,,,1
119,0.28,0,0,,,16
15,0.29,0,0,,,4
18,0.29,0,0,,,9
124,0.3,0,0,,,3
118,0.3,0,0,2021-04-09 06:50:00+02:00,,14
111,0.31,0,0,,,12
10,0.31,0,0,2021-04-08 07:50:00+02:00,,8
62,0.32,0,0,2021-04-09 07:10:00+02:00,,23
66,0.32,0,0,2021-04-09 07:50:00+02:00,,8
105,0.32,0,0,2021-04-09 05:50:00+02:00,,1
130,0.32,0,0,,,8
112,0.32,0,0,2021-04-08 10:50:00+02:00,,26
2,0.32,0,0,2021-04-09 10:40:00+02:00,,7
68,0.32,0,0,2021-04-08 11:50:00+02:00,,2
23,0.34,0,0,2021-04-08 07:40:00+02:00,,18
11,0.34,0,0,2021-04-08 08:20:00+02:00,,18
60,0.34,0,0,2021-04-08 13:20:00+02:00,,11
120,0.34,0,0,2021-04-08 07:20:00+02:00,,6
9,0.34,0,0,,,8
3,0.35,0,0,,,7
45,0.35,0,0,,,8
136,0.36,0,0,2021-04-08 07:50:00+02:00,,6
24,0.36,0,0,,,7
138,0.36,0,1,,,0
21,0.36,0,0,2021-04-09 08:10:00+02:00,,3
108,0.37,0,0,,,10
16,0.37,0,1,,,0
131,0.37,0,0,,,6
36,0.38,0,0,2021-04-08 07:20:00+02:00,,4
20,0.39,0,0,,,11
110,0.39,0,0,,,14
139,0.39,0,0,,,14
6,0.4,0,0,2021-04-09 08:30:00+02:00,,18
42,0.4,0,0,2021-04-09 07:40:00+02:00,,8
125,0.4,0,0,2021-04-09 09:50:00+02:00,,18
19,0.41,0,0,2021-04-09 09:40:00+02:00,,16
135,0.41,0,0,,,16
59,0.42,0,0,2021-04-09 09:50:00+02:00,,14
41,0.43,0,0,,,5
28,0.44,0,0,,,9
7,0.44,0,0,,,6
109,0.44,0,0,,,10
4,0.44,0,0,,,13
57,0.44,0,0,2021-04-09 08:20:00+02:00,,8
55,0.44,0,0,,,10
37,0.45,0,0,2021-04-09 09:30:00+02:00,,21
8,0.46,0,0,2021-04-08 07:40:00+02:00,,6
58,0.47,0,0,,,9
99,0.48,0,1,,,0
134,0.48,0,0,,,16
104,0.49,0,0,,,7
40,0.49,0,0,2021-04-08 05:40:00+02:00,,19
98,0.49,0,0,,,17
172,0.5,0,0,2021-04-08 10:50:00+02:00,,13
1,0.51,0,0,2021-04-08 10:00:00+02:00,,10
56,0.51,0,0,,,10
43,0.51,0,0,,,8
44,0.53,0,0,,,7
100,0.54,0,0,2021-04-08 08:10:00+02:00,,26
133,0.55,0,0,2021-04-08 07:50:00+02:00,,14
103,0.58,0,0,2021-04-09 08:50:00+02:00,,9
101,0.6,0,0,2021-04-09 08:50:00+02:00,,12
102,0.63,0,0,2021-04-09 07:30:00+02:00,,9
5,0.64,0,0,,,20
65,0.65,0,0,,,11
174,0.67,0,0,,,34
123,0.74,0,0,,,25
54,0.74,0,0,,,9
39,0.82,0,0,2021-04-09 07:30:00+02:00,,22
22,0.82,0,0,2021-04-08 07:30:00+02:00,,23
127,0.9,0,0,2021-04-08 07:20:00+02:00,,2
106,1.03,0,0,,,26
"""
13/04/21 9H30 :
station_id,mean_activity,is_anomaly,is_inactive,last_date_anomaly,anomaly_since,available_bikes
181,0.0,0,0,,,9
160,0.0,0,0,,,4
161,0.01,0,0,,,7
180,0.01,0,0,,,11
92,0.01,0,0,,,7
167,0.01,0,0,,,10
168,0.01,0,0,,,8
183,0.01,0,0,,,9
81,0.02,0,0,,,3
150,0.02,0,0,,,4
72,0.02,0,0,,,0
71,0.02,0,0,,,8
91,0.02,0,0,,,8
80,0.02,0,0,,,3
165,0.02,0,0,,,6
156,0.02,0,0,,,10
157,0.03,0,0,,,6
87,0.03,0,0,,,9
182,0.03,0,0,,,9
93,0.03,0,0,,,9
94,0.03,0,0,,,8
149,0.04,0,0,,,4
82,0.04,0,0,,,2
88,0.05,0,0,,,3
164,0.05,0,0,,,5
76,0.05,0,0,,,12
77,0.05,0,0,,,13
158,0.05,0,0,,,10
148,0.05,0,0,,,11
79,0.05,0,0,,,9
95,0.05,0,0,,,8
151,0.05,0,0,,,8
86,0.06,0,0,,,8
153,0.06,0,0,,,7
159,0.06,0,0,,,11
85,0.06,0,0,,,8
162,0.06,0,0,,,10
169,0.07,0,0,,,7
177,0.07,0,0,,,11
78,0.07,0,0,,,10
147,0.07,0,0,,,11
97,0.07,0,0,,,6
84,0.08,0,0,,,14
163,0.08,0,0,,,6
63,0.09,0,0,,,10
146,0.09,0,0,,,14
166,0.1,0,0,,,13
89,0.1,0,0,,,5
152,0.1,0,0,,,12
143,0.1,0,0,,,8
115,0.1,0,0,,,13
142,0.11,0,0,,,5
64,0.11,0,0,,,4
74,0.12,0,0,,,8
144,0.12,0,0,,,10
51,0.12,0,0,,,6
114,0.13,0,0,,,15
145,0.13,0,0,,,10
83,0.13,0,0,,,6
113,0.13,0,0,,,12
251,0.13,0,0,,,21
38,0.13,0,0,,,13
70,0.14,0,0,,,15
75,0.14,0,0,,,8
175,0.14,0,0,,,14
178,0.16,0,0,,,17
32,0.16,0,0,,,8
12,0.17,0,0,,,10
90,0.17,0,0,,,2
50,0.17,0,0,,,13
49,0.18,0,0,,,10
155,0.18,0,0,,,5
129,0.18,0,0,,,9
52,0.18,0,0,,,12
26,0.18,0,0,,,12
31,0.18,0,0,,,7
29,0.19,0,0,,,7
53,0.2,0,0,,,8
30,0.2,0,0,,,10
154,0.2,0,0,,,11
35,0.2,0,0,,,6
126,0.2,0,0,,,4
176,0.21,0,0,,,6
25,0.21,0,0,,,6
117,0.21,0,0,,,17
122,0.21,0,0,,,4
137,0.21,0,0,,,10
96,0.22,0,0,,,16
73,0.23,0,0,,,12
141,0.23,0,0,,,10
27,0.23,0,0,,,7
69,0.23,0,0,,,11
14,0.23,0,0,,,23
179,0.23,0,0,,,3
47,0.24,0,0,,,6
13,0.24,0,0,,,9
46,0.24,0,0,,,9
116,0.24,0,0,,,22
48,0.24,0,0,,,13
67,0.25,0,0,,,12
121,0.25,0,0,,,5
173,0.25,0,0,,,10
17,0.26,0,0,,,6
140,0.27,0,0,,,2
107,0.27,0,0,,,4
171,0.27,0,0,,,1
33,0.27,0,0,,,0
61,0.27,0,0,,,16
34,0.27,0,0,,,5
170,0.28,0,0,,,0
132,0.28,0,0,,,7
128,0.28,0,0,,,1
119,0.28,0,0,,,16
15,0.29,0,0,,,4
18,0.29,0,0,,,9
124,0.3,0,0,2021-04-11 11:30:00+02:00,,3
118,0.3,0,0,2021-04-13 07:50:00+02:00,,14
111,0.31,0,0,2021-04-11 13:10:00+02:00,,12
10,0.31,0,0,2021-04-10 11:50:00+02:00,,8
62,0.32,0,0,2021-04-13 08:10:00+02:00,,23
66,0.32,0,0,2021-04-12 08:20:00+02:00,,8
105,0.32,0,0,2021-04-13 08:30:00+02:00,,1
130,0.32,0,0,,,8
112,0.32,0,0,2021-04-13 08:10:00+02:00,,26
2,0.32,0,0,2021-04-13 07:20:00+02:00,,7
68,0.32,1,0,2021-04-13 09:20:00+02:00,2021-04-13 07:50:00+02:00,2
23,0.34,0,0,2021-04-12 07:30:00+02:00,,18
11,0.34,0,0,2021-04-12 08:20:00+02:00,,18
60,0.34,0,0,2021-04-10 10:30:00+02:00,,11
120,0.34,0,0,2021-04-11 05:50:00+02:00,,6
9,0.34,0,0,2021-04-12 07:40:00+02:00,,8
3,0.35,0,0,2021-04-11 11:10:00+02:00,,7
45,0.35,1,0,2021-04-13 09:20:00+02:00,2021-04-13 06:20:00+02:00,8
136,0.36,0,0,2021-04-11 11:50:00+02:00,,6
24,0.36,0,0,2021-04-12 07:10:00+02:00,,7
138,0.36,0,1,,,0
21,0.36,0,0,2021-04-09 08:10:00+02:00,,3
108,0.37,0,0,,,10
16,0.37,0,0,2021-04-12 05:50:00+02:00,,0
131,0.37,0,0,2021-04-12 07:10:00+02:00,,6
36,0.38,0,0,2021-04-11 11:10:00+02:00,,4
20,0.39,0,0,2021-04-10 10:50:00+02:00,,11
110,0.39,0,0,2021-04-13 08:10:00+02:00,,14
139,0.39,0,0,,,14
6,0.4,0,0,2021-04-12 09:30:00+02:00,,18
42,0.4,0,0,2021-04-12 08:50:00+02:00,,8
125,0.4,0,0,2021-04-12 10:10:00+02:00,,18
19,0.41,0,0,2021-04-09 09:40:00+02:00,,16
135,0.41,0,0,,,16
59,0.42,1,0,2021-04-13 09:20:00+02:00,2021-04-13 08:40:00+02:00,14
41,0.43,0,0,,,5
28,0.44,0,0,2021-04-12 09:00:00+02:00,,9
7,0.44,0,0,,,6
109,0.44,0,0,,,10
4,0.44,0,0,,,13
57,0.44,0,0,2021-04-09 08:20:00+02:00,,8
55,0.44,0,0,,,10
37,0.45,0,0,2021-04-12 08:30:00+02:00,,21
8,0.46,1,0,2021-04-13 09:20:00+02:00,2021-04-13 08:00:00+02:00,6
58,0.47,0,0,2021-04-13 08:40:00+02:00,,9
99,0.48,0,0,2021-04-10 13:20:00+02:00,,0
134,0.48,0,0,2021-04-12 09:30:00+02:00,,16
104,0.49,0,0,,,7
40,0.49,0,0,2021-04-12 05:50:00+02:00,,19
98,0.49,0,0,2021-04-13 06:50:00+02:00,,17
172,0.5,0,0,2021-04-10 10:30:00+02:00,,13
1,0.51,0,0,2021-04-11 10:40:00+02:00,,10
56,0.51,0,0,,,10
43,0.51,0,0,2021-04-12 06:30:00+02:00,,8
44,0.53,0,0,2021-04-12 09:00:00+02:00,,7
100,0.54,0,0,2021-04-12 08:20:00+02:00,,26
133,0.55,0,0,2021-04-13 07:50:00+02:00,,14
103,0.58,0,0,2021-04-11 10:20:00+02:00,,9
101,0.6,0,0,2021-04-12 08:50:00+02:00,,12
102,0.63,0,0,2021-04-12 08:30:00+02:00,,9
5,0.64,0,0,2021-04-10 09:30:00+02:00,,20
65,0.65,0,0,,,11
174,0.67,0,0,2021-04-12 06:20:00+02:00,,34
123,0.74,0,0,,,25
54,0.74,0,0,2021-04-11 09:50:00+02:00,,9
39,0.82,0,0,2021-04-12 06:50:00+02:00,,22
22,0.82,0,0,2021-04-08 07:30:00+02:00,,23
127,0.9,0,0,2021-04-12 06:50:00+02:00,,2
106,1.03,0,0,,,26
Avec plusieurs types de données simulées, les graphiques réagissent correctement.
Pour l'intégration des graphique dans vcub_watcher
(Cf https://github.com/armgilles/vcub_watcher/issues/35):
Erreur dans la vue global :
# Transform date to string
station_control['anomaly_since_str'] = \
station_control['anomaly_since'].dt.strftime(date_format='%Y-%m-%d %H:%M')
station_control['anomaly_since_str'] = station_control['anomaly_since_str'].fillna('-')
station_control
est modifié en amont (aide à l'affichage) pour le résultat suivant :
Si anomaly_since
est absent du DataFrame, utilisé la colonne En anomalie depuis
.
Permettre de retourner le graphique (de type Plotly) afin de pouvoir l'afficher dans le front (https://github.com/armgilles/vcub_watcher/issues/35).
Permettre d'augmenter la taille du graphique à partir de la fonction :
width
.height
.Done with previous commit.
Création d'une map afin de pouvoir :
station_control.csv
(dans vcub_watcher) :