Skip to content

Commit

Permalink
Fill NaN before manipulation (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPeloton authored Dec 7, 2023
1 parent f6fcc65 commit 1ab52cb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import io
import pandas as pd
import numpy as np
from gatspy import periodic
Expand Down Expand Up @@ -3184,8 +3185,9 @@ def plot_stat_evolution(pathname, param_name, switch):
)

# Format output in a DataFrame
pdf = pd.read_json(r.content)
pdf = pd.read_json(io.BytesIO(r.content))
pdf = pdf.set_index('key:key')
pdf = pdf.fillna(0)

pdf['date'] = [
Time(x[4:8] + '-' + x[8:10] + '-' + x[10:12]).datetime
Expand All @@ -3198,7 +3200,7 @@ def plot_stat_evolution(pathname, param_name, switch):
newcol = param_name.replace('class', 'SIMBAD')

if 1 in switch:
pdf[param_name] = pdf[param_name].fillna(0).astype(int).cumsum()
pdf[param_name] = pdf[param_name].astype(int).cumsum()
if param_name != 'basic:sci':
pdf['basic:sci'] = pdf['basic:sci'].astype(int).cumsum()
if 2 in switch:
Expand Down

0 comments on commit 1ab52cb

Please sign in to comment.