Reputation: 134
I came across such a case. there is a data frame with the same columns and does not output the entire table.
My code:
import pandas as pd
data = {2:['Green','Blue'],
2:['small','BIG'],
2:['High','Low']}
df = pd.DataFrame(data)
print(df)
Output:
2
0 High
1 Low
Upvotes: 1
Views: 579
Reputation: 136
Dictionary only supports Unique Keys (in Key-Value pairs) So when you create a DataFrame using Dictionary, it will only consider the latest Key-Value pair if there is duplication in Key. For any reason, you create DataFrame with the Same Column Headers, use following code -
import pandas as pd
df = pd.DataFrame([['Green','Blue'], ['small','BIG'], ['High','Low']], columns = [2,2])
print(df)
It will show entire table with same column headers
Upvotes: 1