<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
pd.set_option('display.min_rows', 50)
pd.set_option('display.max_rows', 200)
def busca_carteira_teorica(indice):
  url = 'http://bvmf.bmfbovespa.com.br/indices/ResumoCarteiraTeorica.aspx?Indice={}&idioma=pt-br'.format(indice.upper())
  return pd.read_html(url, decimal=',', thousands='.', index_col='Código')[0][:-1]
ibov = busca_carteira_teorica('ibov')
ibov.sort_values('Part. (%)', ascending=False)
smll = busca_carteira_teorica('smll')
smll
ibrx = busca_carteira_teorica('ibrx')
ibrx
pd.concat([ibov, ibrx], keys=['IBOV', 'IBRX'], axis=1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1858267716535433, 'fraction_numerical': 0.012598425196850394, 'mean_word_length': 9.258064516129032, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '130938', 'license': 'MIT', 'n_tokens_mistral': 282, 'n_tokens_neox': 270, 'n_words': 32, 'path': '18_WebScraping_B3_Raspando_dados_da_Bolsa_de_Valores.ipynb', 'repo_name': 'alcebytes/python_para_investimentos', 'size': '635'}