{ "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": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.19060971305992105" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "mu, sigma = 0.0, 1.0\n", "x=np.random.normal(loc=0.0, scale=1.0, size=100)\n", "abs(np.mean(x))\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.5286189570282378" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.std(x, ddof=1)) " ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10.260400871034296" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.min(x))" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "12.87632983589094" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "abs(np.max(x))" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "11.520353885546612" ] }, "execution_count": 14, "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 }