# B4. Assign a SINGLE expression that creates a tuple of the squares of even numbers # from `data = [1, 2, 3, 4, 5, 6]`.data = [1, 2, 3, 4, 5, 6]B4 = … # your answer here
Blog
# Shared data for all SECTION B questionss = pd.Series([10.8…
# Shared data for all SECTION B questionss = pd.Series([10.8, 20.5, 30.2, 40.4], index=[“a”, “b”, “c”, “d”])t = pd.Series([20.5, 5.4, 10.8, 15.6], index=[“a”, “b”, “c”, “d”])df = pd.DataFrame({ “product”: [“A”, “B”, “A”, “C”], “units”: [10, 3, 8, 5], “price”: [2.5, 5.0, 3.0, 4.5], “region”: [“West”,”West”,”East”,”East”]}, index=[0,1,2,3]) # B7. Assign a SINGLE expression that returns a DataFrame containing only# the columns ‘product’ and ‘price’ using .iloc[] integer-based indexing.B7 = … # your answer here
# Shared data for all SECTION B questionss = pd.Series([10.8…
# Shared data for all SECTION B questionss = pd.Series([10.8, 20.5, 30.2, 40.4], index=[“a”, “b”, “c”, “d”])t = pd.Series([20.5, 5.4, 10.8, 15.6], index=[“a”, “b”, “c”, “d”])df = pd.DataFrame({ “product”: [“A”, “B”, “A”, “C”], “units”: [10, 3, 8, 5], “price”: [2.5, 5.0, 3.0, 4.5], “region”: [“West”,”West”,”East”,”East”]}, index=[0,1,2,3]) # B8. Assign a SINGLE expression that returns the total number of units across all rows (a single integer).B8 = … # your answer here
# B7. Using NumPy, assign a SINGLE expression that creates a…
# B7. Using NumPy, assign a SINGLE expression that creates a 1D float array [1.0, 2.0, 3.0].B7 = … # your answer here
# Q2. What does this dict comprehension produce?# `src =…
# Q2. What does this dict comprehension produce?# `src = [(“a”,1), (“b”,2)]; d = {k:v for (k,v) in src}`# A) [(“a”,1), (“b”,2)]# B) {“a”:1, “b”:2}# C) {(“a”,1), (“b”,2)}# D) (“a”:1, “b”:2)
# Q8. Which call correctly creates a modern, reproducible Nu…
# Q8. Which call correctly creates a modern, reproducible NumPy Generator seeded with 404?# A) rng = np.random.RandomState(404)# B) rng = np.random.seed(404)# C) rng = np.random.default_rng(404)# D) rng = np.random.Generator(404)
# Q9. Which produces a frequency count of values in Series `…
# Q9. Which produces a frequency count of values in Series `s`?# A) s.counts()# B) s.value_counts()# C) s.hist()# D) s.describe()
# B4. Given `s = “ABcd”`, assign a SINGLE expression that re…
# B4. Given `s = “ABcd”`, assign a SINGLE expression that returns the lowercase version.s = “ABcd”B4 = … # your answer here
# Q10. Create the date October 31, 2025:# A) datetime.da…
# Q10. Create the date October 31, 2025:# A) datetime.date(2025, 10, 31)# B) datetime(2025, 10, 31)# C) date(10, 31, 2025)# D) datetime.date(“2025-10-31”)
# Q3. Which expression correctly filters rows where df[‘unit…
# Q3. Which expression correctly filters rows where df[‘units’] > 10?# A) df[df[‘units’] > 10]# B) df.where(df[‘units’] > 10)# C) df.loc[:, df[‘units’] > 10]# D) df.filter(df[‘units’] > 10)