netflypsb commited on
Commit
f631d2a
·
verified ·
1 Parent(s): b6d1d8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,8 +8,8 @@ import matplotlib.pyplot as plt
8
  def load_data(file):
9
  df = pd.read_csv(file)
10
  df['Date of Birth'] = pd.to_datetime(df['Date of Birth'])
11
- df['Age'] = (pd.Timestamp.now() - df['Date of Birth']).astype('<m8[Y]')
12
  df['Visit Date'] = pd.to_datetime(df['Visit Date'])
 
13
  return df
14
 
15
  # Sidebar: Upload CSV file
@@ -105,7 +105,7 @@ if uploaded_file:
105
  new_patient_id = st.text_input("Patient ID")
106
  new_patient_name = st.text_input("Patient Name")
107
  new_dob = st.date_input("Date of Birth")
108
- new_age = (pd.Timestamp.now() - pd.to_datetime(new_dob)).days // 365
109
  new_gender = st.selectbox("Gender", ["Male", "Female", "Other"])
110
  new_med_history = st.text_area("Medical History")
111
  new_allergies = st.text_area("Allergies")
 
8
  def load_data(file):
9
  df = pd.read_csv(file)
10
  df['Date of Birth'] = pd.to_datetime(df['Date of Birth'])
 
11
  df['Visit Date'] = pd.to_datetime(df['Visit Date'])
12
+ df['Age'] = df['Date of Birth'].apply(lambda dob: (dt.datetime.now() - dob).days // 365)
13
  return df
14
 
15
  # Sidebar: Upload CSV file
 
105
  new_patient_id = st.text_input("Patient ID")
106
  new_patient_name = st.text_input("Patient Name")
107
  new_dob = st.date_input("Date of Birth")
108
+ new_age = (dt.datetime.now() - pd.to_datetime(new_dob)).days // 365
109
  new_gender = st.selectbox("Gender", ["Male", "Female", "Other"])
110
  new_med_history = st.text_area("Medical History")
111
  new_allergies = st.text_area("Allergies")