Exercise 7: We have two Series defined as follows: available: import pandas as pd s1 = pd. Series([11, 25, 55, 10], index s2 = pd. Series([20, 30, 40]) We create a DataFrame by: = ['g', 'r', 'p', 'a']) df = pd.DataFrame({"coll": s1, "col2": s2}) a) What is len(df.index)? Why? b) Why are all the NaN values created in df?

icon
Related questions
Question
Exercise 7: We have two Series defined as follows: available:
import pandas as pd
s1 = pd. Series ([11, 25, 55, 10], index = ['g', 'r', 'p', 'a'])
s2 = pd. Series ([20, 30, 40])
We create a DataFrame by:
df = pd.DataFrame({"coll": 1, "col2": s2})
a) What is len(df.index)? Why?
b) Why are all the NaN values created in df?
Transcribed Image Text:Exercise 7: We have two Series defined as follows: available: import pandas as pd s1 = pd. Series ([11, 25, 55, 10], index = ['g', 'r', 'p', 'a']) s2 = pd. Series ([20, 30, 40]) We create a DataFrame by: df = pd.DataFrame({"coll": 1, "col2": s2}) a) What is len(df.index)? Why? b) Why are all the NaN values created in df?
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer