Puzzle 17: Not My Type
Let's solve a pandas DataFrame puzzle based on the concatenation operator.
We'll cover the following
Guess the output
Try to guess the output of the code below:
import pandas as pddf1 = pd.DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])df2 = pd.DataFrame([[5, 6], [7, 8]], columns=['b', 'c'])df = pd.concat([df1, df2])print(df.dtypes)
Quiz
Q
What is the output of the code above?
A)
a int64
b int64
c int64
B)
a float64
b int64
c float64
C)
int64
D)
float64
Get hands-on with 1300+ tech skills courses.