{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Savoir faire un calcul simple soi-même\n", "\n", "Calculer la moyenne et l'écart-type, le min, la médiane et le max des données suivantes :" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "11.511917811136218" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "mu, sigma = 0.0, 1.0\n", "x=np.random.normal(loc=11.5, scale=0.5, size=100)\n", "abs(np.mean(x))\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0833216722028933" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.std(x, ddof=1)) " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.734638689755644" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.min(x))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.9458688812984666" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.max(x))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "11.922677674564472" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.median(x))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }