Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am working on this exercise for Python! Can anyone help? (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the

I am working on this exercise for Python! Can anyone help?

(a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table() function. Check the first five rows.

(b) Create a new dataframe called tips by randomly sampling 6 records from the dataframe tips_df. Refer to the sample() function documentation.

(c) Add a new column to tips called idx as a list ['one', 'two', 'three', 'four', 'five', 'six'] and then later assign it as the index of tips dataframe. Display the dataframe.

(d) Create a new Series called kids as Series([1, 2, 1], index = ['two', 'five', 'six']). Assign the series as a new column in the dataframe.

(e) List the various columns in the dataframe using the columns attribute of the dataframe. Also, check the various column datatypes in the dataframe.

(f) Transpose the dataframe tips.

(g) Check the name of the dataframe index. If there isn't one, assign a new name.

(h) Check the name of the dataframe columns. If there isn't one, assign a new name.

(i) List the rows in the dataframe using the values attribute of the dataframe. Check the datatype of the result.

(j) Check if 'time' is one of the columns in the dataframe. Use set-like operation in.

(k) Check if 'six' is one of the index values in the dataframe. Use set-like operation in.

(l) Check if 'seven' is one of the index values in the dataframe. Use set-like operation in.

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

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions

Question

What is meant by shareholders funds?

Answered: 1 week ago