Javaexercise.com

Top Pandas Interview Questions

Q1. What is Pandas?

Pandas is an open-source data analysis library that is based on Python language. For more refer to our detailed article: What is Pandas Library?

Q2. When was Pandas created?

 Pandas was first released on 11 January 2008. It was written by Wes McKinney (an American Software Developer). For Pandas Version and History, read our detailed article: Pandas History and Versions.

Q3. In which language, Pandas is written?

Pandas is written using Python, CPython, and C language.

Q4. Different types of data structures available in Pandas are:

Pandas Provide Three major data structures:

Series - It is immutable in size and homogeneous one-dimensional array data structure.

DataFrame - It is a tabular data structure that comprises rows and columns. Here, data and size are mutable.

Panel - It is a three-dimensional data structure to store the data heterogeneously.

Q5. What is Vectorization in Python Pandas?

It is a concept of performing array/list operations without using loops. Instead, use built-in functions which are highly optimized and reduce the running and execution time of code.

Q6. How to convert a DataFrame to a list in Pandas?

We can convert dataframe data to list by using the list() or tolist() function. For more details, refer to this detailed article: Convert Dataframe to List.

Q7. List some statistical functions in Python Pandas?

  • cov()

  • corr()

  • rank()

  • sum()

  • mean()

  • std()

  • describe()

Q8. What are the possible ways to create Dataframe in Pandas?

We can create Dataframe from several data containers such as:

  • List

  • Dictionary

  • File

  • NumPy Array

For more, read this detailed article: Create Dataframe in Pandas.

Q9. How to create an empty DataFrame in Pandas?

Yes, we can create an empty dataframe by using some built-in functions of Pandas such as Pandas.dataframe() function. For detailed information, read this Create an empty datafame.

Q10. How can I add a column to a pandas DataFrame?

You can add columns to dataframe by using several built-in functions such as the insert() and assign() function. For detailed information, read this add new column to dataframe.

Q11. How to rename dataframe column in Pandas?

To rename dataframe columns, we can use these methos:

  • dataframe.columns attribute/property

  • dataframe.rename() method

For more information, read this detailed article: rename dataframe column.

Q12. How to iterate over a Pandas DataFrame?

We can iterate pandas by using loops and some built-in methods such as:

  1. iterrows() Function

  2. itertuples() Function

  3. range() Function + iloc[]

  4. for loop

  5. apply() Function

For more, refer to this detailed article: Iterate Dataframe.

 

We will add more questions soon...