bivariate', 'precise', 'node', 'linked', 'style=\"font-size105%backgroundtransparenttext-alignleftbackground#ddffdd\">information', '| compute', 'fastest', 'href=\"https//wwwmckinseyde/files/131007_pm_berlin_builds_businessespdf\"', 'href=\"/wiki/causality\"', 'physics', 'likely', 'id=\"div-gpt-ad-1456148316198-1\">', 'height=\"279\"', 'can', 'class=\"mw-selflink', 'reader', 'interwiki-pt\">distribution', 'src=\"//uploadwikimediaorg/wikipedia/commons/thumb/d/db/us_employment_statistics_-_march_2015png/250px-us_employment_statistics_-_march_2015png\"', 'narmax', 'marketplace', 'house', 'aware', 'activity', ' be', ' could', 'href=\"/schools/learningfuze\">learningfuzecontinue', 'placeholder=\"(optional)\"', 'brussels', 'profession', 'ವಿಶ್ಲೇಷಣೆ', 'href=\"/schools/coding-temple\">coding', 'york', 'class=\"h1\"', 'relations', 'href=\"http//wwwlinkedincom/in/joshua-matos1\">verified', 'hreflang=\"eo\"', 'class=\"col-xs-6\">legal- expectations', 'href=\"/schools\">schools
- coding', '150000', 'cs1-lock-registration', 'href=\"mailtoliz@coursereportcom?subject=flagged%3a%20ironhack%20%7c%20new%20way%20of%20learning%20%7c%20id%3a%2016334\">flag', '((outerheight', 'sector
', 'href=\"/schools/code-fellows\">code', 'hci', 'store', 'href=\"#practitioner_notes\">12/4/2017', 'corresponds', 'for=\"review_reviewer_anonymous\">review', 'contacted', 'href=\"/wiki/internal_consistency\"', 'class=\"review-date\">10/22/2018 data', 'here! if', 'companion', 'href=\"/wiki/infographic\"', 'class=\"tocnumber\">63', 'thank', 'style=\"width250px \">\n",
+ "\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sepal_length | \n",
+ " sepal_width | \n",
+ " petal_length | \n",
+ " petal_width | \n",
+ " iris_type | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 5.1 | \n",
+ " 3.5 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " Iris-setosa | \n",
+ " \n",
+ " \n",
+ " | 1 | \n",
+ " 4.9 | \n",
+ " 3.0 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " Iris-setosa | \n",
+ " \n",
+ " \n",
+ " | 2 | \n",
+ " 4.7 | \n",
+ " 3.2 | \n",
+ " 1.3 | \n",
+ " 0.2 | \n",
+ " Iris-setosa | \n",
+ " \n",
+ " \n",
+ " | 3 | \n",
+ " 4.6 | \n",
+ " 3.1 | \n",
+ " 1.5 | \n",
+ " 0.2 | \n",
+ " Iris-setosa | \n",
+ " \n",
+ " \n",
+ " | 4 | \n",
+ " 5.0 | \n",
+ " 3.6 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " Iris-setosa | \n",
+ " \n",
+ " \n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ " sepal_length sepal_width petal_length petal_width iris_type\n",
+ "0 5.1 3.5 1.4 0.2 Iris-setosa\n",
+ "1 4.9 3.0 1.4 0.2 Iris-setosa\n",
+ "2 4.7 3.2 1.3 0.2 Iris-setosa\n",
+ "3 4.6 3.1 1.5 0.2 Iris-setosa\n",
+ "4 5.0 3.6 1.4 0.2 Iris-setosa"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# Your code here:\n",
- "\n"
+ "iris.head()"
]
},
{
@@ -287,12 +405,42 @@
},
{
"cell_type": "code",
- "execution_count": 16,
- "metadata": {},
- "outputs": [],
+ "execution_count": 13,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\Users\\diego\\anaconda3\\lib\\site-packages\\numpy\\core\\fromnumeric.py:3438: FutureWarning: In a future version, DataFrame.mean(axis=None) will return a scalar mean over the entire DataFrame. To retain the old behavior, use 'frame.mean(axis=0)' or just 'frame.mean()'\n",
+ " return mean(axis=axis, dtype=dtype, out=out, **kwargs)\n",
+ "C:\\Users\\diego\\anaconda3\\lib\\site-packages\\numpy\\core\\fromnumeric.py:3438: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.\n",
+ " return mean(axis=axis, dtype=dtype, out=out, **kwargs)\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "sepal_length 4.86\n",
+ "sepal_width 3.28\n",
+ "petal_length 1.40\n",
+ "petal_width 0.20\n",
+ "dtype: float64"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# Your code here:\n",
- "\n"
+ "\n",
+ "np.mean(iris.head())\n",
+ "\n",
+ "# Saco el promedio de las columnas solicitadas. "
]
},
{
@@ -304,12 +452,38 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 14,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\Users\\diego\\anaconda3\\lib\\site-packages\\numpy\\core\\fromnumeric.py:3579: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.\n",
+ " return std(axis=axis, dtype=dtype, out=out, ddof=ddof, **kwargs)\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "sepal_length 0.185472\n",
+ "sepal_width 0.231517\n",
+ "petal_length 0.063246\n",
+ "petal_width 0.000000\n",
+ "dtype: float64"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# Your code here:\n",
- "\n"
+ "\n",
+ "np.std(iris.head())\n",
+ "\n",
+ "# Saco la desviacion estandar de las columnas solicitadas."
]
},
{
@@ -321,12 +495,95 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 15,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " sepal_length | \n",
+ " sepal_width | \n",
+ " petal_length | \n",
+ " petal_width | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 5.1 | \n",
+ " 3.5 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " \n",
+ " \n",
+ " | 1 | \n",
+ " 4.9 | \n",
+ " 3.0 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " \n",
+ " \n",
+ " | 2 | \n",
+ " 4.7 | \n",
+ " 3.2 | \n",
+ " 1.3 | \n",
+ " 0.2 | \n",
+ " \n",
+ " \n",
+ " | 3 | \n",
+ " 4.6 | \n",
+ " 3.1 | \n",
+ " 1.5 | \n",
+ " 0.2 | \n",
+ " \n",
+ " \n",
+ " | 4 | \n",
+ " 5.0 | \n",
+ " 3.6 | \n",
+ " 1.4 | \n",
+ " 0.2 | \n",
+ " \n",
+ " \n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ " sepal_length sepal_width petal_length petal_width\n",
+ "0 5.1 3.5 1.4 0.2\n",
+ "1 4.9 3.0 1.4 0.2\n",
+ "2 4.7 3.2 1.3 0.2\n",
+ "3 4.6 3.1 1.5 0.2\n",
+ "4 5.0 3.6 1.4 0.2"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# Your code here:\n",
- "\n"
+ "\n",
+ "iris_numeric = iris.select_dtypes(include='number')\n",
+ "iris_numeric.head()"
]
},
{
@@ -338,11 +595,11 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
- "def cm_to_in(x):\n",
+ "def cm_to_in(cm):\n",
" # This function takes in a numeric value in centimeters and converts it to inches\n",
" # Input: numeric value\n",
" # Output: float\n",
@@ -351,7 +608,8 @@
" # Sample Output: 0.393701\n",
" \n",
" # Your code here:\n",
- " "
+ " inches = cm * 0.393701\n",
+ " return inches"
]
},
{
@@ -363,12 +621,96 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 17,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " sepal_length | \n",
+ " sepal_width | \n",
+ " petal_length | \n",
+ " petal_width | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 2.007875 | \n",
+ " 1.377954 | \n",
+ " 0.551181 | \n",
+ " 0.07874 | \n",
+ " \n",
+ " \n",
+ " | 1 | \n",
+ " 1.929135 | \n",
+ " 1.181103 | \n",
+ " 0.551181 | \n",
+ " 0.07874 | \n",
+ " \n",
+ " \n",
+ " | 2 | \n",
+ " 1.850395 | \n",
+ " 1.259843 | \n",
+ " 0.511811 | \n",
+ " 0.07874 | \n",
+ " \n",
+ " \n",
+ " | 3 | \n",
+ " 1.811025 | \n",
+ " 1.220473 | \n",
+ " 0.590552 | \n",
+ " 0.07874 | \n",
+ " \n",
+ " \n",
+ " | 4 | \n",
+ " 1.968505 | \n",
+ " 1.417324 | \n",
+ " 0.551181 | \n",
+ " 0.07874 | \n",
+ " \n",
+ " \n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ " sepal_length sepal_width petal_length petal_width\n",
+ "0 2.007875 1.377954 0.551181 0.07874\n",
+ "1 1.929135 1.181103 0.551181 0.07874\n",
+ "2 1.850395 1.259843 0.511811 0.07874\n",
+ "3 1.811025 1.220473 0.590552 0.07874\n",
+ "4 1.968505 1.417324 0.551181 0.07874"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# Your code here:\n",
- "\n"
+ "\n",
+ "iris_inch = cm_to_in(iris_numeric)\n",
+ "\n",
+ "iris_inch.head()"
]
},
{
@@ -380,12 +722,12 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"# Define constant below:\n",
- "\n",
+ "error = 2\n",
"\n",
"def add_constant(x):\n",
" # This function adds a global constant to our input.\n",
@@ -393,7 +735,100 @@
" # Output: numeric value\n",
" \n",
" # Your code here:\n",
- " "
+ " fixed_value = x + error\n",
+ " return fixed_value"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " sepal_length | \n",
+ " sepal_width | \n",
+ " petal_length | \n",
+ " petal_width | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 7.1 | \n",
+ " 5.5 | \n",
+ " 3.4 | \n",
+ " 2.2 | \n",
+ " \n",
+ " \n",
+ " | 1 | \n",
+ " 6.9 | \n",
+ " 5.0 | \n",
+ " 3.4 | \n",
+ " 2.2 | \n",
+ " \n",
+ " \n",
+ " | 2 | \n",
+ " 6.7 | \n",
+ " 5.2 | \n",
+ " 3.3 | \n",
+ " 2.2 | \n",
+ " \n",
+ " \n",
+ " | 3 | \n",
+ " 6.6 | \n",
+ " 5.1 | \n",
+ " 3.5 | \n",
+ " 2.2 | \n",
+ " \n",
+ " \n",
+ " | 4 | \n",
+ " 7.0 | \n",
+ " 5.6 | \n",
+ " 3.4 | \n",
+ " 2.2 | \n",
+ " \n",
+ " \n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ " sepal_length sepal_width petal_length petal_width\n",
+ "0 7.1 5.5 3.4 2.2\n",
+ "1 6.9 5.0 3.4 2.2\n",
+ "2 6.7 5.2 3.3 2.2\n",
+ "3 6.6 5.1 3.5 2.2\n",
+ "4 7.0 5.6 3.4 2.2"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "iris_constant = add_constant(iris_numeric)\n",
+ "\n",
+ "iris_constant.head()"
]
},
{
@@ -407,7 +842,7 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -424,25 +859,18 @@
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your code here:\n",
"\n"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -456,7 +884,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.6"
+ "version": "3.9.12"
}
},
"nbformat": 4,
|