Giter Site home page Giter Site logo

dft.geckoHistorical('bitcoin') about defi HOT 3 OPEN

gauss314 avatar gauss314 commented on July 21, 2024
dft.geckoHistorical('bitcoin')

from defi.

Comments (3)

gauss314 avatar gauss314 commented on July 21, 2024

Es alguna actualizacion de pandas de tu anaconda local, por eso no tenes el error en colab, te sugiero abrir el anaconda prompt y ejecutar esto:

conda update --all

va a tardar 15 minutos pero luego de eso deberia andar bien

from defi.

gumartinez avatar gumartinez commented on July 21, 2024

Actualice conda y cuando corro

import yfinance as yf
import seaborn as sns
import numpy as np
import calendar
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib.colors import LinearSegmentedColormap
import pandas as pd
import seaborn as sns
pd.options.plotting.backend = "plotly"

cmap_jp = LinearSegmentedColormap.from_list('Custom', ('red','black','green'), N=256)

df = yf.download('GDX', auto_adjust=True, progress=False)
df = df.loc[df.index.year > 1980].copy()
df["Year"] = df.index.year
df["Month"] = df.index.month
df = df.resample('M').last()
df['variacion'] = df.Close.pct_change()
tabla = df.pivot_table(index="Year",columns="Month",values="variacion")
meses = [x[:3] for x in list(calendar.month_name[1:])]
tabla.columns = meses

plt.style.use('dark_background')
#plt.style.use('classic') """ https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html"""
fig = plt.figure(figsize=(20,12))
gs = GridSpec(nrows=3,ncols=2, figure=fig, width_ratios=[2.5,1], hspace=0.2, wspace=0.1, top=.9)
ax_l = fig.add_subplot(gs[:,0])
ax_r = [fig.add_subplot(gs[i,1]) for i in range(3)]

sc = lambda y: (y - y.min()) / (y.max() - y.min())
ax_r[0].bar(meses, tabla.mean(), color=cmap_jp(sc(tabla.mean())), label='Media', width=.7, edgecolor='gray')
ax_r[1].bar(meses, tabla.median(), color=cmap_jp(sc(tabla.median())), label = 'Mediana', width=.7, edgecolor='gray')
ax_r[2].bar(meses, tabla.kurt(), color=cmap_jp(sc(tabla.kurt())), label = 'Kurtosis', width=.7, edgecolor='gray')
[ax_r[i].legend(fontsize=12) for i in range(3)]
[ax_r[i].grid(alpha=.5) for i in range(3)]

sns.heatmap(tabla, annot=True, ax=ax_l, cmap=cmap_jp, fmt='.2%', vmax=0.15, vmin=-0.15, cbar_kws={"shrink": 0.6})
ax_l.set_title('SP500 Rendimientos Mensuales 1981-2021', fontsize=15)
print('\n')
plt.show()
print('\n')

El kernel se muere y no ejecuta, sin embargo otros codigos los corre sin problema

from defi.

gauss314 avatar gauss314 commented on July 21, 2024

Anda borrando lineas de abajo hacia arriba a ver cual es la conflictiva, es raro a mi me corre lo mas bien, seguro es alguna libreria en tu instalacion que te esta generando un conflicto

from defi.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.