Want to create interactive content? It’s easy in Genially!
Python Challenge 2
Sayed Ali
Created on July 10, 2023
Python challenge for data analytics
Start designing with a free template
Discover more than 1500 professional designs like these:
Transcript
PYTHON Challenge
START
GOODLUCK!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the datatype of the variable in the following line? X= 12
Integer
Float
String
Boolean
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
How is a Set indicated in Python?
curly braces { }
square brackets [ ]
parentheses ( )
curly braces with { : }
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the output of the following code?
dict = {"ID":["name","John Doe"], "age": 30, "country": "USA"}
print(dict["ID"])
'name':'John Doe'
['name', 'John Doe']
'name'
'John Doe'
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
Which method is used to convert a string column into a datetime column in pandas?
df.parse_datetime()
df.convert_to_datetime()
df.string_to_datetime()
df.to_datetime()
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you sort a DataFrame by values in a specific column in descending order?
df.sort_values(['column_n\ ame'], ascending=False)
df.sort_value(['column_n\ ame'], ascending=False)
df.sort_by(column='column_n\ame', ascending=False)
df.sort(column='column_nam\e', ascending=False)
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you replace Null with a specific value in a pandas DataFrame?
df.fillna()
df.replace_null()
df.rep_nul()
df.fill_na()
6 3.200 POINTS
1 100 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you drop a column 'B' in pandas DataFrame 'df'?
df.drop('B', axis=0)
df.drop('B', axis=1)
del(df['B'])
A & C are correct
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
Which of the following methods used to draw a Histogram using matplotlib?
df['Column'].plot\(kind='histogram')
df['Column'].plot\(kind='hist')
df['Column'].plot\(type='hist')
df['Column'].plot\(kind='histogram')
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you handle missing values by filling them with the mean value of the column 'B' in pandas?
df.fillna(['B']'mean')
df.fill_with_mean('B')
df.mean_fillna('B')
df.fillna(df['B'].mean())
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What does the df.dropna(axis=1) method do in pandas?
Drops columns with missing values
Drops rows with missing values
10
Drops rows and columns with missing values
None Of The Above
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
WELL DONE!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
YOU WIN!
1.000.000 POINTS
BACK