<jupyter_start><jupyter_text><jupyter_code>import numpy as np
import pandas as pd
import requests
import json
from pprint import pprint
# Upload collections_list.xlsx to Colab
from google.colab import files

csv_file = files.upload()
# Read the collections_list.xlsx file from the Resources folder into a Pandas DataFrame
collections_df = pd.read_excel("collections_list.xlsx")

# Review the DataFrame
collections_df
#collection_list
collection_list = [x for x in collections_df['Name']]
#collection_list_two
collection_list_two = []
for i in collection_list:
  collection_list_two.append(i.replace(" ", "-"))
#collection_list_three
collection_list_three = []
for i in collection_list_two:
  collection_list_three.append(i.lower())
df = pd.DataFrame()
for collection in collection_list_three:
  
  url = "https://api.opensea.io/api/v1/assets?order_by=sale_count&order_direction=desc&offset=0&limit=50&collection=" + collection

  JSONContent = requests.get(url).json()

  content = json.dumps(JSONContent, indent = 2, sort_keys=True)

  JSONContent.keys()

  #assets = JSONContent["assets"]

  df = df.append(JSONContent["assets"])
#df
collection_df = df['collection'].apply(pd.Series)
#collection_df
collection_name = collection_df["name"].apply(pd.Series)
collection_name.columns = ['Collection Name']
#collection_name
last_sale_df = df['last_sale'].apply(pd.Series)
#last_sale_df
total_price = last_sale_df['total_price'].apply(pd.Series)
total_price.columns = ['Last Sale Price ETH']
total_price = total_price.astype(float)* 0.000000000000000001
total_price
payment_token_df = last_sale_df['payment_token'].apply(pd.Series)
#payment_token_df
#decimals = payment_token_df['decimals'].apply(pd.Series)
#decimals.columns = ['Decimal Scale']
#decimals
eth_price = payment_token_df['eth_price'].apply(pd.Series)
eth_price.columns = ['USD TO ETH']
eth_price.astype(float)
usd_price = payment_token_df['usd_price'].apply(pd.Series)
usd_price.columns = ['ETH TO USD']
usd_price.astype(float)

X = df[['name', 'id', 'token_id', 'num_sales']].copy()
X.columns = ['Asset Name', 'Asset ID', 'Token ID', 'Number of Sales']
#X = pd.concat([X, collection_name, total_price, eth_price, usd_price], axis = 1)
X = pd.concat([X, collection_name, total_price], axis = 1)
X
#X["total_price_usd"] = X["Last Sale Price ETH"] * X["ETH TO USD"]
#X["total_price_usd"]
#X["ETH TO USD"]
#X['LSP'] = X['Last Sale Price'].astype(float)
X
X['LSP'] = X['Last Sale Price'].astype(float)
X
X.dtypes(X)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14154338264694122, 'fraction_numerical': 0.010395841663334666, 'mean_word_length': 6.993610223642173, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '530796', 'license': 'MIT', 'n_tokens_mistral': 910, 'n_tokens_neox': 865, 'n_words': 186, 'path': 'collection_sales_data10_11.ipynb', 'repo_name': 'RJGiannini/nft-project-group8', 'size': '2501'}