/Python-program-for-data-manipulation-and-analysis

In this program, we use the Pandas library to perform data manipulation and analysis on a sample DataFrame. We start by creating a sample DataFrame called df with columns representing Name, Age, City, and Salary.

GNU General Public License v3.0GPL-3.0

Details about the program that uses the Pandas library for data manipulation and analysis: In this program, we use the Pandas library to perform data manipulation and analysis on a sample DataFrame. We start by creating a sample DataFrame called df with columns representing Name, Age, City, and Salary. Importing the Pandas library: The program starts by importing the Pandas library using the import pandas as pd statement. This allows us to access the various functions and methods provided by Pandas.

Creating a sample DataFrame: The program creates a sample DataFrame called df using a Python dictionary. The dictionary contains columns representing Name, Age, City, and Salary. Each column corresponds to a key-value pair in the dictionary, where the key is the column name and the value is a list of values for that column.

Performing data manipulations and analysis:

Printing the original DataFrame: The print(df) statement is used to display the contents of the DataFrame. Filtering the DataFrame: The program filters the DataFrame using a boolean condition (df['Age'] >= 30) and creates a new DataFrame called filtered_df that includes only the rows where the age is 30 or above. Calculating the average salary: The mean() function is applied to the 'Salary' column (df['Salary'].mean()) to calculate the average salary for all employees. Grouping the DataFrame: The program uses the groupby() function to group the DataFrame by the 'City' column. Then, the agg() function is used to calculate the mean age and mean salary for each city. Displaying the results: The program uses print() statements to display the original DataFrame, the filtered DataFrame, the average salary, and the grouped DataFrame with the mean age and mean salary for each city.

Pandas is a powerful library for data manipulation and analysis in Python. It provides a wide range of functions and methods for handling data in tabular form, similar to a spreadsheet. With Pandas, you can perform various operations such as filtering, sorting, grouping, merging, joining, aggregating, and visualizing data. It also offers flexible indexing and slicing capabilities for accessing specific subsets of data. The library is widely used in data analysis, data science, and machine learning tasks. Note: pandas is very good library for data analytics and working with datasets