I am learning python and trying to use plotly to visualize the daily speed results from my home internet. I am using an excel spreadsheet to import the date, as I am rounding the speed result into 15 minute increments.
Ultimately I am trying to use a line graph for each day, but when have only been able to create chart that is not readable as the timestamps on the X axis seem to repeat. I have tried multiple attempts using pandas group and plotly express line_group. (and others)
Here is my current attempt:
import plotly.graph_objs as go
import plotly.express as px
import pandas as pd
import matplotlib.pyplot as plt
Data
df = pd.read_excel(’/home/chesterreggie/log/speedtest1.xlsx’, index=“Q”, sheet_name=‘speedtest’, usecols = “C, K, Q”)
df[“Date”] = pd.to_datetime(df[“Date”])
#sort by rounddf.sort_values(by=“timeround”, ascending=True)
df.sort_values(by=“timeround”, ascending=True)
Plotly figure
fig = px.line(df, x=‘timeround’, y=‘DownSpeed’,
color=“Date”,
line_group=“Date”, hover_name=“Date”)
fig.update_layout(title=‘Download Speeds’ , showlegend=False)
#show plot
fig.show()
my current data frame: (this is coming from a pandas read_excel.
Date DownSpeed timeround
0 2020-03-28 5.76 17:45:00
1 2020-03-28 0.12 18:00:00
2 2020-03-28 0.35 19:00:00
3 2020-03-28 1.37 20:15:00
4 2020-03-28 1.89 21:00:00
… … … …
731 2020-04-09 249.70 09:30:00
732 2020-04-09 244.69 09:45:00
733 2020-04-09 177.70 10:00:00
734 2020-04-09 249.07 10:15:00
735 2020-04-09 236.01 10:30:00