Python Numpy Pandas Interview Questions
Python Numpy Pandas Interview Questions
Python Numpy Pandas Interview Questions
Python descriptive
Python Coding
Numpy descriptive
3. Generate array of ‘100’ random numbers sampled from a standard normal distribution using
Numpy
11. Write a NumPy program to get true division of the element-wise array inputs
x = np.arange(5)
rslt = np.true_divide(x, 4)
Numpy Coding
1. Find out the mean, median and standard deviation of the numpy array
2. How can you initialize a 5*5 numpy arrays with only zeroes?
3. What is vstack() in numpy? Give an example
4. How to remove elements from one array that exist in another?
5. How to sort a numpy array by a specific column in a 2D array?
6. How to reverse a numpy array in the most efficient way?
7. How to calculate percentiles by using numpy?
8. What is the preferred way to check for an empty (zero Element) Array?
9. How can you find the indices of an array where a condition is true?
10. How to find the maximum and minimum value of a given flattened array?
11. Write a NumPy program to calculate the difference between the maximum and the minimum
values of a given array along the second axis.
12. Find median of a numpy flattened array
13. Write a NumPy program to compute the mean, standard deviation, and variance of a given array
along the second axis
14. Calculate covariance matrix between two numpy arrays
Pandas descriptive
1. What is Pandas?
Pandas is a Python library used for working with data sets. It has functions for
analyzing, cleaning, exploring, and manipulating data.
8. What are the different functions that can be used by grouby in pandas ?
9. What is a series in pandas?
A Pandas Series is like a column in a table. It is a one-dimensional array
holding data of any type.
10. What features make Pandas such a reliable option to store tabular data?
11. What is vectorization in Pandas?
Vectorization is used to speed up the Python code without using
loop. Using such a function can help in minimizing the running time
of code efficiently.
Pandas Coding
1. How will you create a series from dict in Pandas?
2. How can we create a copy of the series in Pandas?
3. Write a Pandas program to get the first 5 rows of a given DataFrame
4. Develop a Pandas program to create and display a one-dimensional array-like object containing
an array of data.
5. Write a Python program to convert a Pandas Series to Python list.
6. Develop a Pandas program to add, subtract, multiple and divide two Pandas Series.
7. Develop a Pandas program to compare the elements of the two Pandas Series.
8. Develop a Pandas program to change the data type of a given column or Series.
9. Write a Pandas program to convert Series of lists to one Series
10. Write a Pandas program to create a subset of a given series based on value and condition
11. Develop a Pandas code to alter the order of index in a given series
12. Write a Pandas code to get the items of a given series not present in another given series.
13. What is the difference between the two data series df[‘Name’] and df.loc[:,‘Name’]?
14. Write a Pandas program to display the most frequent value in a given series and replace
everything else as “replaced” in the series.
15. Write a Pandas program to find the positions of numbers that are multiples of 5 of a given series.
16. How will you add a column to a pandas DataFrame?
17. How to iterate over a Pandas DataFrame?
18. What is a Pandas Series and give one example?
19. What is pandas groupby give one example?
20. How to create a dataframe from lists?
21. How to create a dataframe from a dictionary and give one example?
22. How to fetch a data entry from a pandas dataframe using a given value in index?
23. How to create a new column in pandas by using values from other columns?
24. How to select columns in pandas and add them to a new dataframe? What if there are two
columns with the same name?
25. How to delete a column or group of columns in pandas? Given the below dataset find the highest
paid player in each college in each team.
Reindexing changes the row labels and column labels of a DataFrame. To reindex means to
conform the data to match a given set of labels along a particular axis.