<jupyter_start><jupyter_text>Medidas de posição e dispersão Base de dados<jupyter_code>import numpy as np
import statistics
from scipy import stats
import math

dados = np.array([160,165,167,164,160,166,160,161,150,152,173,160,155,164,168,162,161,168,163,156,155,169,151,170,164,155,152,163,160,155,157,156,158,158,161,154,161,156,172,153])
dados = np.sort(dados)
dados<jupyter_output><empty_output><jupyter_text>Média aritmética simples<jupyter_code>dados.sum() / len(dados)
dados.mean()
statistics.mean(dados)<jupyter_output><empty_output><jupyter_text>Moda<jupyter_code>statistics.mode(dados)
stats.mode(dados)<jupyter_output><empty_output><jupyter_text>Mediana<jupyter_code>dados_impar = [150,151,152,152,153,154,155,155,155]<jupyter_output><empty_output><jupyter_text>Calculo manual (impar)<jupyter_code>posicao = len(dados_impar)/2
posicao
posicao = math.ceil(posicao)
posicao
dados_impar[posicao - 1]<jupyter_output><empty_output><jupyter_text>Calculo manual (par)<jupyter_code>posicao = len(dados) // 2
posicao
dados[posicao - 1], dados[posicao]
mediana = (dados[posicao - 1] + dados[posicao]) / 2
mediana<jupyter_output><empty_output><jupyter_text>Bibliotecas<jupyter_code>np.median(dados_impar), np.median(dados)
statistics.median(dados_impar), statistics.median(dados)<jupyter_output><empty_output><jupyter_text>Média aritmética ponderada<jupyter_code>notas = np.array([9,8,7,3])
pesos = np.array([1,2,3,4])
media_ponderada = (notas * pesos).sum() / pesos.sum()
media_ponderada
np.average(notas, weights=pesos)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1470019342359768, 'fraction_numerical': 0.1038039974210187, 'mean_word_length': 12.495652173913044, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '154185', 'license': 'CC0-1.0', 'n_tokens_mistral': 789, 'n_tokens_neox': 670, 'n_words': 69, 'path': 'medidas_de_posicao_e_dispersao.ipynb', 'repo_name': 'sales-victor/medidas_de_posicao_e_dispersao', 'size': '1551'}