Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pmall
apli_pmall
Commits
17fa3fbf
Commit
17fa3fbf
authored
May 12, 2020
by
Samuel
Browse files
fix trailing pd.np
parent
52add09c
Changes
1
Show whitespace changes
Inline
Side-by-side
dashApp/app_demo.py
View file @
17fa3fbf
# -*- 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
import
dash_core_components
as
dcc
import
dash_html_components
as
html
...
...
@@ -6,11 +12,6 @@ import dash_bootstrap_components as dbc
# import dash_table_experiments as dt
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
...
...
@@ -43,7 +44,7 @@ map_station = {
"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)
...
...
@@ -352,7 +353,7 @@ def update_datatable(stations, species, sources, options, years_range):
base_var
=
BASE_VAR_SP
)
sp
=
sp
.
loc
[
sp
[
"Particle size"
].
isin
(
PMfraction
)]
# if not 'uselabels' in options:
# sp["Labels"] =
pd.
np.nan
# sp["Labels"] = np.nan
if
len
(
sources
)
!=
0
:
pmf
=
utilities
.
get_PMF_contrib
(
sources
,
where
=
"Station"
,
isin
=
stations_tmp
,
base_var
=
BASE_VAR_SRC
)
...
...
@@ -435,11 +436,11 @@ def update_ts_graph(datatable, species, sources, options):
dfdt
=
pd
.
DataFrame
(
datatable
)
if
not
'uselabel'
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
:
...
...
@@ -452,7 +453,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
...
...
@@ -503,7 +504,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
dfdt
=
pd
.
DataFrame
(
datatable
)
if
not
'uselabel'
in
options
:
dfdt
[
"Labels"
]
=
pd
.
np
.
nan
dfdt
[
"Labels"
]
=
np
.
nan
stations
=
dfdt
[
"Station"
].
unique
()
species
=
set
(
species
)
-
set
(
BASE_VAR_SP
)
-
set
(
notNumeric
)
...
...
@@ -630,7 +631,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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment