Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,17 +42,13 @@ workbook = client.open_by_key(sheet_id)
|
|
42 |
|
43 |
# Select the specific sheet in the workbook
|
44 |
sheet = workbook.worksheet("usdmHistory")
|
45 |
-
sheet2 = workbook.worksheet("LeaderBoard")
|
46 |
sheet3 = workbook.worksheet("Performance")
|
47 |
|
48 |
# Extract the data from the Google Sheet into a pandas DataFrame
|
49 |
data = sheet.get_all_values()
|
50 |
-
data2 = sheet2.get_all_values()
|
51 |
|
52 |
headers = data.pop(0)
|
53 |
-
headers2 = data2.pop(0)
|
54 |
df = pd.DataFrame(data, columns=headers)
|
55 |
-
df2 = pd.DataFrame(data2,columns=headers2)
|
56 |
|
57 |
|
58 |
|
@@ -84,8 +80,6 @@ def combine_chunks(df):
|
|
84 |
|
85 |
df = df.fillna(value=pd.NA)
|
86 |
df = df.where(pd.notnull(df), None)
|
87 |
-
df2 = df2.fillna(value=pd.NA)
|
88 |
-
df2 = df2.where(pd.notnull(df2), None)
|
89 |
|
90 |
|
91 |
df = combine_chunks(df)
|
@@ -101,7 +95,6 @@ def convert_str_to_list_or_keep(value):
|
|
101 |
return value
|
102 |
|
103 |
df = df.apply(lambda col: col.map(convert_str_to_list_or_keep))
|
104 |
-
df2 = df2.apply(lambda col: col.map(convert_str_to_list_or_keep))
|
105 |
|
106 |
df['positionClosed'] = False
|
107 |
|
@@ -375,19 +368,18 @@ if df is not None and uid_input:
|
|
375 |
unique_lists =[]
|
376 |
|
377 |
elif option == "Show Live Positions":
|
378 |
-
filtered_df2 = df2[df2['U_IDs'] == uid_input]
|
379 |
|
380 |
-
if not filtered_df2.empty:
|
381 |
|
382 |
-
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
|
392 |
|
393 |
|
|
|
42 |
|
43 |
# Select the specific sheet in the workbook
|
44 |
sheet = workbook.worksheet("usdmHistory")
|
|
|
45 |
sheet3 = workbook.worksheet("Performance")
|
46 |
|
47 |
# Extract the data from the Google Sheet into a pandas DataFrame
|
48 |
data = sheet.get_all_values()
|
|
|
49 |
|
50 |
headers = data.pop(0)
|
|
|
51 |
df = pd.DataFrame(data, columns=headers)
|
|
|
52 |
|
53 |
|
54 |
|
|
|
80 |
|
81 |
df = df.fillna(value=pd.NA)
|
82 |
df = df.where(pd.notnull(df), None)
|
|
|
|
|
83 |
|
84 |
|
85 |
df = combine_chunks(df)
|
|
|
95 |
return value
|
96 |
|
97 |
df = df.apply(lambda col: col.map(convert_str_to_list_or_keep))
|
|
|
98 |
|
99 |
df['positionClosed'] = False
|
100 |
|
|
|
368 |
unique_lists =[]
|
369 |
|
370 |
elif option == "Show Live Positions":
|
|
|
371 |
|
372 |
+
# if not filtered_df2.empty:
|
373 |
|
374 |
+
# positions_list = filtered_df2['Positions'].iloc[0] # Extract the first match
|
375 |
|
376 |
+
# # Convert the list of dictionaries to a DataFrame
|
377 |
+
# if isinstance(positions_list, list) and positions_list:
|
378 |
+
# positions_df = pd.DataFrame(positions_list)
|
379 |
+
# st.subheader("Live Positions")
|
380 |
+
# st.dataframe(positions_df)
|
381 |
+
# else:
|
382 |
+
# st.write("No live positions data available for the given U_ID.")
|
383 |
|
384 |
|
385 |
|