cyberosa commited on
Commit
636b5d5
β€’
1 Parent(s): 16f8a8e

Updating tools accuracy csv file

Browse files
data/tools_accuracy.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8103fd33f62fd3080293e6b7677dde31efe71a5a9719fbdcf960d7323726e2c2
3
  size 1010
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54284b018d8ae7cb95406a376b2450da68b582e2ad427c88c671bbf10efd6051
3
  size 1010
notebooks/analysis.ipynb CHANGED
@@ -2617,7 +2617,7 @@
2617
  },
2618
  {
2619
  "cell_type": "code",
2620
- "execution_count": 47,
2621
  "metadata": {},
2622
  "outputs": [],
2623
  "source": [
@@ -2690,7 +2690,7 @@
2690
  },
2691
  {
2692
  "cell_type": "code",
2693
- "execution_count": 46,
2694
  "metadata": {},
2695
  "outputs": [
2696
  {
@@ -2701,23 +2701,61 @@
2701
  "Converting block number to timestamp\n"
2702
  ]
2703
  },
 
 
 
 
 
 
 
 
 
2704
  {
2705
  "ename": "NameError",
2706
- "evalue": "name 'ThreadPoolExecutor' is not defined",
2707
  "output_type": "error",
2708
  "traceback": [
2709
  "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
2710
  "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
2711
- "Cell \u001b[0;32mIn[46], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mweekly_analysis\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
2712
- "Cell \u001b[0;32mIn[45], line 28\u001b[0m, in \u001b[0;36mweekly_analysis\u001b[0;34m()\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m missing_time_indices\u001b[38;5;241m.\u001b[39mempty:\n\u001b[1;32m 25\u001b[0m partial_block_number_to_timestamp \u001b[38;5;241m=\u001b[39m partial(\n\u001b[1;32m 26\u001b[0m block_number_to_timestamp, web3\u001b[38;5;241m=\u001b[39mweb3\n\u001b[1;32m 27\u001b[0m )\n\u001b[0;32m---> 28\u001b[0m missing_timestamps \u001b[38;5;241m=\u001b[39m \u001b[43mparallelize_timestamp_conversion\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 29\u001b[0m \u001b[43m \u001b[49m\u001b[43mtools\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloc\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmissing_time_indices\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpartial_block_number_to_timestamp\u001b[49m\n\u001b[1;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 32\u001b[0m \u001b[38;5;66;03m# Update the original DataFrame with the missing timestamps\u001b[39;00m\n\u001b[1;32m 33\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, timestamp \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(missing_time_indices, missing_timestamps):\n",
2713
- "Cell \u001b[0;32mIn[41], line 16\u001b[0m, in \u001b[0;36mparallelize_timestamp_conversion\u001b[0;34m(df, function)\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Parallelize the timestamp conversion.\"\"\"\u001b[39;00m\n\u001b[1;32m 15\u001b[0m block_numbers \u001b[38;5;241m=\u001b[39m df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrequest_block\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mtolist()\n\u001b[0;32m---> 16\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mThreadPoolExecutor\u001b[49m(max_workers\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m10\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m executor:\n\u001b[1;32m 17\u001b[0m results \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(\n\u001b[1;32m 18\u001b[0m tqdm(executor\u001b[38;5;241m.\u001b[39mmap(function, block_numbers), total\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mlen\u001b[39m(block_numbers))\n\u001b[1;32m 19\u001b[0m )\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m results\n",
2714
- "\u001b[0;31mNameError\u001b[0m: name 'ThreadPoolExecutor' is not defined"
2715
  ]
2716
  }
2717
  ],
2718
  "source": [
 
 
 
 
 
 
 
 
 
2719
  "weekly_analysis()"
2720
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2721
  }
2722
  ],
2723
  "metadata": {
 
2617
  },
2618
  {
2619
  "cell_type": "code",
2620
+ "execution_count": 48,
2621
  "metadata": {},
2622
  "outputs": [],
2623
  "source": [
 
2690
  },
2691
  {
2692
  "cell_type": "code",
2693
+ "execution_count": 50,
2694
  "metadata": {},
2695
  "outputs": [
2696
  {
 
2701
  "Converting block number to timestamp\n"
2702
  ]
2703
  },
2704
+ {
2705
+ "name": "stderr",
2706
+ "output_type": "stream",
2707
+ "text": [
2708
+ " 0%| | 0/11690 [00:00<?, ?it/s]/var/folders/gp/02mb1d514ng739czlxw1lhh00000gn/T/ipykernel_28372/2484496282.py:9: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).\n",
2709
+ " timestamp = datetime.utcfromtimestamp(block[\"timestamp\"])\n",
2710
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 11690/11690 [01:40<00:00, 116.87it/s]\n"
2711
+ ]
2712
+ },
2713
  {
2714
  "ename": "NameError",
2715
+ "evalue": "name 'gc' is not defined",
2716
  "output_type": "error",
2717
  "traceback": [
2718
  "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
2719
  "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
2720
+ "Cell \u001b[0;32mIn[50], line 10\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpathlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Path\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfunctools\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m partial\n\u001b[0;32m---> 10\u001b[0m \u001b[43mweekly_analysis\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
2721
+ "Cell \u001b[0;32mIn[48], line 63\u001b[0m, in \u001b[0;36mweekly_analysis\u001b[0;34m()\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m fpmms\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m t_map\n\u001b[0;32m---> 63\u001b[0m \u001b[43mgc\u001b[49m\u001b[38;5;241m.\u001b[39mcollect()\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWeekly analysis files generated and saved\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
2722
+ "\u001b[0;31mNameError\u001b[0m: name 'gc' is not defined"
 
2723
  ]
2724
  }
2725
  ],
2726
  "source": [
2727
+ "import os\n",
2728
+ "import pickle\n",
2729
+ "from datetime import datetime\n",
2730
+ "from concurrent.futures import ThreadPoolExecutor\n",
2731
+ "from tqdm import tqdm\n",
2732
+ "from web3 import Web3\n",
2733
+ "import pandas as pd\n",
2734
+ "from pathlib import Path\n",
2735
+ "from functools import partial\n",
2736
  "weekly_analysis()"
2737
  ]
2738
+ },
2739
+ {
2740
+ "cell_type": "code",
2741
+ "execution_count": 51,
2742
+ "metadata": {},
2743
+ "outputs": [
2744
+ {
2745
+ "data": {
2746
+ "text/plain": [
2747
+ "1187"
2748
+ ]
2749
+ },
2750
+ "execution_count": 51,
2751
+ "metadata": {},
2752
+ "output_type": "execute_result"
2753
+ }
2754
+ ],
2755
+ "source": [
2756
+ "import gc\n",
2757
+ "gc.collect()"
2758
+ ]
2759
  }
2760
  ],
2761
  "metadata": {