0.5) (a) Create a Series object named sl from x, s2 from y, and s3 from z. Set the index of each object to index-['r','r2','ra','r4','r5','r6']. (b) Create a DataFrame object (named dr ) from the Series objects you created in part (a). Set the column names of the dataframe to names ['coll','col2','co13']. (2) (a) Consider the dataframe that you created in Problem 1 (b). Sort the dataframe by the firrst column in the ascending order. Name as df_ascending (b) Consider your sorted dataframe from part (a). Generate a column (named colo) as the logarithm of the thind column (col3) of the dataframe. Add colo to the dataframe. Your resulting dataframe should be in the following form. Name this new dataframe as dr_log s919 coll co12 cola

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
(1) Consider the following interaction with Python:
x=[1,2,34,5,6, ap.nan]
y-(10,1,2,5,'Missing',6.3)
2-f'a': 0.1, 'b': 1.2, "c': mp.nan,"d':4,'e':5.1, '1' :0.5)
(a) Create a Series object named sl from x, s2 from y, and s3 from z. Set the index
of each object to
inder=['rl','r2','r3','r4','15',"r6'1.
(b) Create a DataFrame object (named df) from the Series objects you created in
part (a). Set the column names of the dataframe to
names= ['coll','col2','col3'1.
(2) (a) Consider the dataframe that you created in Problem 1 (b). Sort the dataframe by
the firrst column in the ascending order. Name as df_ascending
(b) Consider your sorted dataframe from part (a). Generate a column (named col0) as
the logarithm of the thind column (col3) of the dataframe. Add colo to the dataframe.
Your resulting dataframe should be in the following form. Name this new dataframe as
df_log
col
r5
NaN
34
-0.693147
0.5
(c) Consider the dataframe that you created in part (b). Select the first and the last rows
of colo and col3. You should get the following dataframe. Name this new dataframe as
df_selected
co10
-2.302585
r6 -0.693147
co13
0.1
(3) (a) Consider the following interaction with Python:
z-[1.2,34,5,6. ap.nan]
y-(10,1,2,5, Missing,6.3)
2=[0.1, 1.2, ap.nan,4,5.1,0.5]
df1-DataFrame({'col:Series (z), col2':Series (y),
col3': Series (x)})
df1.index=['a,'b','c','d',','t']
Replace the NaN value in coll with -9, the Missing value in col2 with -99, and the NaN
value in col3 with -999 with relevant functions. Name as dn_replaced
Transcribed Image Text:(1) Consider the following interaction with Python: x=[1,2,34,5,6, ap.nan] y-(10,1,2,5,'Missing',6.3) 2-f'a': 0.1, 'b': 1.2, "c': mp.nan,"d':4,'e':5.1, '1' :0.5) (a) Create a Series object named sl from x, s2 from y, and s3 from z. Set the index of each object to inder=['rl','r2','r3','r4','15',"r6'1. (b) Create a DataFrame object (named df) from the Series objects you created in part (a). Set the column names of the dataframe to names= ['coll','col2','col3'1. (2) (a) Consider the dataframe that you created in Problem 1 (b). Sort the dataframe by the firrst column in the ascending order. Name as df_ascending (b) Consider your sorted dataframe from part (a). Generate a column (named col0) as the logarithm of the thind column (col3) of the dataframe. Add colo to the dataframe. Your resulting dataframe should be in the following form. Name this new dataframe as df_log col r5 NaN 34 -0.693147 0.5 (c) Consider the dataframe that you created in part (b). Select the first and the last rows of colo and col3. You should get the following dataframe. Name this new dataframe as df_selected co10 -2.302585 r6 -0.693147 co13 0.1 (3) (a) Consider the following interaction with Python: z-[1.2,34,5,6. ap.nan] y-(10,1,2,5, Missing,6.3) 2=[0.1, 1.2, ap.nan,4,5.1,0.5] df1-DataFrame({'col:Series (z), col2':Series (y), col3': Series (x)}) df1.index=['a,'b','c','d',','t'] Replace the NaN value in coll with -9, the Missing value in col2 with -99, and the NaN value in col3 with -999 with relevant functions. Name as dn_replaced
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education