Drop files here
or click to upload
#! /usr/bin/env python3
import time
import pandas as pd
import datetime
import streamlit as st
# Create a Dataframe with random timestamps in the last 6 years
now = time.time()
times = [
now - 1, # 1 second ago
now - 2, # 2 seconds ago
now - 5, # 5 seconds ago
now - 60, # 1 minute ago
now - 60 * 2, # 2 minutes ago
now - 60 * 5, # 5 minutes ago
now - 60 * 60, # 1 hour ago
now - 60 * 60 * 2, # 2 hours ago
now - 60 * 60 * 5, # 5 hours ago
]
df = pd.DataFrame({'Delta': [datetime.datetime.now().astimezone() - pd.to_datetime(ts, unit='s', utc=True) for ts in times]})
print(df["Delta"].type)
# Sort the DataFrame by 'Delta' before displaying
# df.sort_values(by='Delta', inplace=True, ascending=False)
# st.set_page_config(layout='wide')
st.dataframe(df, use_container_width=True)
# main()
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?