Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

PYTHON

INTERVIEW QUESTIONS

www.codebasics.io
PYTHON Interview Questions 02

Python Basics

1 What is the difference between a tuple and a list?

2 Is a list mutable or immutable?

3 What built-in data types are used in Python?

4 How do you install a Python package?

5 What are the different ways of writing comments in Python?

6 Could you provide an explanation of the range() function in Python?

7 What is the approach to handling exceptions in Python?

8 What is the difference between a module and a package?

9 What is the difference between dictionaries and JSON?

Data Types

1 What is the difference between a tuple and a list?

2 Is a list mutable or immutable?

3 What built-in data types are used in Python?

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 03

Pandas

1 How are joins and merges different from each other in Pandas?

2 How do loc and iloc differ from each other in Pandas?

3 What are the differences between a Series and a DataFrame in Pandas?

4 How do loc and iloc differ in their usage for data indexing in Pandas?

5 What is the process for joining two DataFrames using Pandas?

6 In Pandas, what are the techniques for managing missing data?

7 What is the process for renaming a column in a Pandas DataFrame?

8 How do you select multiple columns from a Pandas DataFrame?

9 Have you used the pivot_table function in Pandas? Explain the purpose of a pivot
table and how you have used it in your data analysis projects.

10 How would you filter rows in a Pandas DataFrame based on multiple conditions?
Explain the different methods you have used for filtering.

11 Have you worked with time series data in Pandas? If so, explain how you have used
resampling techniques to aggregate data at different time intervals.

12 Can you describe the process of handling outliers in a Pandas DataFrame? What
methods or techniques have you used to identify and deal with outliers?

13 Explain the concept of hierarchical indexing (MultiIndex) in Pandas and its


significance in organizing and manipulating data.

14 Have you used the pivot_table function in Pandas? Describe a scenario where you
have applied pivot tables for data analysis or summarization.

15 Have you performed any data reshaping operations in Pandas, such as pivoting or
melting? Explain the scenarios where you have used these operations and their
significance.

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 04

16 Can you describe the process of merging or concatenating multiple DataFrames


in Pandas? Provide an example where you have combined data from different
sources.

17 Have you worked with text data in Pandas? If so, explain how you have used string
manipulation functions to clean and preprocess textual data.

18 Can you describe the process of merging two DataFrames based on a common
column using the merge() function in Pandas? Provide an example where you
have performed a merge operation.

19 Explain the concept of indexing and slicing in Pandas. How would you extract
specific rows or columns from a DataFrame based on specific conditions?

20 How would you handle skewed data distributions in a Pandas DataFrame?


Describe the techniques or transformations you have used to achieve a more
symmetric distribution.

21 Can you explain the purpose and usage of the pd.to_datetime() function in
Pandas? Provide an example where you have converted a column of strings into
datetime objects

Numpy

1 How do you concatenate two NumPy arrays?

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 05

Data Analysis and EDA

1 Python libraries, which ones have you used? Tell us more about them and their
implementation scenarios.

2 What is the purpose of exploratory data analysis (EDA) in data analytics? Describe
some common EDA techniques or visualizations you have used.

3 Explain the concept of data normalization and its significance in data analysis.
What normalization techniques have you applied in your work?

List and String Manipulations

1 How do you remove duplicates from a list in Python?

2 How would you handle outliers in a dataset during data analysis? Can you
describe some techniques or methods you have used?

Data Visualization

1 How would you approach data visualization to effectively communicate insights?


Describe some data visualization techniques or libraries you have utilized.

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 06

MatplotLib

1 How would you create a line plot using Matplotlib? Describe the steps involved in
plotting a line chart from data stored in a NumPy array or a Pandas DataFrame.

2 Explain the difference between the plot() and scatter() functions in Matplotlib.
When would you choose one over the other for visualizing data?

3 Describe the process of customizing the appearance of a plot, such as adding


labels to the x-axis and y-axis, setting a title, and adjusting the color and style of
the plotted lines or markers.

4 Can you explain the purpose and usage of the subplots() function in Matplotlib?
How would you create multiple subplots within a single figure?

5 How would you save a Matplotlib plot to a file in different formats, such as PNG,
JPEG, or PDF? Provide an example where you have saved a plot to a file.

6 Explain the concept of figure size and aspect ratio in Matplotlib. How would you
adjust the size and aspect ratio of a figure to ensure the optimal visualization of
your data?

7 Describe the purpose and usage of the hist() function in Matplotlib. Provide an
example where you have used this function to plot a histogram from a NumPy
array or a Pandas DataFrame.

8 How would you create a bar plot or a horizontal bar plot using Matplotlib? Explain
the steps involved in visualizing categorical data using bar charts.

9 Can you explain the concept of color mapping in Matplotlib? How would you use a
color map to represent a third dimension in a scatter plot or a surface plot?

10 Describe the process of creating a random sample from a given NumPy array
using the np.random.choice() function. Explain the parameters and usage of this
function.

11 Explain the concept of element-wise matrix multiplication using the np.multiply()


function in NumPy. Provide an example where you have performed element-wise
matrix multiplication.

12 How would you find unique values in a NumPy array using the np.unique()
function? Provide an example where you have used this function to identify
unique values.

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 07

13 How would you create a NumPy array of zeros or ones with a specific shape and
data type? Provide an example of when you have used these functions.

14 Explain the concept of slicing in NumPy arrays. How would you extract a specific
portion of an array using slicing notation?

15 Can you describe the purpose and usage of the np.mean() and np.median()
functions in NumPy? Provide examples where you have used these functions for
calculating the mean and median of an array.

16 How would you perform element-wise comparisons between two NumPy arrays?
Describe the process of using comparison operators to create a Boolean array.

Seaborn

1 Can you explain the purpose and benefits of using the Seaborn library for data
visualization compared to Matplotlib? How do you typically import and utilize
Seaborn in your data analysis tasks?

2 How would you create a scatter plot with a regression line using Seaborn?
Describe the steps involved in visualizing the relationship between two variables
with a regression line overlay.

3 Explain the concept of distribution plots in Seaborn. How would you create a
histogram, kernel density estimation (KDE) plot, or a rug plot using Seaborn?

4 Describe the purpose and usage of the pairplot() function in Seaborn. Provide an
example where you have used this function to visualize the relationships between
multiple variables in a dataset.

5 How would you create a box plot or a violin plot using Seaborn? Explain the steps
involved in visualizing the distribution of a continuous variable across different
categories.

6 Can you explain the purpose and usage of the heatmap() function in Seaborn?
Provide an example where you have used this function to visualize a correlation
matrix or a pivot table.

July 2023 Python V 2.0 codebasics.io


PYTHON Interview Questions 08

7 Explain the concept of categorical plots in Seaborn. How would you create bar
plots, count plots, or point plots to compare categories or groupings using
Seaborn?

8 Describe the process of customizing the appearance of Seaborn plots, such as


modifying color palettes, changing plot styles, or adding titles and labels.

9 How would you create a facet grid using Seaborn? Explain how you can use the
FacetGrid() function to create a grid of plots based on one or more categorical
variables.

10 How would you create a bar plot or a count plot with grouped or stacked bars
using Seaborn? Describe the steps involved in visualizing categorical data with
bar plots in Seaborn.

11 Explain the concept of swarm plots and box plots in Seaborn. When and how
would you use these types of plots to visualize categorical or numerical data?

12 How would you create a pair-wise correlation heatmap using Seaborn? Explain
the steps involved in visualizing the correlation matrix of a dataset with the
heatmap() function.

July 2023 Python V 2.0 codebasics.io

You might also like