Update app.py
Browse files
app.py
CHANGED
|
@@ -377,21 +377,14 @@ def server(input, output, session):
|
|
| 377 |
'z0']
|
| 378 |
|
| 379 |
|
| 380 |
-
# Assuming `df` is your DataFrame and `features_table` contains column names as strings.
|
| 381 |
-
float_columns = [col for col in df.columns if df[col].dtype in [pl.Float32, pl.Float64]]
|
| 382 |
-
|
| 383 |
|
| 384 |
selection = [['pitcher_id','pitcher_name','batter_id','batter_name','pitcher_hand',
|
| 385 |
'batter_hand','balls','strikes','play_code','event_type','pitch_type','vaa','haa']+features_table+['tj_stuff_plus']]
|
| 386 |
|
| 387 |
|
| 388 |
-
# Applying the rounding only to float columns
|
| 389 |
-
rounded_selection = [
|
| 390 |
-
df[col].round(1) if col in float_columns else df[col] for col in selection
|
| 391 |
-
]
|
| 392 |
|
| 393 |
return render.DataGrid(
|
| 394 |
-
df.select(
|
| 395 |
row_selection_mode='multiple',
|
| 396 |
height=None,
|
| 397 |
width='fit-content',
|
|
|
|
| 377 |
'z0']
|
| 378 |
|
| 379 |
|
|
|
|
|
|
|
|
|
|
| 380 |
|
| 381 |
selection = [['pitcher_id','pitcher_name','batter_id','batter_name','pitcher_hand',
|
| 382 |
'batter_hand','balls','strikes','play_code','event_type','pitch_type','vaa','haa']+features_table+['tj_stuff_plus']]
|
| 383 |
|
| 384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
return render.DataGrid(
|
| 387 |
+
df.select(selection).to_pandas().round(1),
|
| 388 |
row_selection_mode='multiple',
|
| 389 |
height=None,
|
| 390 |
width='fit-content',
|