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.
![In [ ]: def extract_mins(time):
Extracts minute 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 minute information.
Should only take on integer values in 0-59
|||||
# [YOUR CODE HERE]
# You MUST add comments explaining your thought process,
# and the resources you used to solve this question (if any)
mins='blabla'
return mins
# test your code
test_ser = pd.Series ([1030.0, 1259.0, np.nan, 2475], dtype='float64')
extract_mins (test_ser)
# 0
# 1
# 2
# 3
#dtype: float64
30.0
59.0
NaN
NaN](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F672bf286-8abe-4b07-9ca1-0d5b2612956c%2F474a30d4-184f-40d3-9869-26f0223d9ecb%2Fwwlznzb_processed.png&w=3840&q=75)
Transcribed Image Text:In [ ]: def extract_mins(time):
Extracts minute 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 minute information.
Should only take on integer values in 0-59
|||||
# [YOUR CODE HERE]
# You MUST add comments explaining your thought process,
# and the resources you used to solve this question (if any)
mins='blabla'
return mins
# test your code
test_ser = pd.Series ([1030.0, 1259.0, np.nan, 2475], dtype='float64')
extract_mins (test_ser)
# 0
# 1
# 2
# 3
#dtype: float64
30.0
59.0
NaN
NaN
![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):
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 'blabla'
return hour
=
# 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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F672bf286-8abe-4b07-9ca1-0d5b2612956c%2F474a30d4-184f-40d3-9869-26f0223d9ecb%2Fldq0om_processed.png&w=3840&q=75)
Transcribed Image Text: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):
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 'blabla'
return hour
=
# 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
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