Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yogeshchappewar/0e46b844ab42abd4b0f1aa68c10fbfbd to your computer and use it in GitHub Desktop.
Save yogeshchappewar/0e46b844ab42abd4b0f1aa68c10fbfbd to your computer and use it in GitHub Desktop.
# finding mean,median,var and std using numpy
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# finding mean,median,var and std "
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:34:39.533479Z",
"end_time": "2022-12-28T07:34:39.717098Z"
},
"trusted": true
},
"cell_type": "code",
"source": "import numpy as np ",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:36:16.577654Z",
"end_time": "2022-12-28T07:36:16.594073Z"
},
"trusted": true
},
"cell_type": "code",
"source": "df = np.array([34,36,36,38,38,39,39,40,40,41,41,41,41,42,42,45,49,56])",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:36:19.814149Z",
"end_time": "2022-12-28T07:36:19.838256Z"
},
"trusted": true
},
"cell_type": "code",
"source": "df",
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 3,
"data": {
"text/plain": "array([34, 36, 36, 38, 38, 39, 39, 40, 40, 41, 41, 41, 41, 42, 42, 45, 49,\n 56])"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:38:10.652227Z",
"end_time": "2022-12-28T07:38:10.668060Z"
},
"trusted": true
},
"cell_type": "code",
"source": "df.mean()",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 4,
"data": {
"text/plain": "41.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:39:53.417201Z",
"end_time": "2022-12-28T07:39:53.425542Z"
},
"trusted": true
},
"cell_type": "code",
"source": "np.median(df)",
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 10,
"data": {
"text/plain": "40.5"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:40:25.219038Z",
"end_time": "2022-12-28T07:40:25.235292Z"
},
"trusted": true
},
"cell_type": "code",
"source": "df.var()",
"execution_count": 11,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 11,
"data": {
"text/plain": "24.11111111111111"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-12-28T07:40:36.827837Z",
"end_time": "2022-12-28T07:40:36.836339Z"
},
"trusted": true
},
"cell_type": "code",
"source": "df.std()",
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 12,
"data": {
"text/plain": "4.910306620885412"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.9.13",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "# finding mean,median,var and std using numpy",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment