diff --git a/your-code/main.ipynb b/your-code/main.ipynb
index 999b648..779fbce 100644
--- a/your-code/main.ipynb
+++ b/your-code/main.ipynb
@@ -18,11 +18,435 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import mysql.connector\n",
+ "from getpass import getpass"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pd.set_option('display.max_columns', None)\n",
+ "# pd.set_option('display.max.rows', None)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "········\n"
+ ]
+ }
+ ],
+ "source": [
+ "cnx = mysql.connector.connect(user = \"root\",\n",
+ " password = getpass(),\n",
+ " host = \"localhost\",\n",
+ " database = \"sakila\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "True"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cnx.is_connected()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cursor = cnx.cursor()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
- "# your code here\n"
+ "query = (\"\"\"SELECT actor_id, first_name, last_name\n",
+ " FROM sakila.actor;\"\"\")\n",
+ "\n",
+ "cursor.execute(query)\n",
+ "\n",
+ "results = cursor.fetchall()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[(1, 'PENELOPE', 'GUINESS'),\n",
+ " (2, 'NICK', 'WAHLBERG'),\n",
+ " (3, 'ED', 'CHASE'),\n",
+ " (4, 'JENNIFER', 'DAVIS'),\n",
+ " (5, 'JOHNNY', 'LOLLOBRIGIDA'),\n",
+ " (6, 'BETTE', 'NICHOLSON'),\n",
+ " (7, 'GRACE', 'MOSTEL'),\n",
+ " (8, 'MATTHEW', 'JOHANSSON'),\n",
+ " (9, 'JOE', 'SWANK'),\n",
+ " (10, 'CHRISTIAN', 'GABLE'),\n",
+ " (11, 'ZERO', 'CAGE'),\n",
+ " (12, 'KARL', 'BERRY'),\n",
+ " (13, 'UMA', 'WOOD'),\n",
+ " (14, 'VIVIEN', 'BERGEN'),\n",
+ " (15, 'CUBA', 'OLIVIER'),\n",
+ " (16, 'FRED', 'COSTNER'),\n",
+ " (17, 'HELEN', 'VOIGHT'),\n",
+ " (18, 'DAN', 'TORN'),\n",
+ " (19, 'BOB', 'FAWCETT'),\n",
+ " (20, 'LUCILLE', 'TRACY'),\n",
+ " (21, 'KIRSTEN', 'PALTROW'),\n",
+ " (22, 'ELVIS', 'MARX'),\n",
+ " (23, 'SANDRA', 'KILMER'),\n",
+ " (24, 'CAMERON', 'STREEP'),\n",
+ " (25, 'KEVIN', 'BLOOM'),\n",
+ " (26, 'RIP', 'CRAWFORD'),\n",
+ " (27, 'JULIA', 'MCQUEEN'),\n",
+ " (28, 'WOODY', 'HOFFMAN'),\n",
+ " (29, 'ALEC', 'WAYNE'),\n",
+ " (30, 'SANDRA', 'PECK'),\n",
+ " (31, 'SISSY', 'SOBIESKI'),\n",
+ " (32, 'TIM', 'HACKMAN'),\n",
+ " (33, 'MILLA', 'PECK'),\n",
+ " (34, 'AUDREY', 'OLIVIER'),\n",
+ " (35, 'JUDY', 'DEAN'),\n",
+ " (36, 'BURT', 'DUKAKIS'),\n",
+ " (37, 'VAL', 'BOLGER'),\n",
+ " (38, 'TOM', 'MCKELLEN'),\n",
+ " (39, 'GOLDIE', 'BRODY'),\n",
+ " (40, 'JOHNNY', 'CAGE'),\n",
+ " (41, 'JODIE', 'DEGENERES'),\n",
+ " (42, 'TOM', 'MIRANDA'),\n",
+ " (43, 'KIRK', 'JOVOVICH'),\n",
+ " (44, 'NICK', 'STALLONE'),\n",
+ " (45, 'REESE', 'KILMER'),\n",
+ " (46, 'PARKER', 'GOLDBERG'),\n",
+ " (47, 'JULIA', 'BARRYMORE'),\n",
+ " (48, 'FRANCES', 'DAY-LEWIS'),\n",
+ " (49, 'ANNE', 'CRONYN'),\n",
+ " (50, 'NATALIE', 'HOPKINS'),\n",
+ " (51, 'GARY', 'PHOENIX'),\n",
+ " (52, 'CARMEN', 'HUNT'),\n",
+ " (53, 'MENA', 'TEMPLE'),\n",
+ " (54, 'PENELOPE', 'PINKETT'),\n",
+ " (55, 'FAY', 'KILMER'),\n",
+ " (56, 'DAN', 'HARRIS'),\n",
+ " (57, 'JUDE', 'CRUISE'),\n",
+ " (58, 'CHRISTIAN', 'AKROYD'),\n",
+ " (59, 'DUSTIN', 'TAUTOU'),\n",
+ " (60, 'HENRY', 'BERRY'),\n",
+ " (61, 'CHRISTIAN', 'NEESON'),\n",
+ " (62, 'JAYNE', 'NEESON'),\n",
+ " (63, 'CAMERON', 'WRAY'),\n",
+ " (64, 'RAY', 'JOHANSSON'),\n",
+ " (65, 'ANGELA', 'HUDSON'),\n",
+ " (66, 'MARY', 'TANDY'),\n",
+ " (67, 'JESSICA', 'BAILEY'),\n",
+ " (68, 'RIP', 'WINSLET'),\n",
+ " (69, 'KENNETH', 'PALTROW'),\n",
+ " (70, 'MICHELLE', 'MCCONAUGHEY'),\n",
+ " (71, 'ADAM', 'GRANT'),\n",
+ " (72, 'SEAN', 'WILLIAMS'),\n",
+ " (73, 'GARY', 'PENN'),\n",
+ " (74, 'MILLA', 'KEITEL'),\n",
+ " (75, 'BURT', 'POSEY'),\n",
+ " (76, 'ANGELINA', 'ASTAIRE'),\n",
+ " (77, 'CARY', 'MCCONAUGHEY'),\n",
+ " (78, 'GROUCHO', 'SINATRA'),\n",
+ " (79, 'MAE', 'HOFFMAN'),\n",
+ " (80, 'RALPH', 'CRUZ'),\n",
+ " (81, 'SCARLETT', 'DAMON'),\n",
+ " (82, 'WOODY', 'JOLIE'),\n",
+ " (83, 'BEN', 'WILLIS'),\n",
+ " (84, 'JAMES', 'PITT'),\n",
+ " (85, 'MINNIE', 'ZELLWEGER'),\n",
+ " (86, 'GREG', 'CHAPLIN'),\n",
+ " (87, 'SPENCER', 'PECK'),\n",
+ " (88, 'KENNETH', 'PESCI'),\n",
+ " (89, 'CHARLIZE', 'DENCH'),\n",
+ " (90, 'SEAN', 'GUINESS'),\n",
+ " (91, 'CHRISTOPHER', 'BERRY'),\n",
+ " (92, 'KIRSTEN', 'AKROYD'),\n",
+ " (93, 'ELLEN', 'PRESLEY'),\n",
+ " (94, 'KENNETH', 'TORN'),\n",
+ " (95, 'DARYL', 'WAHLBERG'),\n",
+ " (96, 'GENE', 'WILLIS'),\n",
+ " (97, 'MEG', 'HAWKE'),\n",
+ " (98, 'CHRIS', 'BRIDGES'),\n",
+ " (99, 'JIM', 'MOSTEL'),\n",
+ " (100, 'SPENCER', 'DEPP'),\n",
+ " (101, 'SUSAN', 'DAVIS'),\n",
+ " (102, 'WALTER', 'TORN'),\n",
+ " (103, 'MATTHEW', 'LEIGH'),\n",
+ " (104, 'PENELOPE', 'CRONYN'),\n",
+ " (105, 'SIDNEY', 'CROWE'),\n",
+ " (106, 'GROUCHO', 'DUNST'),\n",
+ " (107, 'GINA', 'DEGENERES'),\n",
+ " (108, 'WARREN', 'NOLTE'),\n",
+ " (109, 'SYLVESTER', 'DERN'),\n",
+ " (110, 'SUSAN', 'DAVIS'),\n",
+ " (111, 'CAMERON', 'ZELLWEGER'),\n",
+ " (112, 'RUSSELL', 'BACALL'),\n",
+ " (113, 'MORGAN', 'HOPKINS'),\n",
+ " (114, 'MORGAN', 'MCDORMAND'),\n",
+ " (115, 'HARRISON', 'BALE'),\n",
+ " (116, 'DAN', 'STREEP'),\n",
+ " (117, 'RENEE', 'TRACY'),\n",
+ " (118, 'CUBA', 'ALLEN'),\n",
+ " (119, 'WARREN', 'JACKMAN'),\n",
+ " (120, 'PENELOPE', 'MONROE'),\n",
+ " (121, 'LIZA', 'BERGMAN'),\n",
+ " (122, 'SALMA', 'NOLTE'),\n",
+ " (123, 'JULIANNE', 'DENCH'),\n",
+ " (124, 'SCARLETT', 'BENING'),\n",
+ " (125, 'ALBERT', 'NOLTE'),\n",
+ " (126, 'FRANCES', 'TOMEI'),\n",
+ " (127, 'KEVIN', 'GARLAND'),\n",
+ " (128, 'CATE', 'MCQUEEN'),\n",
+ " (129, 'DARYL', 'CRAWFORD'),\n",
+ " (130, 'GRETA', 'KEITEL'),\n",
+ " (131, 'JANE', 'JACKMAN'),\n",
+ " (132, 'ADAM', 'HOPPER'),\n",
+ " (133, 'RICHARD', 'PENN'),\n",
+ " (134, 'GENE', 'HOPKINS'),\n",
+ " (135, 'RITA', 'REYNOLDS'),\n",
+ " (136, 'ED', 'MANSFIELD'),\n",
+ " (137, 'MORGAN', 'WILLIAMS'),\n",
+ " (138, 'LUCILLE', 'DEE'),\n",
+ " (139, 'EWAN', 'GOODING'),\n",
+ " (140, 'WHOOPI', 'HURT'),\n",
+ " (141, 'CATE', 'HARRIS'),\n",
+ " (142, 'JADA', 'RYDER'),\n",
+ " (143, 'RIVER', 'DEAN'),\n",
+ " (144, 'ANGELA', 'WITHERSPOON'),\n",
+ " (145, 'KIM', 'ALLEN'),\n",
+ " (146, 'ALBERT', 'JOHANSSON'),\n",
+ " (147, 'FAY', 'WINSLET'),\n",
+ " (148, 'EMILY', 'DEE'),\n",
+ " (149, 'RUSSELL', 'TEMPLE'),\n",
+ " (150, 'JAYNE', 'NOLTE'),\n",
+ " (151, 'GEOFFREY', 'HESTON'),\n",
+ " (152, 'BEN', 'HARRIS'),\n",
+ " (153, 'MINNIE', 'KILMER'),\n",
+ " (154, 'MERYL', 'GIBSON'),\n",
+ " (155, 'IAN', 'TANDY'),\n",
+ " (156, 'FAY', 'WOOD'),\n",
+ " (157, 'GRETA', 'MALDEN'),\n",
+ " (158, 'VIVIEN', 'BASINGER'),\n",
+ " (159, 'LAURA', 'BRODY'),\n",
+ " (160, 'CHRIS', 'DEPP'),\n",
+ " (161, 'HARVEY', 'HOPE'),\n",
+ " (162, 'OPRAH', 'KILMER'),\n",
+ " (163, 'CHRISTOPHER', 'WEST'),\n",
+ " (164, 'HUMPHREY', 'WILLIS'),\n",
+ " (165, 'AL', 'GARLAND'),\n",
+ " (166, 'NICK', 'DEGENERES'),\n",
+ " (167, 'LAURENCE', 'BULLOCK'),\n",
+ " (168, 'WILL', 'WILSON'),\n",
+ " (169, 'KENNETH', 'HOFFMAN'),\n",
+ " (170, 'MENA', 'HOPPER'),\n",
+ " (171, 'OLYMPIA', 'PFEIFFER'),\n",
+ " (172, 'GROUCHO', 'WILLIAMS'),\n",
+ " (173, 'ALAN', 'DREYFUSS'),\n",
+ " (174, 'MICHAEL', 'BENING'),\n",
+ " (175, 'WILLIAM', 'HACKMAN'),\n",
+ " (176, 'JON', 'CHASE'),\n",
+ " (177, 'GENE', 'MCKELLEN'),\n",
+ " (178, 'LISA', 'MONROE'),\n",
+ " (179, 'ED', 'GUINESS'),\n",
+ " (180, 'JEFF', 'SILVERSTONE'),\n",
+ " (181, 'MATTHEW', 'CARREY'),\n",
+ " (182, 'DEBBIE', 'AKROYD'),\n",
+ " (183, 'RUSSELL', 'CLOSE'),\n",
+ " (184, 'HUMPHREY', 'GARLAND'),\n",
+ " (185, 'MICHAEL', 'BOLGER'),\n",
+ " (186, 'JULIA', 'ZELLWEGER'),\n",
+ " (187, 'RENEE', 'BALL'),\n",
+ " (188, 'ROCK', 'DUKAKIS'),\n",
+ " (189, 'CUBA', 'BIRCH'),\n",
+ " (190, 'AUDREY', 'BAILEY'),\n",
+ " (191, 'GREGORY', 'GOODING'),\n",
+ " (192, 'JOHN', 'SUVARI'),\n",
+ " (193, 'BURT', 'TEMPLE'),\n",
+ " (194, 'MERYL', 'ALLEN'),\n",
+ " (195, 'JAYNE', 'SILVERSTONE'),\n",
+ " (196, 'BELA', 'WALKEN'),\n",
+ " (197, 'REESE', 'WEST'),\n",
+ " (198, 'MARY', 'KEITEL'),\n",
+ " (199, 'JULIA', 'FAWCETT'),\n",
+ " (200, 'THORA', 'TEMPLE')]"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "results"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 1 | \n",
+ " PENELOPE | \n",
+ " GUINESS | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 2 | \n",
+ " NICK | \n",
+ " WAHLBERG | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 3 | \n",
+ " ED | \n",
+ " CHASE | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 4 | \n",
+ " JENNIFER | \n",
+ " DAVIS | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 5 | \n",
+ " JOHNNY | \n",
+ " LOLLOBRIGIDA | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 195 | \n",
+ " 196 | \n",
+ " BELA | \n",
+ " WALKEN | \n",
+ "
\n",
+ " \n",
+ " | 196 | \n",
+ " 197 | \n",
+ " REESE | \n",
+ " WEST | \n",
+ "
\n",
+ " \n",
+ " | 197 | \n",
+ " 198 | \n",
+ " MARY | \n",
+ " KEITEL | \n",
+ "
\n",
+ " \n",
+ " | 198 | \n",
+ " 199 | \n",
+ " JULIA | \n",
+ " FAWCETT | \n",
+ "
\n",
+ " \n",
+ " | 199 | \n",
+ " 200 | \n",
+ " THORA | \n",
+ " TEMPLE | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
200 rows × 3 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 0 1 2\n",
+ "0 1 PENELOPE GUINESS\n",
+ "1 2 NICK WAHLBERG\n",
+ "2 3 ED CHASE\n",
+ "3 4 JENNIFER DAVIS\n",
+ "4 5 JOHNNY LOLLOBRIGIDA\n",
+ ".. ... ... ...\n",
+ "195 196 BELA WALKEN\n",
+ "196 197 REESE WEST\n",
+ "197 198 MARY KEITEL\n",
+ "198 199 JULIA FAWCETT\n",
+ "199 200 THORA TEMPLE\n",
+ "\n",
+ "[200 rows x 3 columns]"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import pandas as pd\n",
+ "\n",
+ "pd.DataFrame(results)"
]
},
{
@@ -35,11 +459,12 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
- "# your code here\n"
+ "import pandas as pd\n",
+ "import numpy as np"
]
},
{
@@ -51,11 +476,12 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
- "# your code here\n"
+ "nasa = pd.read_json(\"nasa.json\", orient = \"records\")\n",
+ "nasa = pd.DataFrame(nasa)"
]
},
{
@@ -67,11 +493,154 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " :@computed_region_cbhk_fwbd | \n",
+ " :@computed_region_nnqa_25f4 | \n",
+ " fall | \n",
+ " geolocation | \n",
+ " id | \n",
+ " mass | \n",
+ " name | \n",
+ " nametype | \n",
+ " recclass | \n",
+ " reclat | \n",
+ " reclong | \n",
+ " year | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Fell | \n",
+ " {'type': 'Point', 'coordinates': [6.08333, 50.... | \n",
+ " 1 | \n",
+ " 21.0 | \n",
+ " Aachen | \n",
+ " Valid | \n",
+ " L5 | \n",
+ " 50.77500 | \n",
+ " 6.08333 | \n",
+ " 1880-01-01T00:00:00.000 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Fell | \n",
+ " {'type': 'Point', 'coordinates': [10.23333, 56... | \n",
+ " 2 | \n",
+ " 720.0 | \n",
+ " Aarhus | \n",
+ " Valid | \n",
+ " H6 | \n",
+ " 56.18333 | \n",
+ " 10.23333 | \n",
+ " 1951-01-01T00:00:00.000 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Fell | \n",
+ " {'type': 'Point', 'coordinates': [-113, 54.216... | \n",
+ " 6 | \n",
+ " 107000.0 | \n",
+ " Abee | \n",
+ " Valid | \n",
+ " EH4 | \n",
+ " 54.21667 | \n",
+ " -113.00000 | \n",
+ " 1952-01-01T00:00:00.000 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Fell | \n",
+ " {'type': 'Point', 'coordinates': [-99.9, 16.88... | \n",
+ " 10 | \n",
+ " 1914.0 | \n",
+ " Acapulco | \n",
+ " Valid | \n",
+ " Acapulcoite | \n",
+ " 16.88333 | \n",
+ " -99.90000 | \n",
+ " 1976-01-01T00:00:00.000 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Fell | \n",
+ " {'type': 'Point', 'coordinates': [-64.95, -33.... | \n",
+ " 370 | \n",
+ " 780.0 | \n",
+ " Achiras | \n",
+ " Valid | \n",
+ " L6 | \n",
+ " -33.16667 | \n",
+ " -64.95000 | \n",
+ " 1902-01-01T00:00:00.000 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " :@computed_region_cbhk_fwbd :@computed_region_nnqa_25f4 fall \\\n",
+ "0 NaN NaN Fell \n",
+ "1 NaN NaN Fell \n",
+ "2 NaN NaN Fell \n",
+ "3 NaN NaN Fell \n",
+ "4 NaN NaN Fell \n",
+ "\n",
+ " geolocation id mass name \\\n",
+ "0 {'type': 'Point', 'coordinates': [6.08333, 50.... 1 21.0 Aachen \n",
+ "1 {'type': 'Point', 'coordinates': [10.23333, 56... 2 720.0 Aarhus \n",
+ "2 {'type': 'Point', 'coordinates': [-113, 54.216... 6 107000.0 Abee \n",
+ "3 {'type': 'Point', 'coordinates': [-99.9, 16.88... 10 1914.0 Acapulco \n",
+ "4 {'type': 'Point', 'coordinates': [-64.95, -33.... 370 780.0 Achiras \n",
+ "\n",
+ " nametype recclass reclat reclong year \n",
+ "0 Valid L5 50.77500 6.08333 1880-01-01T00:00:00.000 \n",
+ "1 Valid H6 56.18333 10.23333 1951-01-01T00:00:00.000 \n",
+ "2 Valid EH4 54.21667 -113.00000 1952-01-01T00:00:00.000 \n",
+ "3 Valid Acapulcoite 16.88333 -99.90000 1976-01-01T00:00:00.000 \n",
+ "4 Valid L6 -33.16667 -64.95000 1902-01-01T00:00:00.000 "
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# your code here\n"
+ "nasa.head()"
]
},
{
@@ -85,11 +654,24 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Fell 996\n",
+ "Found 4\n",
+ "Name: fall, dtype: int64"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# your code here\n"
+ "nasa[\"fall\"].value_counts()"
]
},
{
@@ -101,11 +683,11 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
- "# your code here\n"
+ "nasa.to_json('nasa-output.json', orient='records')\n"
]
},
{
@@ -123,21 +705,21 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
- "#Your pandas import here:\n",
- "\n"
+ "import pandas as pd\n",
+ "import numpy as np"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
- "# Run this code:\n",
+ "#Run this code:\n",
"\n",
"cols = ['time', 'rad_flow', 'fpv_close', 'fpv_open', 'high', 'bypass', 'bpv_close', 'bpv_open', 'class']\n",
"tst_url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/statlog/shuttle/shuttle.tst'"
@@ -145,12 +727,217 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 19,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " time | \n",
+ " rad_flow | \n",
+ " fpv_close | \n",
+ " fpv_open | \n",
+ " high | \n",
+ " bypass | \n",
+ " bpv_close | \n",
+ " bpv_open | \n",
+ " class | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 55 | \n",
+ " 0 | \n",
+ " 81 | \n",
+ " 0 | \n",
+ " -6 | \n",
+ " 11 | \n",
+ " 25 | \n",
+ " 88 | \n",
+ " 64 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 56 | \n",
+ " 0 | \n",
+ " 96 | \n",
+ " 0 | \n",
+ " 52 | \n",
+ " -4 | \n",
+ " 40 | \n",
+ " 44 | \n",
+ " 4 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 50 | \n",
+ " -1 | \n",
+ " 89 | \n",
+ " -7 | \n",
+ " 50 | \n",
+ " 0 | \n",
+ " 39 | \n",
+ " 40 | \n",
+ " 2 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 53 | \n",
+ " 9 | \n",
+ " 79 | \n",
+ " 0 | \n",
+ " 42 | \n",
+ " -2 | \n",
+ " 25 | \n",
+ " 37 | \n",
+ " 12 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 55 | \n",
+ " 2 | \n",
+ " 82 | \n",
+ " 0 | \n",
+ " 54 | \n",
+ " -6 | \n",
+ " 26 | \n",
+ " 28 | \n",
+ " 2 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 80 | \n",
+ " 0 | \n",
+ " 84 | \n",
+ " 0 | \n",
+ " -36 | \n",
+ " -29 | \n",
+ " 4 | \n",
+ " 120 | \n",
+ " 116 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " | 55 | \n",
+ " 0 | \n",
+ " 81 | \n",
+ " 0 | \n",
+ " -20 | \n",
+ " 25 | \n",
+ " 26 | \n",
+ " 102 | \n",
+ " 76 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 55 | \n",
+ " 0 | \n",
+ " 77 | \n",
+ " 0 | \n",
+ " 12 | \n",
+ " -22 | \n",
+ " 22 | \n",
+ " 65 | \n",
+ " 42 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 37 | \n",
+ " 0 | \n",
+ " 103 | \n",
+ " 0 | \n",
+ " 18 | \n",
+ " -16 | \n",
+ " 66 | \n",
+ " 85 | \n",
+ " 20 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 56 | \n",
+ " 2 | \n",
+ " 98 | \n",
+ " 0 | \n",
+ " 52 | \n",
+ " 1 | \n",
+ " 42 | \n",
+ " 46 | \n",
+ " 4 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
14500 rows × 9 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " time rad_flow fpv_close fpv_open high bypass bpv_close bpv_open \\\n",
+ "55 0 81 0 -6 11 25 88 64 \n",
+ "56 0 96 0 52 -4 40 44 4 \n",
+ "50 -1 89 -7 50 0 39 40 2 \n",
+ "53 9 79 0 42 -2 25 37 12 \n",
+ "55 2 82 0 54 -6 26 28 2 \n",
+ ".. ... ... ... ... ... ... ... ... \n",
+ "80 0 84 0 -36 -29 4 120 116 \n",
+ "55 0 81 0 -20 25 26 102 76 \n",
+ "55 0 77 0 12 -22 22 65 42 \n",
+ "37 0 103 0 18 -16 66 85 20 \n",
+ "56 2 98 0 52 1 42 46 4 \n",
+ "\n",
+ " class \n",
+ "55 4 \n",
+ "56 4 \n",
+ "50 1 \n",
+ "53 4 \n",
+ "55 1 \n",
+ ".. ... \n",
+ "80 5 \n",
+ "55 4 \n",
+ "55 4 \n",
+ "37 1 \n",
+ "56 4 \n",
+ "\n",
+ "[14500 rows x 9 columns]"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "shuttle = pd.read_csv(tst_url,sep=' ', names=cols)\n",
+ "shuttle"
]
},
{
@@ -162,12 +949,129 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 20,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " time | \n",
+ " rad_flow | \n",
+ " fpv_close | \n",
+ " fpv_open | \n",
+ " high | \n",
+ " bypass | \n",
+ " bpv_close | \n",
+ " bpv_open | \n",
+ " class | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 55 | \n",
+ " 0 | \n",
+ " 81 | \n",
+ " 0 | \n",
+ " -6 | \n",
+ " 11 | \n",
+ " 25 | \n",
+ " 88 | \n",
+ " 64 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 56 | \n",
+ " 0 | \n",
+ " 96 | \n",
+ " 0 | \n",
+ " 52 | \n",
+ " -4 | \n",
+ " 40 | \n",
+ " 44 | \n",
+ " 4 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 50 | \n",
+ " -1 | \n",
+ " 89 | \n",
+ " -7 | \n",
+ " 50 | \n",
+ " 0 | \n",
+ " 39 | \n",
+ " 40 | \n",
+ " 2 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 53 | \n",
+ " 9 | \n",
+ " 79 | \n",
+ " 0 | \n",
+ " 42 | \n",
+ " -2 | \n",
+ " 25 | \n",
+ " 37 | \n",
+ " 12 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 55 | \n",
+ " 2 | \n",
+ " 82 | \n",
+ " 0 | \n",
+ " 54 | \n",
+ " -6 | \n",
+ " 26 | \n",
+ " 28 | \n",
+ " 2 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " time rad_flow fpv_close fpv_open high bypass bpv_close bpv_open \\\n",
+ "55 0 81 0 -6 11 25 88 64 \n",
+ "56 0 96 0 52 -4 40 44 4 \n",
+ "50 -1 89 -7 50 0 39 40 2 \n",
+ "53 9 79 0 42 -2 25 37 12 \n",
+ "55 2 82 0 54 -6 26 28 2 \n",
+ "\n",
+ " class \n",
+ "55 4 \n",
+ "56 4 \n",
+ "50 1 \n",
+ "53 4 \n",
+ "55 1 "
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "shuttle.head()"
]
},
{
@@ -179,12 +1083,11 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
- "# Your code here:\n",
- "\n"
+ "shuttle.to_csv(\"shuttle.csv\", sep = \",\")"
]
},
{
@@ -200,12 +1103,417 @@
},
{
"cell_type": "code",
- "execution_count": 11,
- "metadata": {},
- "outputs": [],
+ "execution_count": 22,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Name | \n",
+ " Year | \n",
+ " Group | \n",
+ " Status | \n",
+ " Birth Date | \n",
+ " Birth Place | \n",
+ " Gender | \n",
+ " Alma Mater | \n",
+ " Undergraduate Major | \n",
+ " Graduate Major | \n",
+ " Military Rank | \n",
+ " Military Branch | \n",
+ " Space Flights | \n",
+ " Space Flight (hr) | \n",
+ " Space Walks | \n",
+ " Space Walks (hr) | \n",
+ " Missions | \n",
+ " Death Date | \n",
+ " Death Mission | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Joseph M. Acaba | \n",
+ " 2004.0 | \n",
+ " 19.0 | \n",
+ " Active | \n",
+ " 1967-05-17 | \n",
+ " Inglewood, CA | \n",
+ " Male | \n",
+ " University of California-Santa Barbara; Univer... | \n",
+ " Geology | \n",
+ " Geology | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 2 | \n",
+ " 3307 | \n",
+ " 2 | \n",
+ " 13.0 | \n",
+ " STS-119 (Discovery), ISS-31/32 (Soyuz) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Loren W. Acton | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Retired | \n",
+ " 1936-03-07 | \n",
+ " Lewiston, MT | \n",
+ " Male | \n",
+ " Montana State University; University of Colorado | \n",
+ " Engineering Physics | \n",
+ " Solar Physics | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 1 | \n",
+ " 190 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS 51-F (Challenger) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " James C. Adamson | \n",
+ " 1984.0 | \n",
+ " 10.0 | \n",
+ " Retired | \n",
+ " 1946-03-03 | \n",
+ " Warsaw, NY | \n",
+ " Male | \n",
+ " US Military Academy; Princeton University | \n",
+ " Engineering | \n",
+ " Aerospace Engineering | \n",
+ " Colonel | \n",
+ " US Army (Retired) | \n",
+ " 2 | \n",
+ " 334 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS-28 (Columbia), STS-43 (Atlantis) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Thomas D. Akers | \n",
+ " 1987.0 | \n",
+ " 12.0 | \n",
+ " Retired | \n",
+ " 1951-05-20 | \n",
+ " St. Louis, MO | \n",
+ " Male | \n",
+ " University of Missouri-Rolla | \n",
+ " Applied Mathematics | \n",
+ " Applied Mathematics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 4 | \n",
+ " 814 | \n",
+ " 4 | \n",
+ " 29.0 | \n",
+ " STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Buzz Aldrin | \n",
+ " 1963.0 | \n",
+ " 3.0 | \n",
+ " Retired | \n",
+ " 1930-01-20 | \n",
+ " Montclair, NJ | \n",
+ " Male | \n",
+ " US Military Academy; MIT | \n",
+ " Mechanical Engineering | \n",
+ " Astronautics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 2 | \n",
+ " 289 | \n",
+ " 2 | \n",
+ " 8.0 | \n",
+ " Gemini 12, Apollo 11 | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 352 | \n",
+ " David A. Wolf | \n",
+ " 1990.0 | \n",
+ " 13.0 | \n",
+ " Retired | \n",
+ " 1956-08-23 | \n",
+ " Indianapolis, IN | \n",
+ " Male | \n",
+ " Purdue University; Indiana University | \n",
+ " Electrical Engineering | \n",
+ " Medicine | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 3 | \n",
+ " 4044 | \n",
+ " 7 | \n",
+ " 41.0 | \n",
+ " STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo... | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 353 | \n",
+ " Neil W. Woodward III | \n",
+ " 1998.0 | \n",
+ " 17.0 | \n",
+ " Retired | \n",
+ " 1962-07-26 | \n",
+ " Chicago, IL | \n",
+ " Male | \n",
+ " MIT; University of Texas-Austin; George Washin... | \n",
+ " Physics | \n",
+ " Physics; Business Management | \n",
+ " Commander | \n",
+ " US Navy | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 354 | \n",
+ " Alfred M. Worden | \n",
+ " 1966.0 | \n",
+ " 5.0 | \n",
+ " Retired | \n",
+ " 1932-02-07 | \n",
+ " Jackson, MI | \n",
+ " Male | \n",
+ " US Military Academy; University of Michigan | \n",
+ " Military Science | \n",
+ " Aeronautical & Astronautical Engineering | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 1 | \n",
+ " 295 | \n",
+ " 1 | \n",
+ " 0.5 | \n",
+ " Apollo 15 | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 355 | \n",
+ " John W. Young | \n",
+ " 1962.0 | \n",
+ " 2.0 | \n",
+ " Retired | \n",
+ " 1930-09-24 | \n",
+ " San Francisco, CA | \n",
+ " Male | \n",
+ " Georgia Institute of Technology | \n",
+ " Aeronautical Engineering | \n",
+ " NaN | \n",
+ " Captain | \n",
+ " US Navy (Retired) | \n",
+ " 6 | \n",
+ " 835 | \n",
+ " 3 | \n",
+ " 20.0 | \n",
+ " Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS... | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 356 | \n",
+ " George D. Zamka | \n",
+ " 1998.0 | \n",
+ " 17.0 | \n",
+ " Retired | \n",
+ " 1962-06-29 | \n",
+ " Jersey City, NJ | \n",
+ " Male | \n",
+ " US Naval Academy; Florida Institute of Technology | \n",
+ " Mathematics | \n",
+ " Engineering Management | \n",
+ " Colonel | \n",
+ " US Marine Corps (Retired) | \n",
+ " 2 | \n",
+ " 692 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS-120 (Discovery), STS-130 (Endeavor) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
357 rows × 19 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Name Year Group Status Birth Date \\\n",
+ "0 Joseph M. Acaba 2004.0 19.0 Active 1967-05-17 \n",
+ "1 Loren W. Acton NaN NaN Retired 1936-03-07 \n",
+ "2 James C. Adamson 1984.0 10.0 Retired 1946-03-03 \n",
+ "3 Thomas D. Akers 1987.0 12.0 Retired 1951-05-20 \n",
+ "4 Buzz Aldrin 1963.0 3.0 Retired 1930-01-20 \n",
+ ".. ... ... ... ... ... \n",
+ "352 David A. Wolf 1990.0 13.0 Retired 1956-08-23 \n",
+ "353 Neil W. Woodward III 1998.0 17.0 Retired 1962-07-26 \n",
+ "354 Alfred M. Worden 1966.0 5.0 Retired 1932-02-07 \n",
+ "355 John W. Young 1962.0 2.0 Retired 1930-09-24 \n",
+ "356 George D. Zamka 1998.0 17.0 Retired 1962-06-29 \n",
+ "\n",
+ " Birth Place Gender \\\n",
+ "0 Inglewood, CA Male \n",
+ "1 Lewiston, MT Male \n",
+ "2 Warsaw, NY Male \n",
+ "3 St. Louis, MO Male \n",
+ "4 Montclair, NJ Male \n",
+ ".. ... ... \n",
+ "352 Indianapolis, IN Male \n",
+ "353 Chicago, IL Male \n",
+ "354 Jackson, MI Male \n",
+ "355 San Francisco, CA Male \n",
+ "356 Jersey City, NJ Male \n",
+ "\n",
+ " Alma Mater \\\n",
+ "0 University of California-Santa Barbara; Univer... \n",
+ "1 Montana State University; University of Colorado \n",
+ "2 US Military Academy; Princeton University \n",
+ "3 University of Missouri-Rolla \n",
+ "4 US Military Academy; MIT \n",
+ ".. ... \n",
+ "352 Purdue University; Indiana University \n",
+ "353 MIT; University of Texas-Austin; George Washin... \n",
+ "354 US Military Academy; University of Michigan \n",
+ "355 Georgia Institute of Technology \n",
+ "356 US Naval Academy; Florida Institute of Technology \n",
+ "\n",
+ " Undergraduate Major Graduate Major \\\n",
+ "0 Geology Geology \n",
+ "1 Engineering Physics Solar Physics \n",
+ "2 Engineering Aerospace Engineering \n",
+ "3 Applied Mathematics Applied Mathematics \n",
+ "4 Mechanical Engineering Astronautics \n",
+ ".. ... ... \n",
+ "352 Electrical Engineering Medicine \n",
+ "353 Physics Physics; Business Management \n",
+ "354 Military Science Aeronautical & Astronautical Engineering \n",
+ "355 Aeronautical Engineering NaN \n",
+ "356 Mathematics Engineering Management \n",
+ "\n",
+ " Military Rank Military Branch Space Flights \\\n",
+ "0 NaN NaN 2 \n",
+ "1 NaN NaN 1 \n",
+ "2 Colonel US Army (Retired) 2 \n",
+ "3 Colonel US Air Force (Retired) 4 \n",
+ "4 Colonel US Air Force (Retired) 2 \n",
+ ".. ... ... ... \n",
+ "352 NaN NaN 3 \n",
+ "353 Commander US Navy 0 \n",
+ "354 Colonel US Air Force (Retired) 1 \n",
+ "355 Captain US Navy (Retired) 6 \n",
+ "356 Colonel US Marine Corps (Retired) 2 \n",
+ "\n",
+ " Space Flight (hr) Space Walks Space Walks (hr) \\\n",
+ "0 3307 2 13.0 \n",
+ "1 190 0 0.0 \n",
+ "2 334 0 0.0 \n",
+ "3 814 4 29.0 \n",
+ "4 289 2 8.0 \n",
+ ".. ... ... ... \n",
+ "352 4044 7 41.0 \n",
+ "353 0 0 0.0 \n",
+ "354 295 1 0.5 \n",
+ "355 835 3 20.0 \n",
+ "356 692 0 0.0 \n",
+ "\n",
+ " Missions Death Date \\\n",
+ "0 STS-119 (Discovery), ISS-31/32 (Soyuz) NaT \n",
+ "1 STS 51-F (Challenger) NaT \n",
+ "2 STS-28 (Columbia), STS-43 (Atlantis) NaT \n",
+ "3 STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... NaT \n",
+ "4 Gemini 12, Apollo 11 NaT \n",
+ ".. ... ... \n",
+ "352 STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo... NaT \n",
+ "353 NaN NaT \n",
+ "354 Apollo 15 NaT \n",
+ "355 Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS... NaT \n",
+ "356 STS-120 (Discovery), STS-130 (Endeavor) NaT \n",
+ "\n",
+ " Death Mission \n",
+ "0 NaN \n",
+ "1 NaN \n",
+ "2 NaN \n",
+ "3 NaN \n",
+ "4 NaN \n",
+ ".. ... \n",
+ "352 NaN \n",
+ "353 NaN \n",
+ "354 NaN \n",
+ "355 NaN \n",
+ "356 NaN \n",
+ "\n",
+ "[357 rows x 19 columns]"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "astronaut = pd.read_excel(\"astronauts.xls\")\n",
+ "astronaut"
]
},
{
@@ -217,12 +1525,210 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 23,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Name | \n",
+ " Year | \n",
+ " Group | \n",
+ " Status | \n",
+ " Birth Date | \n",
+ " Birth Place | \n",
+ " Gender | \n",
+ " Alma Mater | \n",
+ " Undergraduate Major | \n",
+ " Graduate Major | \n",
+ " Military Rank | \n",
+ " Military Branch | \n",
+ " Space Flights | \n",
+ " Space Flight (hr) | \n",
+ " Space Walks | \n",
+ " Space Walks (hr) | \n",
+ " Missions | \n",
+ " Death Date | \n",
+ " Death Mission | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Joseph M. Acaba | \n",
+ " 2004.0 | \n",
+ " 19.0 | \n",
+ " Active | \n",
+ " 1967-05-17 | \n",
+ " Inglewood, CA | \n",
+ " Male | \n",
+ " University of California-Santa Barbara; Univer... | \n",
+ " Geology | \n",
+ " Geology | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 2 | \n",
+ " 3307 | \n",
+ " 2 | \n",
+ " 13.0 | \n",
+ " STS-119 (Discovery), ISS-31/32 (Soyuz) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Loren W. Acton | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Retired | \n",
+ " 1936-03-07 | \n",
+ " Lewiston, MT | \n",
+ " Male | \n",
+ " Montana State University; University of Colorado | \n",
+ " Engineering Physics | \n",
+ " Solar Physics | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 1 | \n",
+ " 190 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS 51-F (Challenger) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " James C. Adamson | \n",
+ " 1984.0 | \n",
+ " 10.0 | \n",
+ " Retired | \n",
+ " 1946-03-03 | \n",
+ " Warsaw, NY | \n",
+ " Male | \n",
+ " US Military Academy; Princeton University | \n",
+ " Engineering | \n",
+ " Aerospace Engineering | \n",
+ " Colonel | \n",
+ " US Army (Retired) | \n",
+ " 2 | \n",
+ " 334 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS-28 (Columbia), STS-43 (Atlantis) | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Thomas D. Akers | \n",
+ " 1987.0 | \n",
+ " 12.0 | \n",
+ " Retired | \n",
+ " 1951-05-20 | \n",
+ " St. Louis, MO | \n",
+ " Male | \n",
+ " University of Missouri-Rolla | \n",
+ " Applied Mathematics | \n",
+ " Applied Mathematics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 4 | \n",
+ " 814 | \n",
+ " 4 | \n",
+ " 29.0 | \n",
+ " STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Buzz Aldrin | \n",
+ " 1963.0 | \n",
+ " 3.0 | \n",
+ " Retired | \n",
+ " 1930-01-20 | \n",
+ " Montclair, NJ | \n",
+ " Male | \n",
+ " US Military Academy; MIT | \n",
+ " Mechanical Engineering | \n",
+ " Astronautics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 2 | \n",
+ " 289 | \n",
+ " 2 | \n",
+ " 8.0 | \n",
+ " Gemini 12, Apollo 11 | \n",
+ " NaT | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Name Year Group Status Birth Date Birth Place Gender \\\n",
+ "0 Joseph M. Acaba 2004.0 19.0 Active 1967-05-17 Inglewood, CA Male \n",
+ "1 Loren W. Acton NaN NaN Retired 1936-03-07 Lewiston, MT Male \n",
+ "2 James C. Adamson 1984.0 10.0 Retired 1946-03-03 Warsaw, NY Male \n",
+ "3 Thomas D. Akers 1987.0 12.0 Retired 1951-05-20 St. Louis, MO Male \n",
+ "4 Buzz Aldrin 1963.0 3.0 Retired 1930-01-20 Montclair, NJ Male \n",
+ "\n",
+ " Alma Mater Undergraduate Major \\\n",
+ "0 University of California-Santa Barbara; Univer... Geology \n",
+ "1 Montana State University; University of Colorado Engineering Physics \n",
+ "2 US Military Academy; Princeton University Engineering \n",
+ "3 University of Missouri-Rolla Applied Mathematics \n",
+ "4 US Military Academy; MIT Mechanical Engineering \n",
+ "\n",
+ " Graduate Major Military Rank Military Branch Space Flights \\\n",
+ "0 Geology NaN NaN 2 \n",
+ "1 Solar Physics NaN NaN 1 \n",
+ "2 Aerospace Engineering Colonel US Army (Retired) 2 \n",
+ "3 Applied Mathematics Colonel US Air Force (Retired) 4 \n",
+ "4 Astronautics Colonel US Air Force (Retired) 2 \n",
+ "\n",
+ " Space Flight (hr) Space Walks Space Walks (hr) \\\n",
+ "0 3307 2 13.0 \n",
+ "1 190 0 0.0 \n",
+ "2 334 0 0.0 \n",
+ "3 814 4 29.0 \n",
+ "4 289 2 8.0 \n",
+ "\n",
+ " Missions Death Date Death Mission \n",
+ "0 STS-119 (Discovery), ISS-31/32 (Soyuz) NaT NaN \n",
+ "1 STS 51-F (Challenger) NaT NaN \n",
+ "2 STS-28 (Columbia), STS-43 (Atlantis) NaT NaN \n",
+ "3 STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... NaT NaN \n",
+ "4 Gemini 12, Apollo 11 NaT NaN "
+ ]
+ },
+ "execution_count": 23,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "astronaut.head()"
]
},
{
@@ -234,12 +1740,33 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 24,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Physics 35\n",
+ "Aerospace Engineering 33\n",
+ "Mechanical Engineering 30\n",
+ "Aeronautical Engineering 28\n",
+ "Electrical Engineering 23\n",
+ " ..\n",
+ "Astronomy 1\n",
+ "Marine Engineering & Nautical Science 1\n",
+ "Philosophy 1\n",
+ "Bioscience 1\n",
+ "Military Science 1\n",
+ "Name: Undergraduate Major, Length: 83, dtype: int64"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "astronaut[\"Undergraduate Major\"].value_counts()"
]
},
{
@@ -251,12 +1778,423 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
- "# Your code here:\n",
- "\n"
+ "astronaut.to_csv(\"astronaut.csv\", sep = \" \", index=False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Name | \n",
+ " Year | \n",
+ " Group | \n",
+ " Status | \n",
+ " Birth Date | \n",
+ " Birth Place | \n",
+ " Gender | \n",
+ " Alma Mater | \n",
+ " Undergraduate Major | \n",
+ " Graduate Major | \n",
+ " Military Rank | \n",
+ " Military Branch | \n",
+ " Space Flights | \n",
+ " Space Flight (hr) | \n",
+ " Space Walks | \n",
+ " Space Walks (hr) | \n",
+ " Missions | \n",
+ " Death Date | \n",
+ " Death Mission | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Joseph M. Acaba | \n",
+ " 2004.0 | \n",
+ " 19.0 | \n",
+ " Active | \n",
+ " 1967-05-17 | \n",
+ " Inglewood, CA | \n",
+ " Male | \n",
+ " University of California-Santa Barbara; Univer... | \n",
+ " Geology | \n",
+ " Geology | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 2 | \n",
+ " 3307 | \n",
+ " 2 | \n",
+ " 13.0 | \n",
+ " STS-119 (Discovery), ISS-31/32 (Soyuz) | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Loren W. Acton | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " Retired | \n",
+ " 1936-03-07 | \n",
+ " Lewiston, MT | \n",
+ " Male | \n",
+ " Montana State University; University of Colorado | \n",
+ " Engineering Physics | \n",
+ " Solar Physics | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 1 | \n",
+ " 190 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS 51-F (Challenger) | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " James C. Adamson | \n",
+ " 1984.0 | \n",
+ " 10.0 | \n",
+ " Retired | \n",
+ " 1946-03-03 | \n",
+ " Warsaw, NY | \n",
+ " Male | \n",
+ " US Military Academy; Princeton University | \n",
+ " Engineering | \n",
+ " Aerospace Engineering | \n",
+ " Colonel | \n",
+ " US Army (Retired) | \n",
+ " 2 | \n",
+ " 334 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS-28 (Columbia), STS-43 (Atlantis) | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Thomas D. Akers | \n",
+ " 1987.0 | \n",
+ " 12.0 | \n",
+ " Retired | \n",
+ " 1951-05-20 | \n",
+ " St. Louis, MO | \n",
+ " Male | \n",
+ " University of Missouri-Rolla | \n",
+ " Applied Mathematics | \n",
+ " Applied Mathematics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 4 | \n",
+ " 814 | \n",
+ " 4 | \n",
+ " 29.0 | \n",
+ " STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Buzz Aldrin | \n",
+ " 1963.0 | \n",
+ " 3.0 | \n",
+ " Retired | \n",
+ " 1930-01-20 | \n",
+ " Montclair, NJ | \n",
+ " Male | \n",
+ " US Military Academy; MIT | \n",
+ " Mechanical Engineering | \n",
+ " Astronautics | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 2 | \n",
+ " 289 | \n",
+ " 2 | \n",
+ " 8.0 | \n",
+ " Gemini 12, Apollo 11 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 352 | \n",
+ " David A. Wolf | \n",
+ " 1990.0 | \n",
+ " 13.0 | \n",
+ " Retired | \n",
+ " 1956-08-23 | \n",
+ " Indianapolis, IN | \n",
+ " Male | \n",
+ " Purdue University; Indiana University | \n",
+ " Electrical Engineering | \n",
+ " Medicine | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 3 | \n",
+ " 4044 | \n",
+ " 7 | \n",
+ " 41.0 | \n",
+ " STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 353 | \n",
+ " Neil W. Woodward III | \n",
+ " 1998.0 | \n",
+ " 17.0 | \n",
+ " Retired | \n",
+ " 1962-07-26 | \n",
+ " Chicago, IL | \n",
+ " Male | \n",
+ " MIT; University of Texas-Austin; George Washin... | \n",
+ " Physics | \n",
+ " Physics; Business Management | \n",
+ " Commander | \n",
+ " US Navy | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 354 | \n",
+ " Alfred M. Worden | \n",
+ " 1966.0 | \n",
+ " 5.0 | \n",
+ " Retired | \n",
+ " 1932-02-07 | \n",
+ " Jackson, MI | \n",
+ " Male | \n",
+ " US Military Academy; University of Michigan | \n",
+ " Military Science | \n",
+ " Aeronautical & Astronautical Engineering | \n",
+ " Colonel | \n",
+ " US Air Force (Retired) | \n",
+ " 1 | \n",
+ " 295 | \n",
+ " 1 | \n",
+ " 0.5 | \n",
+ " Apollo 15 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 355 | \n",
+ " John W. Young | \n",
+ " 1962.0 | \n",
+ " 2.0 | \n",
+ " Retired | \n",
+ " 1930-09-24 | \n",
+ " San Francisco, CA | \n",
+ " Male | \n",
+ " Georgia Institute of Technology | \n",
+ " Aeronautical Engineering | \n",
+ " NaN | \n",
+ " Captain | \n",
+ " US Navy (Retired) | \n",
+ " 6 | \n",
+ " 835 | \n",
+ " 3 | \n",
+ " 20.0 | \n",
+ " Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | 356 | \n",
+ " George D. Zamka | \n",
+ " 1998.0 | \n",
+ " 17.0 | \n",
+ " Retired | \n",
+ " 1962-06-29 | \n",
+ " Jersey City, NJ | \n",
+ " Male | \n",
+ " US Naval Academy; Florida Institute of Technology | \n",
+ " Mathematics | \n",
+ " Engineering Management | \n",
+ " Colonel | \n",
+ " US Marine Corps (Retired) | \n",
+ " 2 | \n",
+ " 692 | \n",
+ " 0 | \n",
+ " 0.0 | \n",
+ " STS-120 (Discovery), STS-130 (Endeavor) | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
357 rows × 19 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Name Year Group Status Birth Date \\\n",
+ "0 Joseph M. Acaba 2004.0 19.0 Active 1967-05-17 \n",
+ "1 Loren W. Acton NaN NaN Retired 1936-03-07 \n",
+ "2 James C. Adamson 1984.0 10.0 Retired 1946-03-03 \n",
+ "3 Thomas D. Akers 1987.0 12.0 Retired 1951-05-20 \n",
+ "4 Buzz Aldrin 1963.0 3.0 Retired 1930-01-20 \n",
+ ".. ... ... ... ... ... \n",
+ "352 David A. Wolf 1990.0 13.0 Retired 1956-08-23 \n",
+ "353 Neil W. Woodward III 1998.0 17.0 Retired 1962-07-26 \n",
+ "354 Alfred M. Worden 1966.0 5.0 Retired 1932-02-07 \n",
+ "355 John W. Young 1962.0 2.0 Retired 1930-09-24 \n",
+ "356 George D. Zamka 1998.0 17.0 Retired 1962-06-29 \n",
+ "\n",
+ " Birth Place Gender \\\n",
+ "0 Inglewood, CA Male \n",
+ "1 Lewiston, MT Male \n",
+ "2 Warsaw, NY Male \n",
+ "3 St. Louis, MO Male \n",
+ "4 Montclair, NJ Male \n",
+ ".. ... ... \n",
+ "352 Indianapolis, IN Male \n",
+ "353 Chicago, IL Male \n",
+ "354 Jackson, MI Male \n",
+ "355 San Francisco, CA Male \n",
+ "356 Jersey City, NJ Male \n",
+ "\n",
+ " Alma Mater \\\n",
+ "0 University of California-Santa Barbara; Univer... \n",
+ "1 Montana State University; University of Colorado \n",
+ "2 US Military Academy; Princeton University \n",
+ "3 University of Missouri-Rolla \n",
+ "4 US Military Academy; MIT \n",
+ ".. ... \n",
+ "352 Purdue University; Indiana University \n",
+ "353 MIT; University of Texas-Austin; George Washin... \n",
+ "354 US Military Academy; University of Michigan \n",
+ "355 Georgia Institute of Technology \n",
+ "356 US Naval Academy; Florida Institute of Technology \n",
+ "\n",
+ " Undergraduate Major Graduate Major \\\n",
+ "0 Geology Geology \n",
+ "1 Engineering Physics Solar Physics \n",
+ "2 Engineering Aerospace Engineering \n",
+ "3 Applied Mathematics Applied Mathematics \n",
+ "4 Mechanical Engineering Astronautics \n",
+ ".. ... ... \n",
+ "352 Electrical Engineering Medicine \n",
+ "353 Physics Physics; Business Management \n",
+ "354 Military Science Aeronautical & Astronautical Engineering \n",
+ "355 Aeronautical Engineering NaN \n",
+ "356 Mathematics Engineering Management \n",
+ "\n",
+ " Military Rank Military Branch Space Flights \\\n",
+ "0 NaN NaN 2 \n",
+ "1 NaN NaN 1 \n",
+ "2 Colonel US Army (Retired) 2 \n",
+ "3 Colonel US Air Force (Retired) 4 \n",
+ "4 Colonel US Air Force (Retired) 2 \n",
+ ".. ... ... ... \n",
+ "352 NaN NaN 3 \n",
+ "353 Commander US Navy 0 \n",
+ "354 Colonel US Air Force (Retired) 1 \n",
+ "355 Captain US Navy (Retired) 6 \n",
+ "356 Colonel US Marine Corps (Retired) 2 \n",
+ "\n",
+ " Space Flight (hr) Space Walks Space Walks (hr) \\\n",
+ "0 3307 2 13.0 \n",
+ "1 190 0 0.0 \n",
+ "2 334 0 0.0 \n",
+ "3 814 4 29.0 \n",
+ "4 289 2 8.0 \n",
+ ".. ... ... ... \n",
+ "352 4044 7 41.0 \n",
+ "353 0 0 0.0 \n",
+ "354 295 1 0.5 \n",
+ "355 835 3 20.0 \n",
+ "356 692 0 0.0 \n",
+ "\n",
+ " Missions Death Date \\\n",
+ "0 STS-119 (Discovery), ISS-31/32 (Soyuz) NaN \n",
+ "1 STS 51-F (Challenger) NaN \n",
+ "2 STS-28 (Columbia), STS-43 (Atlantis) NaN \n",
+ "3 STS-41 (Discovery), STS-49 (Endeavor), STS-61 ... NaN \n",
+ "4 Gemini 12, Apollo 11 NaN \n",
+ ".. ... ... \n",
+ "352 STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo... NaN \n",
+ "353 NaN NaN \n",
+ "354 Apollo 15 NaN \n",
+ "355 Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS... NaN \n",
+ "356 STS-120 (Discovery), STS-130 (Endeavor) NaN \n",
+ "\n",
+ " Death Mission \n",
+ "0 NaN \n",
+ "1 NaN \n",
+ "2 NaN \n",
+ "3 NaN \n",
+ "4 NaN \n",
+ ".. ... \n",
+ "352 NaN \n",
+ "353 NaN \n",
+ "354 NaN \n",
+ "355 NaN \n",
+ "356 NaN \n",
+ "\n",
+ "[357 rows x 19 columns]"
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "pd.read_csv(\"astronaut.csv\", sep = \" \")"
]
},
{
@@ -270,18 +2208,267 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 46,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\Users\\Ana\\AppData\\Local\\Temp\\ipykernel_15660\\1541822520.py:2: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.\n",
+ " fertility = pd.read_csv(\"fertility_Diagnosis.txt\", sep=\"\\,\", names=columns)\n"
+ ]
+ }
+ ],
"source": [
- "# Your code here:\n",
- "\n"
+ "columns = ['Season', 'Age at time', 'Diseases', 'Accident/trauma', 'Surgical intervention', 'Fevers last year', 'Freq alcohol', 'Smoking habit', 'Numb(h)/day ene-16', 'Output diagnosis']\n",
+ "fertility = pd.read_csv(\"fertility_Diagnosis.txt\", sep=\"\\,\", names=columns)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Season | \n",
+ " Age at time | \n",
+ " Diseases | \n",
+ " Accident/trauma | \n",
+ " Surgical intervention | \n",
+ " Fevers last year | \n",
+ " Freq alcohol | \n",
+ " Smoking habit | \n",
+ " Numb(h)/day ene-16 | \n",
+ " Output diagnosis | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " -0.33 | \n",
+ " 0.69 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0.8 | \n",
+ " 0 | \n",
+ " 0.88 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " -0.33 | \n",
+ " 0.94 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0.8 | \n",
+ " 1 | \n",
+ " 0.31 | \n",
+ " O | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " -0.33 | \n",
+ " 0.50 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " -1 | \n",
+ " 0.50 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " -0.33 | \n",
+ " 0.75 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " -1 | \n",
+ " 0.38 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " -0.33 | \n",
+ " 0.67 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0.8 | \n",
+ " -1 | \n",
+ " 0.50 | \n",
+ " O | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 95 | \n",
+ " -1.00 | \n",
+ " 0.67 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " -1 | \n",
+ " 0.50 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 96 | \n",
+ " -1.00 | \n",
+ " 0.61 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0.8 | \n",
+ " 0 | \n",
+ " 0.50 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 97 | \n",
+ " -1.00 | \n",
+ " 0.67 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " -1 | \n",
+ " 0.31 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 98 | \n",
+ " -1.00 | \n",
+ " 0.64 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 0 | \n",
+ " 0.19 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ " | 99 | \n",
+ " -1.00 | \n",
+ " 0.69 | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " 0 | \n",
+ " 0.6 | \n",
+ " -1 | \n",
+ " 0.19 | \n",
+ " N | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
100 rows × 10 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Season Age at time Diseases Accident/trauma Surgical intervention \\\n",
+ "0 -0.33 0.69 0 1 1 \n",
+ "1 -0.33 0.94 1 0 1 \n",
+ "2 -0.33 0.50 1 0 0 \n",
+ "3 -0.33 0.75 0 1 1 \n",
+ "4 -0.33 0.67 1 1 0 \n",
+ ".. ... ... ... ... ... \n",
+ "95 -1.00 0.67 1 0 0 \n",
+ "96 -1.00 0.61 1 0 0 \n",
+ "97 -1.00 0.67 1 1 1 \n",
+ "98 -1.00 0.64 1 0 1 \n",
+ "99 -1.00 0.69 0 1 1 \n",
+ "\n",
+ " Fevers last year Freq alcohol Smoking habit Numb(h)/day ene-16 \\\n",
+ "0 0 0.8 0 0.88 \n",
+ "1 0 0.8 1 0.31 \n",
+ "2 0 1.0 -1 0.50 \n",
+ "3 0 1.0 -1 0.38 \n",
+ "4 0 0.8 -1 0.50 \n",
+ ".. ... ... ... ... \n",
+ "95 0 1.0 -1 0.50 \n",
+ "96 0 0.8 0 0.50 \n",
+ "97 0 1.0 -1 0.31 \n",
+ "98 0 1.0 0 0.19 \n",
+ "99 0 0.6 -1 0.19 \n",
+ "\n",
+ " Output diagnosis \n",
+ "0 N \n",
+ "1 O \n",
+ "2 N \n",
+ "3 N \n",
+ "4 O \n",
+ ".. ... \n",
+ "95 N \n",
+ "96 N \n",
+ "97 N \n",
+ "98 N \n",
+ "99 N \n",
+ "\n",
+ "[100 rows x 10 columns]"
+ ]
+ },
+ "execution_count": 47,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "fertility = pd.DataFrame(fertility)\n",
+ "fertility"
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -295,7 +2482,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.6"
+ "version": "3.10.9"
}
},
"nbformat": 4,