Files
training.python.datascience/source/jupyter/numpy-random-data.ipynb

131 lines
2.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2023-11-03T14:40:42.068348908Z",
"start_time": "2023-11-03T14:40:41.997684480Z"
}
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"source": [
"## Générer des séquences avec Numpy"
],
"metadata": {
"collapsed": false
},
"id": "6d65456282534466"
},
{
"cell_type": "markdown",
"source": [
"### Tableaux de nombres aléatoires"
],
"metadata": {
"collapsed": false
},
"id": "adb17684a78c829f"
},
{
"cell_type": "code",
"execution_count": 6,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 6.35623608 0.72967602 2.5754436 ]\n",
" [-2.88764467 -1.78055093 2.04930599]\n",
" [ 8.1408593 9.88370176 13.06873958]\n",
" [12.10708755 9.83391867 1.11422918]\n",
" [ 1.93749749 8.25277919 12.33940067]\n",
" [ 9.29587924 10.28278442 7.00934509]\n",
" [10.95330272 2.24590563 2.6462974 ]\n",
" [ 7.82980317 10.88657225 6.50770094]]\n"
]
}
],
"source": [
"import numpy as np\n",
"normal1 = np.random.normal(scale=5.0, loc=5.0, size=(8, 3)) # loi Gaussienne, 3x3, de 0 à 10.0\n",
"print(normal1)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-03T14:44:17.624267987Z",
"start_time": "2023-11-03T14:44:17.582546621Z"
}
},
"id": "7790b82b0805c928"
},
{
"cell_type": "code",
"execution_count": 10,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1.14733876 4.66776332 0.07763899 0.41786323 4.55656594 2.6577\n",
" 0.08228448 0.47885595 7.58314882 0.12093808]\n"
]
}
],
"source": [
"pareto1 = np.random.pareto(1.0, size=10)\n",
"print(pareto1)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-03T15:00:09.010119456Z",
"start_time": "2023-11-03T15:00:08.985865113Z"
}
},
"id": "423db763dfe8266e"
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
},
"id": "9efd8f9a713c156a"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}