0% found this document useful (0 votes)
26 views15 pages

I.P Project File (Pandas CODES)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views15 pages

I.P Project File (Pandas CODES)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1.

Creating a DataFrame from a


Dictionary
Question:How do you create a DataFrame from a
dictionary in Pandas? What would happen if you
provide unequal lists for the dictionary values?

Code:

Output:
2.Accessing Specific Columns
Question:How do you access a specific column
from a DataFrame in Pandas?

Code:

Output:
3.Selecting Multiple Columns
Question:How do you select multiple columns
from a DataFrame?

Code:

Output:
4.Adding a New Column
Question:How do you add a new column to a
DataFrame in Pandas?
Code:

Output:
5.Sorting Data by Column
Question:How do you sort a DataFrame by one or
more columns in ascending or descending order?

Code:

Output:
6. Filtering Rows Based on
Condition
Question:How can you filter rows in a DataFrame
based on a condition?
Code:

Output:
7. Handling Missing Data (NaN)

Question:How does Pandas handle missing data,


and how can we fill missing values?

Code:

Output:

8. Renaming Columns
Question:How do you rename columns in a Pandas
DataFrame?

Code:

Output:

9. Group By Operation
Question:How do you perform a groupby
operation to calculate aggregate functions like
mean, sum, etc.?

Code:

Output:

10. Merging DataFrames


Question:How do you merge two DataFrames
based on a common column?

Code:

Output:

11. Applying Functions to Columns


Question:How do you apply a function to modify a
column in a DataFrame?
Code:

Output:

12. Handling Duplicates


Question:How do you remove duplicate rows in a
DataFrame?
Code:

Output:

13. Setting Index


Question:How do you set a column as the index of
a DataFrame?

Code:

Output:

14. Concatenating DataFrames


Question:How do you concatenate two
DataFrames vertically?

Code:

Output:

15. Pivot Table


Question:How do you create a pivot table in
Pandas and use an aggregation function like sum?

Code:

Output:

You might also like