a16z / nft-analyst-starter-pack

https://a16z.com/2022/03/18/nft-starter-pack-analyze-data-metadata-build-tools/
GNU Affero General Public License v3.0
461 stars 92 forks source link

Key error when crawling cryptopunks data #2

Closed williamchong closed 2 years ago

williamchong commented 2 years ago

I am trying to use this on 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB to crawl cryptopunks data However a key error was thrown when running Updating ETH prices...


Process started for contract address: 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB
Exporting token transfers...
Exporting logs...
Updating block-to-date mapping...
Updating ETH prices...
Traceback (most recent call last):
  File "/Users/william/nft-analyst-starter-pack/export_data.py", line 164, in <module>
    export_data()
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/william/nft-analyst-starter-pack/export_data.py", line 131, in export_data
    generate_sales_output(
  File "/Users/william/nft-analyst-starter-pack/core/generate_sales_output.py", line 41, in generate_sales_output
    transfers_df["date"] = transfers_df["block_number"].apply(
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/pandas/core/series.py", line 4433, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/pandas/core/apply.py", line 1082, in apply
    return self.apply_standard()
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/pandas/core/apply.py", line 1137, in apply_standard
    mapped = lib.map_infer(
  File "pandas/_libs/lib.pyx", line 2870, in pandas._libs.lib.map_infer
  File "/Users/william/nft-analyst-starter-pack/core/generate_sales_output.py", line 42, in <lambda>
    lambda x: date_blocks_df.iloc[date_blocks_df.index.get_loc(x)]["date"]
  File "/Users/william/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/interval.py", line 637, in get_loc
    raise KeyError(key)
KeyError: 3919706```
emlazzarin commented 2 years ago

There are two issues here. The first is that date_block_mapping.csv didn't have enough history, which is resolved by #5. The second is that this library only supports sales data from OpenSea right now. We have plans to add more sources.