मराठी

Write a Python program to create the following DataFrame using a list of dictionaries. Product Price 0 Laptop 60000 1 Desktop 45000 2 Monitor 15000 3 Tablet 30000 - Informatics Practices

Advertisements
Advertisements

प्रश्न

Write a Python programme to create the following DataFrame using a list of dictionaries. 

  Product Price
0 Laptop 60000
1 Desktop 45000
2 Monitor 15000
3 Tablet 30000
कोड लेखन

उत्तर

import pandas as pd
d1 = {'Product': 'Laptop', 'Price': 60000}
d2 = {'Product': 'Desktop', 'Price': 45000}
d3 = {'Product': 'Monitor', 'Price': 15000}
d4 = {'Product': 'Tablet', 'Price': 30000}
data = [d1, d2, d3, d4]
df = pd.DataFrame(data)
print(df)
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×