Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 5592838f authored by Samuel's avatar Samuel
Browse files

import order + use numpy instead of pd.np

parent 329f5c90
# -*- coding: utf-8 -*-
import sqlite3
import pandas as pd
import numpy as np
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
......@@ -6,11 +9,6 @@ import dash_table as dt
import dash_bootstrap_components as dbc
import plotly.graph_objs as go
import plotly.express as px
import os
import urllib
import pandas as pd
import sqlite3
from datetime import datetime, timedelta
from django.conf import settings
# from .server import app
......@@ -34,12 +32,12 @@ conn.close()
map_station = {
"GRE": "GRE-fr", "MRS":"MRS-5av", # "PdB": "Port-de-bouc",
"STRAS": "STG-cle", "LEN": "Lens",
"POI": "Poitiers", "CHAM": "Chamonix", "LY": "Lyon", "NIC": "Nice",
"PROV": "Aix-en-provence", "RBX": "Roubaix", "REV": "Revin",
"POI": "Poitiers", "CHAM": "Chamonix", "LY": "Lyon", "NIC": "Nice",
"PROV": "Aix-en-provence", "RBX": "Roubaix", "REV": "Revin",
"TAL": "Talence", "ROU": "Rouen", "NGT": "Nogent"
}
df["Labels"].replace({"nan": pd.np.nan, "None": pd.np.nan}, inplace=True)
df["Labels"].replace({"nan": np.nan, "None": np.nan}, inplace=True)
df["Date"] = pd.to_datetime(df["Date"])
# replace_QL(df)
......@@ -74,7 +72,7 @@ minSample = 40
external_css = [
"/static/css/apps.css",
]
app = DjangoDash("app_PMall",
app = DjangoDash("app_PMall",
external_stylesheets=external_css,
)
......@@ -162,11 +160,9 @@ app.layout = dbc.Container(
external_css = [
# "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css",
app.get_asset_url("apps.css"), # litle hack to serve django css assets
]
print(app.get_asset_url("apps.css"))
for css in external_css:
app.css.append_css({"external_url": css})
......@@ -278,7 +274,7 @@ def update_selected_station(map4station, dropdown4station):
# no return. SELECTEDSTATION is a static variable
@app.callback(Output('station-dropdown', 'value'),
[Input('map-graph','clickData')],
[Input('map-graph', 'clickData')],
[State('station-dropdown', 'value')])
def update_dropdown_station_selected(values, stations):
update_selected_station(values, stations)
......@@ -446,11 +442,11 @@ def update_ts_graph(datatable, species, sources, options):
dfdt = pd.DataFrame(datatable)
if 'uselabel' not in options:
dfdt["Labels"] = pd.np.nan
dfdt["Labels"] = np.nan
stations = dfdt["Station"].unique()
# species = dfdt.columns
dfdt["Labels"].fillna(value=pd.np.nan, inplace=True)
dfdt["Labels"].fillna(value=np.nan, inplace=True)
# should never happen... but just in case
if "Date" not in dfdt.columns:
......@@ -463,7 +459,7 @@ def update_ts_graph(datatable, species, sources, options):
for station in stations:
dftmp = dfdt[dfdt["Station"]==station]
dftmp["Program_PMF"].replace({"None", pd.np.nan}, inplace=True)
dftmp["Program_PMF"].replace({"None", np.nan}, inplace=True)
for toplot, var in zip(("species", "sources"), (species, sources)):
if len(var)==0:
continue
......@@ -514,7 +510,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
dfdt = pd.DataFrame(datatable)
if 'uselabel' not in options:
dfdt["Labels"] = pd.np.nan
dfdt["Labels"] = np.nan
stations = dfdt["Station"].unique()
species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
......@@ -641,7 +637,7 @@ def update_scatter_graph(datatable, tabselected, species, sources, options):
dfdt = pd.DataFrame(datatable)
if 'uselabel' not in options:
dfdt["Labels"] = pd.np.nan
dfdt["Labels"] = np.nan
stations = list(dfdt["Station"].unique())
# species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
......
import sqlite3
from datetime import datetime
import pandas as pd
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
......@@ -5,13 +8,8 @@ import dash_table as dt
import plotly.graph_objs as go
import plotly.express as px
import sqlite3
from django.conf import settings
import pandas as pd
from datetime import datetime, timedelta
class SharedComponent():
"""Component shared by several app.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment