Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction information Exercise 1: Exercise 2: Exercise 3: (Please solve functions in exercise in Python Code) Part 1 The tollowing code loads the olympics dataset

Introduction information image text in transcribed
image text in transcribed
Exercise 1:
image text in transcribed
Exercise 2:
image text in transcribed
Exercise 3:
image text in transcribed
(Please solve functions in exercise in Python Code)
Part 1 The tollowing code loads the olympics dataset (olympics.csv), which was derrived from the Wikpedia entry on All Time olympkc Games Medals, and does some basic data cleaning The columns are organized as # of Summer games, summer medals # of winter games, Winter medals total # number of games, total # of medals Use this dataset to answer the questions below : import pandas as pd df pd.read_csv('olympics.csv', index col-e, skiprows-1) for col in df.columns: if col[:2]--01' if col[ : 2-?02 . : if col[:2]--03: if col[:1]- df.rename(columns (col: 'Gold' col[4:]), inplace-True) df.rename(columns-(col: 'Silver'+col[4:]), inplace-True) oruns-(col: Bronze'icol[4:). Inplace-True) df.rename(columns-(col: +col[I:)), ?nplace.True) names_ids -df.index . str. split('\s\(.) # split the index by ,( df. index-names-ids. str[0] # the [0] element df[.ID, ] . names-ids . str[1].str[:3] # the [1] is the country name (new index) element is the abbreviation or ID (take first 3 characters from that) df df.drop( Totals) df.head(O

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions