Question 1.1 It looks like the departure and arrival in flights were read in as floating-point numbers. Write two functions, extract_hour and extract_mins that converts military time to hours and minutes, respectively. Hint: You may want to use modular arithmetic and integer division. Keep in mind that the data has not been cleaned and you need to check whether the extracted values are valid. Replace all the invalid values with NaN . The documentation for pandas.Series.where provided here should be helpful. In [ ]: def extract_hour(time): H Extracts hour information from military time. Args: time (float64): series of time given in military format. Takes on values in 0.0-2359.0 due to float64 representation. Returns: array (float64): series of input dimension with hour information. Should only take on integer values in 0-23 *** # [YOUR CODE HERE] # You MUST add comments explaining your thought process, # and the resources you used to solve this question (if any) hour return hour 'blabla' # test your code test_ser = pd.Series ([1030.0, 1259.0, np.nan, 2400], dtype='float64') extract_hour(test_ser) 10.0 12.0 NaN NaN # 0 # 1 # 2 # 3 #dtype: float64
Question 1.1 It looks like the departure and arrival in flights were read in as floating-point numbers. Write two functions, extract_hour and extract_mins that converts military time to hours and minutes, respectively. Hint: You may want to use modular arithmetic and integer division. Keep in mind that the data has not been cleaned and you need to check whether the extracted values are valid. Replace all the invalid values with NaN . The documentation for pandas.Series.where provided here should be helpful. In [ ]: def extract_hour(time): H Extracts hour information from military time. Args: time (float64): series of time given in military format. Takes on values in 0.0-2359.0 due to float64 representation. Returns: array (float64): series of input dimension with hour information. Should only take on integer values in 0-23 *** # [YOUR CODE HERE] # You MUST add comments explaining your thought process, # and the resources you used to solve this question (if any) hour return hour 'blabla' # test your code test_ser = pd.Series ([1030.0, 1259.0, np.nan, 2400], dtype='float64') extract_hour(test_ser) 10.0 12.0 NaN NaN # 0 # 1 # 2 # 3 #dtype: float64
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
Related questions
Question
airports.dat and airlines.dat, respectively. Both were sourced from http://openflights.org/data.html.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education