Coding - mock quiz

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:09 PM on 3/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

22 Terms

1
New cards

when should you use pd.to_datetime() instead of astype(‘datetime64’) ?

when you need to specify date formats or handle errors

2
New cards

1 line code — to drop the column named “ID” from DataFrame df.

df.drop(['ID'])

3
New cards

1 line code — to remove all dollar signs ($) from the “Price” columnin DataFrame df.

df['Price'] = df['Price'].str.replace('$', '', regex=False)

4
New cards

when would you use df.info() instead of df.head() ?

to check data types and missing value counts

5
New cards

which pandas function converts a string column to datetime format ?

pd.to_datetime()

6
New cards

in df.describe() , what does the “25%” row represents?

First Quartile (Q1)

7
New cards

what will be the output of this code?

first = “Data”

second = “Analytics”

print(first + “ ” + second)

Data Analytics

8
New cards

what does df[“Age”].astype(str) do?

converts Age column to string type

9
New cards

what is the data type of the following variable ? age = 25

int

10
New cards

what will be the output of the code?

total = 0

for i range(1, 4):

total += i

print(total)

6

11
New cards

what will be the output of this code?

fruits = [“apple”, “banana”, “cherry”]

print(len(fruits))

3

12
New cards

if df.shape returns (500, 8), what does this mean?

500 rows and 8 columns

13
New cards

1 line code — to count the total number of missing values across ALL columns in DataFrame df.

df.isnull().sum()

14
New cards

1 line code — write a list comprehension that creates a new list containing squares of numbers from this list:

numbers = [1, 2, 3, 4, 5]

squares = [n**2 for n in numbers]

15
New cards

what does df[“Age”].fillna(0) do?

replaces missing values in Age column with 0

16
New cards

which pandas method removes rows with missing values?

df.dropna()

17
New cards

1 line code — using pandas, count the number of missing values in ALL columns. Assume the data is loaded and the DataFrame name is hdb.

Expected Output:  Returns a Series (missing values per column) 

hdb.isnull().sum()

18
New cards

A Singapore bank wants to reduce customer loan defaults. They have 5 years of loan data including: customer credit score, loan amount, employment status,  monthly income, loan duration, and whether the customer defaulted (yes/no).

They want to identify which customers are LIKELY TO DEFAULT in the next 30 days so the bank can contact them early with payment assistance.

What type of analytics problem is this: "identify customers likely to default in next 30 days so bank can intervene early"?

predictive (forecasting who will default)

19
New cards
20
New cards
21
New cards
22
New cards

Explore top notes

Explore top flashcards

flashcards
pg 40 vocab test 1
33
Updated 553d ago
0.0(0)
flashcards
Français Atelier 8
83
Updated 863d ago
0.0(0)
flashcards
LESPA 5.2
22
Updated 1175d ago
0.0(0)
flashcards
Integumentary System
45
Updated 1076d ago
0.0(0)
flashcards
Operative 4 midterm
77
Updated 12d ago
0.0(0)
flashcards
AP Psychology ALL Terms
452
Updated 665d ago
0.0(0)
flashcards
Human Geography Unit 4
41
Updated 811d ago
0.0(0)
flashcards
Lesson 2
20
Updated 1049d ago
0.0(0)
flashcards
pg 40 vocab test 1
33
Updated 553d ago
0.0(0)
flashcards
Français Atelier 8
83
Updated 863d ago
0.0(0)
flashcards
LESPA 5.2
22
Updated 1175d ago
0.0(0)
flashcards
Integumentary System
45
Updated 1076d ago
0.0(0)
flashcards
Operative 4 midterm
77
Updated 12d ago
0.0(0)
flashcards
AP Psychology ALL Terms
452
Updated 665d ago
0.0(0)
flashcards
Human Geography Unit 4
41
Updated 811d ago
0.0(0)
flashcards
Lesson 2
20
Updated 1049d ago
0.0(0)