Create a DataFrame with cer and ack
Create a DataFrame with cer and ack
Program:
Output:
Question: Add a column 'Marks' to the DataFrame with values 85, 90, and 88.
Program:
Output:
Delete a Column
Question: Delete the 'City' column from the DataFrame.
Program:
Output:
Program:
Output:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3 entries, 0 to 2
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 3 non-null object
1 Age 3 non-null int64
2 Marks 3 non-null int64
dtypes: int64(2), object(1)
memory usage: 200.0+ bytes
None
Program:
Output:
Age Marks
count 3.000000 3.000000
mean 24.333333 87.666667
std 2.516611 2.516611
min 22.000000 85.000000
25% 23.000000 86.500000
50% 24.000000 88.000000
75% 25.500000 89.000000
max 27.000000 90.000000
Select a Column
Program:
Output:
0 Alice
1 Bob
2 Charlie
Name: Name, dtype: object
Question: Select the 'Name' and 'Marks' columns from the DataFrame.
Program:
Output:
Name Marks
0 Alice 85
1 Bob 90
2 Charlie 88
Output:
Sort DataFrame
Program:
Output:
Group by Column
Question: Group the DataFrame by 'Name' and calculate the mean of 'Marks'.
Program:
Output:
Name
Alice 85
Bob 90
Charlie 88
Name: Marks, dtype: int64
Merge Two DataFrames
Program
Output:
CERTIFICATE
This is to certify that Shubham Sharma, a student
of Class 12th B, Roll No. 12233, has successfully
completed the Practical File for the subject
Information Practices (IP), under the guidance of
Mr. Nitin Wadhwa. The practical file includes
programs based on various topics, demonstrating
the student's understanding and application of the
concepts covered in the curriculum.
The practical file has been prepared in accordance
with the guidelines provided by the CBSE and has
been submitted for evaluation.
We wish the student continued success in their
future academic endeavours