hi community,
I want to write a program that gives me the options of reading a particular dataset from my local machine or reading it directly from the URL (data.world), but I got the error:
KeyError: 'order_date'
I understand this error is supposedly because there isn’t a column called order_date’ but I’m pretty sure there is. My code snippet:
import streamlit as st
import plotly.express as px
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
import plotly.figure_factory as ff
# file upload
fl = st.file_uploader(":file_folder: Upload a file", type=(["csv","txt","xlsx","xls"]))
if fl is not None:
filename = fl.name
st.write(filename)
df = pd.read_csv(filename, encoding = "ISO-8859-1")
else:
df = pd.read_excel('https://query.data.world/s/73qjpswpfbmeljx2k5ki6bbutw7qv6?dws=00000')
col1, col2 = st.columns((2))
df["order_date"] = pd.to_datetime(df["order_date"])
How do I resolve this, please?