Пытаюсь загрузить ежедневную плату за майнинг биткойнов с помощью API Blockchain.com. Однако, несмотря на то, что график на веб-сайте показывает ежедневные данные, API предоставляет данные только за каждые 4 дня.
import requests
import pandas as pd
url = "https://api.blockchain.info/charts/tran ... ormat=json"
response = requests.get(url)
data = response.json()
df = pd.DataFrame(data['values'])
# Convert the timestamp to a readable format
df['x'] = pd.to_datetime(df['x'], unit='s') # 'x' is the Unix timestamp
df.set_index('x', inplace=True) # Set the datetime as the index
df.rename(columns={'y': 'fees'}, inplace=True) # Rename 'y' to 'hashrate'
print(df.head())
Я пытался адаптировать код для прокрутки 4D-окна и интерполяции, но при этом возникает довольно большая ошибка:
import requests
import pandas as pd
url = "https://api.blockchain.info/charts/tran ... ormat=json"
response = requests.get(url)
data = response.json()
df = pd.DataFrame(data['values'])
# Convert the timestamp to a readable format
df['x'] = pd.to_datetime(df['x'], unit='s')
df.set_index('x', inplace=True)
df.rename(columns={'y': 'fees'}, inplace=True) # Rename 'y' to 'hashrate'
df_daily = df.resample('D').interpolate(method='linear')
print(df_daily.head())
Подробнее здесь: https://stackoverflow.com/questions/790 ... ery-4-days
Blockchain API предоставляет мне данные только каждые 4 дня. ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Blockcypher сообщает, что транзакция прошла успешно, но не отображается в Blockchain Explorer
Anonymous » » в форуме Php - 0 Ответы
- 11 Просмотры
-
Последнее сообщение Anonymous
-