English

Complete the given Python code to generate the following output: COLOUR Red  Blue Green, NAME Apple Berry Guava, QTY 10 15 20 - Informatics Practices

Advertisements
Advertisements

Question

Complete the given Python code to generate the following output:

  COLOUR  NAME  QTY
0  Red   Apple  10
1  Blue  Berry  15
2  Green  Guava  20
import ______ as pd
data=[{‘COLOUR’ : ‘Red’, ‘NAME’ : ‘Apple’, ‘QTY’ : 10},
{‘COLOUR’ : ‘Blue’, ‘NAME’ : ‘Berry’, ‘QTY’ : 15},
{______, ‘NAME’ : ‘Guava’, ‘QTY’ : 20}]
df=pd.DataFrame(______)
print(______)
Code Writing
Advertisements

Solution

import pandas as pd
data=[{‘COLOUR’:‘Red’,‘NAME’:‘Apple’,‘QTY’:10},
{‘COLOUR’:‘Blue’,‘NAME’:‘Berry’,‘QTY’:15},
{‘COLOUR’:‘Green’,‘NAME’:‘Guava’,‘QTY’:20}]
df = pd.DataFrame (0,1,2)
print (df)
shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×