This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests_html import AsyncHTMLSession | |
import pandas as pd | |
from unicodedata import normalize | |
url = 'https://www.flashscore.com/' | |
asession = AsyncHTMLSession() | |
async def get_scores(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from h2o_wave import main, app, Q, ui, handle_on, on, data | |
from loguru import logger | |
def on_startup(): | |
""" | |
Runs when the app is started, even if there are no browsers connected | |
:return: | |
""" | |
logger.info('http://localhost:10101/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import get | |
import threading | |
from time import sleep | |
from pandas import Series | |
from datetime import datetime | |
# Function get information in json format from Yahoo Finance | |
def stream( | |
symbol, | |
callback=None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
for line in sys.path: | |
if line.endswith('site-packages'): | |
print(line) | |
lib_path = line | |
file = os.path.join(lib_path, 'accurate_modules.pth') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script to generate the neww pandas logo | |
# MrEavesXLModOT-Bold font must be installed | |
import altair as alt | |
from pandas import DataFrame | |
source = DataFrame({ | |
'x': [1, 2, 2, 2, 3, 3, 3, 4], | |
'y': [0, 54.17, 119.6, 157.8, 13.73, 78.13, 116.17, 54.17], | |
'y2': [167.0, 105.37, 144.17, 209.0, 64.93, 102.7, 167.37, 221.17], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read_hst <- function(filename){ | |
library(anytime) | |
hst_file <- file(filename, "rb") | |
version <- readBin(hst_file, integer(), 1, size = 4, endian="little") | |
head <- readBin(hst_file, character(), 22, endian="little") | |
symbol <- head[22] | |
print(paste(symbol, "hst to dataframe")) | |
datetime <- c() | |
open <- c() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_hst(filename): | |
from pandas import DataFrame, to_datetime | |
from struct import unpack, calcsize, iter_unpack | |
bint = open(filename, 'rb').read() | |
head = unpack('<i64s12siiii', bint[:96]) | |
version = head[0] | |
symbol = head[2].decode("utf-8").split('\x00')[0] | |
start = 148 | |
if version == 401: | |
fmt = '<qddddqfq' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new_snippet(name, code): | |
'''Save a new snippet at json for Snippets nbextesion | |
Parameters | |
---------- | |
name : str | |
Name that will appear in the drop-down list | |
code : str | |
String containing the lines of code to be saved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import get | |
import threading | |
from time import sleep | |
# Función que usa un llamada para tomar la información en formato json de la api pública | |
def get_pi(callback=None, base='EUR', wait_time=1, verbose=False): | |
while True: | |
response = get( | |
f'https://api.piexchange.io/v1/public/instrument/ticker/PIT{base}') | |
info_dict = response.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pandas import read_excel, to_datetime | |
def read_vc_excel(io): | |
"""Read a xlxs file from Visualchart historical data patch | |
into a pandas DataFrame. | |
Parameters: | |
io : str, file descriptor, pathlib.Path, ExcelFile or xlrd.Book | |
The string could be a URL. Valid URL schemes include http, ftp, s3, | |
gcs, and file. For file URLs, a host is expected. For instance, a local | |
file could be /path/to/workbook.xlsx. |
NewerOlder