Commit 17fa3fbf authored by Samuel's avatar Samuel
Browse files

fix trailing pd.np

parent 52add09c
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import urllib
from datetime import datetime, timedelta
import sqlite3
import pandas as pd
import numpy as np
from dash.dependencies import Input, Output, State from dash.dependencies import Input, Output, State
import dash_core_components as dcc import dash_core_components as dcc
import dash_html_components as html import dash_html_components as html
...@@ -6,11 +12,6 @@ import dash_bootstrap_components as dbc ...@@ -6,11 +12,6 @@ import dash_bootstrap_components as dbc
# import dash_table_experiments as dt # import dash_table_experiments as dt
import plotly.graph_objs as go import plotly.graph_objs as go
import plotly.express as px 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 django.conf import settings
# from .server import app # from .server import app
...@@ -43,7 +44,7 @@ map_station = { ...@@ -43,7 +44,7 @@ map_station = {
"TAL": "Talence", "ROU": "Rouen", "NGT": "Nogent" "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"]) df["Date"] = pd.to_datetime(df["Date"])
# replace_QL(df) # replace_QL(df)
...@@ -352,7 +353,7 @@ def update_datatable(stations, species, sources, options, years_range): ...@@ -352,7 +353,7 @@ def update_datatable(stations, species, sources, options, years_range):
base_var=BASE_VAR_SP) base_var=BASE_VAR_SP)
sp = sp.loc[sp["Particle size"].isin(PMfraction)] sp = sp.loc[sp["Particle size"].isin(PMfraction)]
# if not 'uselabels' in options: # if not 'uselabels' in options:
# sp["Labels"] = pd.np.nan # sp["Labels"] = np.nan
if len(sources)!=0: if len(sources)!=0:
pmf = utilities.get_PMF_contrib(sources, where="Station", isin=stations_tmp, pmf = utilities.get_PMF_contrib(sources, where="Station", isin=stations_tmp,
base_var=BASE_VAR_SRC) base_var=BASE_VAR_SRC)
...@@ -435,11 +436,11 @@ def update_ts_graph(datatable, species, sources, options): ...@@ -435,11 +436,11 @@ def update_ts_graph(datatable, species, sources, options):
dfdt = pd.DataFrame(datatable) dfdt = pd.DataFrame(datatable)
if not 'uselabel' in options: if not 'uselabel' in options:
dfdt["Labels"] = pd.np.nan dfdt["Labels"] = np.nan
stations = dfdt["Station"].unique() stations = dfdt["Station"].unique()
# species = dfdt.columns # 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 # should never happen... but just in case
if "Date" not in dfdt.columns: if "Date" not in dfdt.columns:
...@@ -452,7 +453,7 @@ def update_ts_graph(datatable, species, sources, options): ...@@ -452,7 +453,7 @@ def update_ts_graph(datatable, species, sources, options):
for station in stations: for station in stations:
dftmp = dfdt[dfdt["Station"]==station] 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)): for toplot, var in zip(("species", "sources"), (species, sources)):
if len(var)==0: if len(var)==0:
continue continue
...@@ -503,7 +504,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species ...@@ -503,7 +504,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
dfdt = pd.DataFrame(datatable) dfdt = pd.DataFrame(datatable)
if not 'uselabel' in options: if not 'uselabel' in options:
dfdt["Labels"] = pd.np.nan dfdt["Labels"] = np.nan
stations = dfdt["Station"].unique() stations = dfdt["Station"].unique()
species = set(species) - set(BASE_VAR_SP) - set(notNumeric) species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
...@@ -630,7 +631,7 @@ def update_scatter_graph(datatable, tabselected, species, sources, options): ...@@ -630,7 +631,7 @@ def update_scatter_graph(datatable, tabselected, species, sources, options):
dfdt = pd.DataFrame(datatable) dfdt = pd.DataFrame(datatable)
if 'uselabel' not in options: if 'uselabel' not in options:
dfdt["Labels"] = pd.np.nan dfdt["Labels"] = np.nan
stations = list(dfdt["Station"].unique()) stations = list(dfdt["Station"].unique())
# species = set(species) - set(BASE_VAR_SP) - set(notNumeric) # species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
......
Supports Markdown
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