Advertisements
Advertisements
Question
>>> import pandas as pd
>>> dFrameEmt = pd.DataFrame()
>>> dFrameEmt
Empty DataFrame
Columns: []
Index: []
What would happen if we pass 3 columns or 5 columns instead of 4 in the above code? What is the reason?
Give Reasons
Advertisements
Solution
- In the given code, if we pass 3 columns or 5 columns instead of 4, an error will occur because the DataFrame does not have matching column labels.
- The number of column names must be equal to the number of columns in the DataFrame. If the numbers do not match, Pandas cannot create the DataFrame properly.
shaalaa.com
Is there an error in this question or solution?
