Skip to content

Commit

Permalink
workaround mysterious issue with x != x
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalita committed Feb 13, 2024
1 parent d58a8dc commit 6c194fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ def create_sidebar():
'SelectBoxes']['Player_Numbers']['options']
if len(st.session_state.debug_player_number_names):
# changed placeholder to player_number because when selectbox gets reset, possibly due to expander auto-collapsing, we don't want an unexpected value.
# test player_number is not None else use debug_favorites['SelectBoxes']['Player_Numbers']['placeholder']?
st.selectbox("Debug Player List", options=st.session_state.debug_player_number_names, placeholder=st.session_state.player_number, #.debug_favorites['SelectBoxes']['Player_Numbers']['placeholder'],
on_change=debug_player_number_names_change, key='debug_player_number_names_selectbox')

Expand Down
3 changes: 2 additions & 1 deletion chatlib/chatlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def clean_validate_df(df):
df.rename({'declarer':'Declarer_Direction'},axis='columns',inplace=True)

# Cleanup all sorts of columns. Create new columns where missing.
df.drop(df[df['Board'].isna()].index,inplace=True) # https://my.acbl.org/club-results/details/952514
df['Board'] = df['Board'].astype('uint8')
assert df['Board'].ge(1).all()

Expand Down Expand Up @@ -571,7 +572,7 @@ def clean_validate_df(df):
if df['Tricks'].isna().any():
print_to_log_info('NaN Tricks:\n',df[df['Tricks'].isna()][['Board','Contract','BidLvl','BidSuit','Dbl','Declarer_Direction','Score_NS','Score_EW','Tricks','Result','scores_l']])
df['Tricks'] = df['Tricks'].astype('UInt8')
assert df['Tricks'].map(lambda x: x is pd.NA or 0 <= x <= 13).all()
assert df['Tricks'].map(lambda x: (x != x) or (0 <= x <= 13)).all() # hmmm, x != x is the only thing which works? x is None and x is pd.NA does not work.

df['Round'].fillna(0,inplace=True) # player numbers are sometimes missing. fill with 0.

Expand Down

0 comments on commit 6c194fe

Please sign in to comment.