What is the primary purpose of the Pandas library in Python?
a) Image Processing
b) Numerical Computations
c) Data Manipulation and Analysis
d) Web Development
Which of the following is used to create a one-dimensional labeled array in Pandas?
a) DataFrame
b) Series
c) Dictionary
d) List
How do you create a Pandas DataFrame from a dictionary?
a) pd.DataFrame.from_dict()
b) pd.read_csv()
c) pd.Series()
d) pd.read_dict()
Which function is used to view the first few records of a DataFrame in Pandas?
a) .tail()
b) .head()
c) .sample()
d) .view()
In Pandas, the function used to select rows based on a condition is called:
a) Selection indexing
b) Conditional indexing
c) Boolean indexing
d) Scalar indexing
Which of the following methods can be used to read data from a CSV file into a DataFrame?
a) pd.read_csv()
b) pd.read_excel()
c) pd.load_csv()
d) pd.readfile()
What is the default axis for operations like adding or deleting columns in a DataFrame?
a) Axis 0 (rows)
b) Axis 1 (columns)
c) Axis 2 (layers)
d) No default axis
Which of the following will correctly slice the first three elements from a Pandas Series named s?
a) s.slice(0, 2)
b) s[0:3]
c) s.index(0:2)
d) s.cut(0, 3)
How do you rename a column in a Pandas DataFrame?
a) df.rename_column()
b) df.columns['old_name'] = 'new_name'
c) df.rename(columns={'old_name': 'new_name'})
d) df.change_column()
Which library is typically used with Pandas for creating visualizations in Python?
a) Seaborn
b) Numpy
c) Matplotlib
d) Scikit-learn
Programming Questions
Create a Pandas Series from a NumPy ndarray and perform a mathematical operation such as adding 10 to all values.
Write a Python program to create a Series from a dictionary where the keys are student names and the values are their marks. Display the Series.
Create a Pandas DataFrame from a list of dictionaries containing information about students (name, age, and grade). Display the first five rows.
Write a program to read a CSV file containing employee data (name, department, salary) into a Pandas DataFrame and display the DataFrame.
Create a Pandas Series and demonstrate the use of .head() and .tail() functions on the Series.
Write a Python program to create a DataFrame from a dictionary of Series. Perform an operation to delete a column and display the modified DataFrame.
Given a DataFrame of sales data (product, price, quantity), write a program to add a new column that shows the total sales for each product (price * quantity).
Create a Pandas DataFrame from a CSV file and demonstrate how to select rows using Boolean indexing where the column ‘Age’ is greater than 30.
Write a Python program to rename the columns of a Pandas DataFrame (e.g., ‘old_name’ to ‘new_name’) and display the updated DataFrame.
Write a Python program to export a DataFrame of student marks to a CSV file.