Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JupytrLab Please help me with the first exercise my professor has not answered any of my emails. I have no idea what Im doing. Thank

JupytrLab
Please help me with the first exercise my professor has not answered any of my emails. I have no idea what Im doing.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Thank you very much
Se birthwt.txt X X Chapter_02.pynb Markdown a + X 0 Python 3 ? Biostatics with Python Chapter 2: Data Exploration In this lesson you will learn about: Reading data files . Using the head method to look at duta Use various counting methods to extract information from a dataframe Make a Bar Plot Make Ple Charts Lesson Setup Run the next call to load the necessary Python packages for this on inport pada od import matplottib.pplot soit plerault) import BRDY inport satplot.pl Example 1A: Load the Pima dataset The cell below verses the command pd,read csv) to read the Pinatxt file and loads the information into the Pandas datatrame variable pinar You should notice that the commana pd. read si has three arguments, the file name in quotes 12 headers and (3. This tast argument is important since you will need to change it depending upon the data is the data e Pinatxt the variables are separated by a com python needs sow this in order to read the file correctly MC tha rel Tabs Settings Help x birthwext B + XD Chapter_02.ipynb Markdown 21 Python 3 O Examplo 1A: Load the Pima dataset The cell below uses the command pd. read_csv, to read the Pina, txt file and loads the information into the Pandas datarame variable pina_df You should notice that the command pd. rendesvol has three arguments, the file name in quotes, (2) header, and (3), sep"This last argument is important, since you will need to change it depending upon the data file, in the data tle Pino.txt, the valables are separated by a comma. Python needs to know this in order to read the file correctly 1911 # Example 1A Read datorite and create new datare variable Use the argument sep Since this is a can searated variable rate (CSV) pinadfodreads in header, er Mt you get an error, it probably means the file "Prima txt is not in your current working directory Example 18: Use the head(function to verify the contents of your dataframe the cell below the head method to read out the first entries in the datatrame pind whenever you read data file to create a new dature, you should always use the best function to verify that you have read the data correctly Print the first record Die af.head norepinned a wype 0 2010203064 3261 0101 18 1 7105 5 102 313 0.16 3 5 0100 434102020 N 0.25 764 01332 NE You should notice that date values are ranged under the foreheading they are not neatly and the You don't use the correct Valor these argume Fle Edit View Run Karnel Tabs Settings Help Ehitwat x Chapter 02 pynt Downloads Chapter 02/ a + KDO . o Marlon Pythona You should notice that data values are neatly arranged under the different ding we not really wranged, kly that you didn't use the correct Name value for the sen argument | Th" v bit. Exercise 1A: Load the BirthWt data set instastog ng in the cell below, use the pd. real.cat command, to read the contents of the data la called "birthwew. For this text file, you must use the Chapter 02 argument set instead of used in Example 1. Load the data into a Pandas datufram varluble caled bt_t Dim. Untitled.jpynt - predavalno.txt", haders, if you get an error, it could mean that the file birthwt.txt" is not in your current working directory, or that the filename has been misspelled, or the filename was surrounded by quotation marks Exercise 1B: Use the head method to print out the first 5 records in the cell below print out the first five records in the dataframe but_df using the head method Die.20 if you code is correct, you should see the following: loa 9lwt racemake duft but . 0 192 0001 0221 1 1155 0.00 33351 2 30 105 white 1000 2 21 O wie 101 225 4 . 18 107 w 1001 02500 If your data values are not neatly aligned under the column headings, you probably wed the wrong value for the separgument when you read the data ile Python 3 View Karel Tabeetings 0 Ebatt X Chapter 02 pyib Downloads/Chaster92 + XOO Markdown Name If you code is correct, you should see the following: binet 2010 lowe Iwwe woke pet witty but Diwa 0 0 19 182 back 0001 0253 Sosting 1 033 155 other 0 000 2550 Our lo 2 0105 3021 108 white 10012204 ledyr 4018107 while 1 0 1 0 your data values are not really signed under the column headings, you probably used the wrong value for the spargument when you read the data de Example 2: Counting the entries in a column The following cell shows how to count the total number of entries in the type column. Count the hub of records in a particular cataract pimurtypel.count tror Traceback strant call last) chat-3-7717 In 3. Count the articular pin_drol.com i is not defined Since there we 200 records, and since there is no missing data, the number of entries should be 200, which is the number of women in the study in many real data sets, some records might be missing a valu Exercise 2: Counting column values in a dataframe The following cell write the Python code needed to count the number of entries in the race column of the but_df

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago