मराठी

Sneha is writing a Python program to create a DataFrame using a list of dictionaries. However, her code contains some mistakes. Identify the errors, rewrite the correct code,

Advertisements

प्रश्न

Sneha is writing a Python program to create a DataFrame using a list of dictionaries. However, her code contains some mistakes. Identify the errors, rewrite the correct code, and underline the corrections made.

import Pandas as pd
D1 = {'Name': 'Rakshit', 'Age': 25}
D2 = {'Name': 'Paul', 'Age': 30}
D3 = {'Name': 'Ayesha", 'Age': 28}
data = [D1, D2, D3)
df = pd.Dataframe(data)
print(df) 
कोड लेखन
Advertisements

उत्तर

import pandas as pd
D1 = {'Name:' ‘Rakshit, ‘Age’: 25}
D2 = {'Name': ‘Paul’, ‘Age: 30}
D3 = {'Name': ‘Ayesha’, ‘Age’: 28}
data = [D1, D2, D3]
df = pd.DataFrame(data)
print(df) 

Changes Made:

  1. Changed Pandas to pandas.
  2. Corrected mismatched string quotation marks.
  3. Corrected the closing parenthesis in the list data.
  4. Changed Dataframe to DataFrame.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (March) Board Sample Paper
Advertisements
Share
Notifications



      Forgot password?
Use app×