carolanderson commited on
Commit
e486b9e
·
1 Parent(s): e173ad1

remove Grader column when adding Graded column

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -77,6 +77,7 @@ def add_graded_column(df):
77
  if "Grader" in df:
78
  df["Graded"] = df['Grader'].apply(lambda x: add_grading_status(x))
79
  df["Graded"] = pd.Categorical(df["Graded"], categories = ["Yes", "No"]) # sets sort order
 
80
  else:
81
  st.warning('Input data must have a "Grader" column'
82
  ' in order to create a "Graded" column', icon="⚠️")
@@ -98,7 +99,6 @@ def add_multiple_column(df):
98
  @st.cache_data
99
  def add_first_and_last_name_columns(df):
100
  if "Player Name" in df:
101
- st.write("breaking up names")
102
  df['First Name'] = df['Player Name'].apply(lambda x: extract_surname(x)[0])
103
  df['Last Name'] = df['Player Name'].apply(lambda x: extract_surname(x)[-1])
104
  else:
@@ -126,10 +126,10 @@ if __name__ == "__main__":
126
  if st.checkbox('Create first name and last name columns'):
127
  df = add_first_and_last_name_columns(df)
128
 
129
- if st.checkbox('Add graded column'):
130
  df = add_graded_column(df)
131
 
132
- if st.checkbox('Create "multiple" column and remove quantity'):
133
  df = add_multiple_column(df)
134
 
135
  if st.checkbox("Change sort order"):
 
77
  if "Grader" in df:
78
  df["Graded"] = df['Grader'].apply(lambda x: add_grading_status(x))
79
  df["Graded"] = pd.Categorical(df["Graded"], categories = ["Yes", "No"]) # sets sort order
80
+ df = df.drop(columns=['Grader'])
81
  else:
82
  st.warning('Input data must have a "Grader" column'
83
  ' in order to create a "Graded" column', icon="⚠️")
 
99
  @st.cache_data
100
  def add_first_and_last_name_columns(df):
101
  if "Player Name" in df:
 
102
  df['First Name'] = df['Player Name'].apply(lambda x: extract_surname(x)[0])
103
  df['Last Name'] = df['Player Name'].apply(lambda x: extract_surname(x)[-1])
104
  else:
 
126
  if st.checkbox('Create first name and last name columns'):
127
  df = add_first_and_last_name_columns(df)
128
 
129
+ if st.checkbox('Add "Graded" column and remove "Grader" column'):
130
  df = add_graded_column(df)
131
 
132
+ if st.checkbox('Create "Multiple" column and remove "Quantity" column'):
133
  df = add_multiple_column(df)
134
 
135
  if st.checkbox("Change sort order"):