Question: Python Exercise: Stupid Trick 1 Here youll create a couple of small dicts, put them in a list, and then use the list to create

Python Exercise:

Stupid Trick 1

Here youll create a couple of small dicts, put them in a list, and then use the list to create a Pandas DataFrame.

Step 1 - create the following three dicts.

DictA has the following key:value pairs:

a:1, b:2, c:3

DictB has these:

a:10, b:20, c:30

And, DictC has these:

a: 100, b:200, c:300

Step 2 Make ListODicts, a Python list that has the three Dicts, above, as elements.

Step 3 Use ListODicts to create a Pandas DataFrame, like pd.DataFrame(ListODicts)

Describe this DataFrame. Whats it like?

Stupid Trick 2

For this one youre going to append a couple of DataFrames

Step 1 create the following Dicts:

DictA = {a:[1,2,3,4],b:[5,6,7,8],c: [10,9,8,7]}

DictB = {a:[100,200,300,4000],c:[50,60,70,80],g:[1000,2000,3000,0000]}

Step 2 Make "FrameA," a DataFrame, using DictA, and "FrameB," a DataFrame, using DictB

Step 3 Append FrameB to FrameA so that the roes in FrameB follow the rows in FrameA. When you do this, make the index in the resulting DataFrame have unique index values for the rows.

Describe this new DataFrame. What does it look like? Is there anything about it that surprises you?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!