rosacastillo commited on
Commit
d0991fd
·
1 Parent(s): 4ea95e9

converting datetime to str

Browse files
notebooks/invalid_markets.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 22,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
@@ -15,7 +15,7 @@
15
  },
16
  {
17
  "cell_type": "code",
18
- "execution_count": 9,
19
  "metadata": {},
20
  "outputs": [],
21
  "source": [
@@ -66,7 +66,7 @@
66
  },
67
  {
68
  "cell_type": "code",
69
- "execution_count": 12,
70
  "metadata": {},
71
  "outputs": [],
72
  "source": [
@@ -172,7 +172,7 @@
172
  },
173
  {
174
  "cell_type": "code",
175
- "execution_count": 23,
176
  "metadata": {},
177
  "outputs": [
178
  {
@@ -245,7 +245,7 @@
245
  "4 2024-05-24 64 3"
246
  ]
247
  },
248
- "execution_count": 23,
249
  "metadata": {},
250
  "output_type": "execute_result"
251
  }
@@ -255,6 +255,100 @@
255
  "daily_invalid_markets.head()"
256
  ]
257
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  {
259
  "cell_type": "code",
260
  "execution_count": 27,
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 2,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
 
15
  },
16
  {
17
  "cell_type": "code",
18
+ "execution_count": 3,
19
  "metadata": {},
20
  "outputs": [],
21
  "source": [
 
66
  },
67
  {
68
  "cell_type": "code",
69
+ "execution_count": 4,
70
  "metadata": {},
71
  "outputs": [],
72
  "source": [
 
172
  },
173
  {
174
  "cell_type": "code",
175
+ "execution_count": 10,
176
  "metadata": {},
177
  "outputs": [
178
  {
 
245
  "4 2024-05-24 64 3"
246
  ]
247
  },
248
+ "execution_count": 10,
249
  "metadata": {},
250
  "output_type": "execute_result"
251
  }
 
255
  "daily_invalid_markets.head()"
256
  ]
257
  },
258
+ {
259
+ "cell_type": "code",
260
+ "execution_count": 11,
261
+ "metadata": {},
262
+ "outputs": [
263
+ {
264
+ "name": "stdout",
265
+ "output_type": "stream",
266
+ "text": [
267
+ "<class 'pandas.core.frame.DataFrame'>\n",
268
+ "RangeIndex: 42 entries, 0 to 41\n",
269
+ "Data columns (total 3 columns):\n",
270
+ " # Column Non-Null Count Dtype \n",
271
+ "--- ------ -------------- ----- \n",
272
+ " 0 creation_date 42 non-null object\n",
273
+ " 1 trades_count 42 non-null int64 \n",
274
+ " 2 nr_markets 42 non-null int64 \n",
275
+ "dtypes: int64(2), object(1)\n",
276
+ "memory usage: 1.1+ KB\n"
277
+ ]
278
+ }
279
+ ],
280
+ "source": [
281
+ "daily_invalid_markets.info()"
282
+ ]
283
+ },
284
+ {
285
+ "cell_type": "code",
286
+ "execution_count": 12,
287
+ "metadata": {},
288
+ "outputs": [
289
+ {
290
+ "data": {
291
+ "text/plain": [
292
+ "datetime.date(2024, 5, 20)"
293
+ ]
294
+ },
295
+ "execution_count": 12,
296
+ "metadata": {},
297
+ "output_type": "execute_result"
298
+ }
299
+ ],
300
+ "source": [
301
+ "daily_invalid_markets.iloc[0].creation_date"
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "code",
306
+ "execution_count": 13,
307
+ "metadata": {},
308
+ "outputs": [
309
+ {
310
+ "name": "stdout",
311
+ "output_type": "stream",
312
+ "text": [
313
+ "<class 'pandas.core.frame.DataFrame'>\n",
314
+ "RangeIndex: 42 entries, 0 to 41\n",
315
+ "Data columns (total 3 columns):\n",
316
+ " # Column Non-Null Count Dtype \n",
317
+ "--- ------ -------------- ----- \n",
318
+ " 0 creation_date 42 non-null object\n",
319
+ " 1 trades_count 42 non-null int64 \n",
320
+ " 2 nr_markets 42 non-null int64 \n",
321
+ "dtypes: int64(2), object(1)\n",
322
+ "memory usage: 1.1+ KB\n"
323
+ ]
324
+ }
325
+ ],
326
+ "source": [
327
+ "\n",
328
+ "daily_invalid_markets[\"creation_date\"] = daily_invalid_markets[\"creation_date\"].astype(str)\n",
329
+ "daily_invalid_markets.info()"
330
+ ]
331
+ },
332
+ {
333
+ "cell_type": "code",
334
+ "execution_count": 14,
335
+ "metadata": {},
336
+ "outputs": [
337
+ {
338
+ "data": {
339
+ "text/plain": [
340
+ "'2024-05-20'"
341
+ ]
342
+ },
343
+ "execution_count": 14,
344
+ "metadata": {},
345
+ "output_type": "execute_result"
346
+ }
347
+ ],
348
+ "source": [
349
+ "daily_invalid_markets.iloc[0].creation_date"
350
+ ]
351
+ },
352
  {
353
  "cell_type": "code",
354
  "execution_count": 27,
tabs/invalid_markets.py CHANGED
@@ -28,7 +28,11 @@ def plot_daily_nr_invalid_markets(invalid_trades: pd.DataFrame):
28
  .agg(trades_count=("title", "count"), nr_markets=("title", "nunique"))
29
  .reset_index()
30
  )
 
 
 
31
  daily_invalid_markets.columns = daily_invalid_markets.columns.astype(str)
 
32
  return gr.LinePlot(
33
  value=daily_invalid_markets,
34
  x="creation_date",
 
28
  .agg(trades_count=("title", "count"), nr_markets=("title", "nunique"))
29
  .reset_index()
30
  )
31
+ daily_invalid_markets["creation_date"] = daily_invalid_markets[
32
+ "creation_date"
33
+ ].astype(str)
34
  daily_invalid_markets.columns = daily_invalid_markets.columns.astype(str)
35
+
36
  return gr.LinePlot(
37
  value=daily_invalid_markets,
38
  x="creation_date",