Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
moving data = pd.read_csv("https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/export?format=csv&gid=0") outside
Browse files
app.py
CHANGED
|
@@ -50,6 +50,7 @@ api = HfApi()
|
|
| 50 |
""""""
|
| 51 |
#csv_file = 'data.csv'
|
| 52 |
global_df = pd.DataFrame()
|
|
|
|
| 53 |
|
| 54 |
@bot.event
|
| 55 |
async def on_ready():
|
|
@@ -59,7 +60,7 @@ async def on_ready():
|
|
| 59 |
# testing sheet -> read -> paste sheet
|
| 60 |
|
| 61 |
"""import data from google sheets -> HF Space .csv (doesn't make API call this way, as it's read-only)"""
|
| 62 |
-
|
| 63 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
| 64 |
global_df = data
|
| 65 |
print(f"csv successfully retrieved: {global_df}")
|
|
@@ -324,7 +325,7 @@ async def xp_help(ctx):
|
|
| 324 |
|
| 325 |
""""""
|
| 326 |
def get_data():
|
| 327 |
-
first_3_columns =
|
| 328 |
first_3_columns.to_csv('first_3_columns.csv', index=False)
|
| 329 |
return first_3_columns
|
| 330 |
|
|
@@ -335,10 +336,10 @@ def get_data():
|
|
| 335 |
|
| 336 |
demo = gr.Blocks()
|
| 337 |
with demo:
|
| 338 |
-
column_values_unique = sorted(
|
| 339 |
dataframe2 = pd.DataFrame({'Levels': column_values_unique})
|
| 340 |
counts = {}
|
| 341 |
-
for value in
|
| 342 |
counts[value] = counts.get(value, 0) + 1
|
| 343 |
dataframe2['Members'] = dataframe2['Levels'].map(counts)
|
| 344 |
|
|
|
|
| 50 |
""""""
|
| 51 |
#csv_file = 'data.csv'
|
| 52 |
global_df = pd.DataFrame()
|
| 53 |
+
data = pd.read_csv("https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/export?format=csv&gid=0")
|
| 54 |
|
| 55 |
@bot.event
|
| 56 |
async def on_ready():
|
|
|
|
| 60 |
# testing sheet -> read -> paste sheet
|
| 61 |
|
| 62 |
"""import data from google sheets -> HF Space .csv (doesn't make API call this way, as it's read-only)"""
|
| 63 |
+
|
| 64 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
| 65 |
global_df = data
|
| 66 |
print(f"csv successfully retrieved: {global_df}")
|
|
|
|
| 325 |
|
| 326 |
""""""
|
| 327 |
def get_data():
|
| 328 |
+
first_3_columns = data.iloc[:, 1:4]
|
| 329 |
first_3_columns.to_csv('first_3_columns.csv', index=False)
|
| 330 |
return first_3_columns
|
| 331 |
|
|
|
|
| 336 |
|
| 337 |
demo = gr.Blocks()
|
| 338 |
with demo:
|
| 339 |
+
column_values_unique = sorted(data.iloc[:, 3].unique())
|
| 340 |
dataframe2 = pd.DataFrame({'Levels': column_values_unique})
|
| 341 |
counts = {}
|
| 342 |
+
for value in data.iloc[:, 3]:
|
| 343 |
counts[value] = counts.get(value, 0) + 1
|
| 344 |
dataframe2['Members'] = dataframe2['Levels'].map(counts)
|
| 345 |
|