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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
012
01PENELOPEGUINESS
12NICKWAHLBERG
23EDCHASE
34JENNIFERDAVIS
45JOHNNYLOLLOBRIGIDA
............
195196BELAWALKEN
196197REESEWEST
197198MARYKEITEL
198199JULIAFAWCETT
199200THORATEMPLE
\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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
:@computed_region_cbhk_fwbd:@computed_region_nnqa_25f4fallgeolocationidmassnamenametyperecclassreclatreclongyear
0NaNNaNFell{'type': 'Point', 'coordinates': [6.08333, 50....121.0AachenValidL550.775006.083331880-01-01T00:00:00.000
1NaNNaNFell{'type': 'Point', 'coordinates': [10.23333, 56...2720.0AarhusValidH656.1833310.233331951-01-01T00:00:00.000
2NaNNaNFell{'type': 'Point', 'coordinates': [-113, 54.216...6107000.0AbeeValidEH454.21667-113.000001952-01-01T00:00:00.000
3NaNNaNFell{'type': 'Point', 'coordinates': [-99.9, 16.88...101914.0AcapulcoValidAcapulcoite16.88333-99.900001976-01-01T00:00:00.000
4NaNNaNFell{'type': 'Point', 'coordinates': [-64.95, -33....370780.0AchirasValidL6-33.16667-64.950001902-01-01T00:00:00.000
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
timerad_flowfpv_closefpv_openhighbypassbpv_closebpv_openclass
550810-6112588644
56096052-4404444
50-189-7500394021
53979042-22537124
55282054-6262821
..............................
800840-36-2941201165
550810-202526102764
55077012-222265424
370103018-166685201
562980521424644
\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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
timerad_flowfpv_closefpv_openhighbypassbpv_closebpv_openclass
550810-6112588644
56096052-4404444
50-189-7500394021
53979042-22537124
55282054-6262821
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameYearGroupStatusBirth DateBirth PlaceGenderAlma MaterUndergraduate MajorGraduate MajorMilitary RankMilitary BranchSpace FlightsSpace Flight (hr)Space WalksSpace Walks (hr)MissionsDeath DateDeath Mission
0Joseph M. Acaba2004.019.0Active1967-05-17Inglewood, CAMaleUniversity of California-Santa Barbara; Univer...GeologyGeologyNaNNaN23307213.0STS-119 (Discovery), ISS-31/32 (Soyuz)NaTNaN
1Loren W. ActonNaNNaNRetired1936-03-07Lewiston, MTMaleMontana State University; University of ColoradoEngineering PhysicsSolar PhysicsNaNNaN119000.0STS 51-F (Challenger)NaTNaN
2James C. Adamson1984.010.0Retired1946-03-03Warsaw, NYMaleUS Military Academy; Princeton UniversityEngineeringAerospace EngineeringColonelUS Army (Retired)233400.0STS-28 (Columbia), STS-43 (Atlantis)NaTNaN
3Thomas D. Akers1987.012.0Retired1951-05-20St. Louis, MOMaleUniversity of Missouri-RollaApplied MathematicsApplied MathematicsColonelUS Air Force (Retired)4814429.0STS-41 (Discovery), STS-49 (Endeavor), STS-61 ...NaTNaN
4Buzz Aldrin1963.03.0Retired1930-01-20Montclair, NJMaleUS Military Academy; MITMechanical EngineeringAstronauticsColonelUS Air Force (Retired)228928.0Gemini 12, Apollo 11NaTNaN
............................................................
352David A. Wolf1990.013.0Retired1956-08-23Indianapolis, INMalePurdue University; Indiana UniversityElectrical EngineeringMedicineNaNNaN34044741.0STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo...NaTNaN
353Neil W. Woodward III1998.017.0Retired1962-07-26Chicago, ILMaleMIT; University of Texas-Austin; George Washin...PhysicsPhysics; Business ManagementCommanderUS Navy0000.0NaNNaTNaN
354Alfred M. Worden1966.05.0Retired1932-02-07Jackson, MIMaleUS Military Academy; University of MichiganMilitary ScienceAeronautical & Astronautical EngineeringColonelUS Air Force (Retired)129510.5Apollo 15NaTNaN
355John W. Young1962.02.0Retired1930-09-24San Francisco, CAMaleGeorgia Institute of TechnologyAeronautical EngineeringNaNCaptainUS Navy (Retired)6835320.0Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS...NaTNaN
356George D. Zamka1998.017.0Retired1962-06-29Jersey City, NJMaleUS Naval Academy; Florida Institute of TechnologyMathematicsEngineering ManagementColonelUS Marine Corps (Retired)269200.0STS-120 (Discovery), STS-130 (Endeavor)NaTNaN
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameYearGroupStatusBirth DateBirth PlaceGenderAlma MaterUndergraduate MajorGraduate MajorMilitary RankMilitary BranchSpace FlightsSpace Flight (hr)Space WalksSpace Walks (hr)MissionsDeath DateDeath Mission
0Joseph M. Acaba2004.019.0Active1967-05-17Inglewood, CAMaleUniversity of California-Santa Barbara; Univer...GeologyGeologyNaNNaN23307213.0STS-119 (Discovery), ISS-31/32 (Soyuz)NaTNaN
1Loren W. ActonNaNNaNRetired1936-03-07Lewiston, MTMaleMontana State University; University of ColoradoEngineering PhysicsSolar PhysicsNaNNaN119000.0STS 51-F (Challenger)NaTNaN
2James C. Adamson1984.010.0Retired1946-03-03Warsaw, NYMaleUS Military Academy; Princeton UniversityEngineeringAerospace EngineeringColonelUS Army (Retired)233400.0STS-28 (Columbia), STS-43 (Atlantis)NaTNaN
3Thomas D. Akers1987.012.0Retired1951-05-20St. Louis, MOMaleUniversity of Missouri-RollaApplied MathematicsApplied MathematicsColonelUS Air Force (Retired)4814429.0STS-41 (Discovery), STS-49 (Endeavor), STS-61 ...NaTNaN
4Buzz Aldrin1963.03.0Retired1930-01-20Montclair, NJMaleUS Military Academy; MITMechanical EngineeringAstronauticsColonelUS Air Force (Retired)228928.0Gemini 12, Apollo 11NaTNaN
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameYearGroupStatusBirth DateBirth PlaceGenderAlma MaterUndergraduate MajorGraduate MajorMilitary RankMilitary BranchSpace FlightsSpace Flight (hr)Space WalksSpace Walks (hr)MissionsDeath DateDeath Mission
0Joseph M. Acaba2004.019.0Active1967-05-17Inglewood, CAMaleUniversity of California-Santa Barbara; Univer...GeologyGeologyNaNNaN23307213.0STS-119 (Discovery), ISS-31/32 (Soyuz)NaNNaN
1Loren W. ActonNaNNaNRetired1936-03-07Lewiston, MTMaleMontana State University; University of ColoradoEngineering PhysicsSolar PhysicsNaNNaN119000.0STS 51-F (Challenger)NaNNaN
2James C. Adamson1984.010.0Retired1946-03-03Warsaw, NYMaleUS Military Academy; Princeton UniversityEngineeringAerospace EngineeringColonelUS Army (Retired)233400.0STS-28 (Columbia), STS-43 (Atlantis)NaNNaN
3Thomas D. Akers1987.012.0Retired1951-05-20St. Louis, MOMaleUniversity of Missouri-RollaApplied MathematicsApplied MathematicsColonelUS Air Force (Retired)4814429.0STS-41 (Discovery), STS-49 (Endeavor), STS-61 ...NaNNaN
4Buzz Aldrin1963.03.0Retired1930-01-20Montclair, NJMaleUS Military Academy; MITMechanical EngineeringAstronauticsColonelUS Air Force (Retired)228928.0Gemini 12, Apollo 11NaNNaN
............................................................
352David A. Wolf1990.013.0Retired1956-08-23Indianapolis, INMalePurdue University; Indiana UniversityElectrical EngineeringMedicineNaNNaN34044741.0STS-58 (Columbia). STS-86/89 (Atlantis/Endeavo...NaNNaN
353Neil W. Woodward III1998.017.0Retired1962-07-26Chicago, ILMaleMIT; University of Texas-Austin; George Washin...PhysicsPhysics; Business ManagementCommanderUS Navy0000.0NaNNaNNaN
354Alfred M. Worden1966.05.0Retired1932-02-07Jackson, MIMaleUS Military Academy; University of MichiganMilitary ScienceAeronautical & Astronautical EngineeringColonelUS Air Force (Retired)129510.5Apollo 15NaNNaN
355John W. Young1962.02.0Retired1930-09-24San Francisco, CAMaleGeorgia Institute of TechnologyAeronautical EngineeringNaNCaptainUS Navy (Retired)6835320.0Gemini 3, Gemini 10, Apollo 10, Apollo 16, STS...NaNNaN
356George D. Zamka1998.017.0Retired1962-06-29Jersey City, NJMaleUS Naval Academy; Florida Institute of TechnologyMathematicsEngineering ManagementColonelUS Marine Corps (Retired)269200.0STS-120 (Discovery), STS-130 (Endeavor)NaNNaN
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
SeasonAge at timeDiseasesAccident/traumaSurgical interventionFevers last yearFreq alcoholSmoking habitNumb(h)/day ene-16Output diagnosis
0-0.330.6901100.800.88N
1-0.330.9410100.810.31O
2-0.330.5010001.0-10.50N
3-0.330.7501101.0-10.38N
4-0.330.6711000.8-10.50O
.................................
95-1.000.6710001.0-10.50N
96-1.000.6110000.800.50N
97-1.000.6711101.0-10.31N
98-1.000.6410101.000.19N
99-1.000.6901100.6-10.19N
\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,