Question
Do the following in PYTHON, using Pandas Stupid Trick 1 Here youll create a couple of small dicts, put them in a list, and then
Do the following in PYTHON, using Pandas
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started