Skip to content

Instantly share code, notes, and snippets.

@nogawanogawa
Last active October 18, 2021 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nogawanogawa/6c03cbf62337b18474491bc34f568ca1 to your computer and use it in GitHub Desktop.
Save nogawanogawa/6c03cbf62337b18474491bc34f568ca1 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "3f4a8df1",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from scipy import stats"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "031112a7",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>A</th>\n",
" <th>B</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>9.96</td>\n",
" <td>3.96</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3.76</td>\n",
" <td>5.76</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1.17</td>\n",
" <td>7.17</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>8.66</td>\n",
" <td>7.66</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5.25</td>\n",
" <td>9.25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>7.61</td>\n",
" <td>3.61</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>5.80</td>\n",
" <td>4.80</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>1.84</td>\n",
" <td>8.84</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>7.06</td>\n",
" <td>6.06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>9.40</td>\n",
" <td>4.40</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>2.99</td>\n",
" <td>1.99</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>9.30</td>\n",
" <td>8.30</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>9.01</td>\n",
" <td>9.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>4.24</td>\n",
" <td>1.24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>3.52</td>\n",
" <td>5.52</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>9.60</td>\n",
" <td>8.60</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>7.59</td>\n",
" <td>5.59</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>6.99</td>\n",
" <td>1.99</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>9.62</td>\n",
" <td>7.62</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>2.18</td>\n",
" <td>3.18</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" A B\n",
"0 9.96 3.96\n",
"1 3.76 5.76\n",
"2 1.17 7.17\n",
"3 8.66 7.66\n",
"4 5.25 9.25\n",
"5 7.61 3.61\n",
"6 5.80 4.80\n",
"7 1.84 8.84\n",
"8 7.06 6.06\n",
"9 9.40 4.40\n",
"10 2.99 1.99\n",
"11 9.30 8.30\n",
"12 9.01 9.01\n",
"13 4.24 1.24\n",
"14 3.52 5.52\n",
"15 9.60 8.60\n",
"16 7.59 5.59\n",
"17 6.99 1.99\n",
"18 9.62 7.62\n",
"19 2.18 3.18"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.DataFrame({'A': [9.96, 3.76, 1.17, 8.66, 5.25, 7.61, 5.80, 1.84, 7.06, 9.40, 2.99, 9.30, 9.01, 4.24, 3.52, 9.60, 7.59, 6.99, 9.62, 2.18], \n",
" 'B' : [3.96, 5.76, 7.17, 7.66, 9.25, 3.61, 4.80, 8.84, 6.06, 4.40, 1.99, 8.30, 9.01, 1.24, 5.52, 8.60, 5.59, 1.99, 7.62, 3.18]})\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "610d203a",
"metadata": {},
"outputs": [],
"source": [
"A = [0.0,5.0,29.0,3.0,4.0]\n",
"B = [9.0,4.0,5.0,6.0,4.0,2.0,3.0,1.0,2.0,4.0]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "950b28ec",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ttest_indResult(statistic=1.126091596043955, pvalue=0.28048607510982404)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stats.ttest_ind(A, B)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0e1984ae",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment