Skip to content

Commit

Permalink
Suppress pandas scientific notification to facilitate data examination
Browse files Browse the repository at this point in the history
  • Loading branch information
corruptbear committed Mar 8, 2024
1 parent 70beafa commit 7ba6880
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions software/management/dashboard/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import pandas, pickle
import pandas as pd
import pickle
import numpy as np
from matplotlib.widgets import Slider
from matplotlib.widgets import TextBox
import textwrap
import re

# suppress the pandas scientific notation
pd.options.display.float_format = '{:.3f}'.format

# HELPER FUNCTIONS ----------------------------------------------------------------------------------------------------
def seconds_to_human_readable(seconds):
Expand Down Expand Up @@ -55,8 +58,9 @@ def extract_simple_event_log(logpath):

def load_data(filename):
with open(filename, 'rb') as file:
data = pandas.json_normalize(data=pickle.load(file))
return data.set_index('t').reindex(pandas.Series(np.arange(data.head(1)['t'].iloc[0], 1+data.tail(1)['t'].iloc[0]))).T \
data = pd.json_normalize(data=pickle.load(file))
print(data)
return data.set_index('t').reindex(pd.Series(np.arange(data.head(1)['t'].iloc[0], 1+data.tail(1)['t'].iloc[0]))).T \
if data is not None and len(data.index) > 0 else None

def plot_data(title, x_axis_label, y_axis_label, x_axis_data, y_axis_data):
Expand Down Expand Up @@ -90,7 +94,7 @@ def extract_ranging_time_series(data, destination_tottag_label, start_timestamp=
conversion_factor_from_mm = 1000.0
ranges = data.loc['r.' + destination_tottag_label] / conversion_factor_from_mm
ranges = ranges.mask(ranges > cutoff_distance)\
.reindex(pandas.Series(np.arange(start_timestamp if start_timestamp is not None else data.T.head(1).index[0],
.reindex(pd.Series(np.arange(start_timestamp if start_timestamp is not None else data.T.head(1).index[0],
end_timestamp if end_timestamp is not None else 1+data.T.tail(1).index[0])))
timestamps = mdates.date2num([datetime.fromtimestamp(ts) for ts in ranges.keys()])
return timestamps, ranges
Expand Down

0 comments on commit 7ba6880

Please sign in to comment.