Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a pandas and the following 3 colums: 'row _ position': integers from 0 to 9 9 . 'row _ index': integers from 1 to

Create a pandas and the following 3 colums:
'row_position': integers from 0 to 99.
'row_index': integers from 1 to 100.
'random_text' : any string of your choice (can be the same for all rows).
Here is how the DataFrame should look like (first 5 rows)
Print the first and last 5 rows of the DataFrame (in two separate commands).
Set the values of the 'row_index' column as of the dataframe. After this operation, the
index values should be numbers from 1 to 100, and not from 0 to 99(the default).
Create a selection of the first 7 rows and the first 2 columns of the DataFrame using
'.loc' and '.iloc' (i.e. please perform the selection twice, once with '.loc' and once with '.iloc').
Add a new column named 'reverse_index' that contains index values in the reverse order (so, basically,
the numbers from 100 to 1).
Delete the 'index' column from the data frame.
Create a selection of all rows with an index number multiple of 11(i.e. rows with index 11,22,33,
etc..) and the first 2 columns of the data frame.
image text in transcribed

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

8.3 Describe special considerations for onboarding.

Answered: 1 week ago