Q1. What are Pandas Data Structures?

Pandas provides two main data structures: Series (1D) and DataFrame (2D).

Q2. What is a Series?

A Series is a one-dimensional labeled array capable of holding any data type.

Q3. What is a DataFrame?

A DataFrame is a two-dimensional labeled data structure with columns of potentially different types.

Q4. How to create a Series?

import pandas as pd
s = pd.Series([1,2,3])

Q5. How to create a DataFrame?

df = pd.DataFrame({'A':[1,2], 'B':[3,4]})

Q6. What is index in Series?

Index represents labels assigned to data values.

Q7. Default index in Pandas?

Integer index starting from 0.

Q8. Can Series hold multiple data types?

Yes, but usually it is recommended to keep same data type.

Q9. Access Series elements?

s[0]

Q10. Access DataFrame column?

df['A']

Q11. What is dtype?

It represents data type of elements.

Q12. Convert list to Series?

pd.Series(list)

Q13. Convert dict to DataFrame?

pd.DataFrame(dict)

Q14. What is shape?

Returns rows and columns.

Q15. What is size?

Total elements count.

Q16. What is ndim?

Number of dimensions.

Q17. Series ndim?

1

Q18. DataFrame ndim?

2

Q19. Head function?

df.head() shows first rows.

Q20. Tail function?

df.tail() shows last rows.

Q21. Info method?

Displays summary of DataFrame.

Q22. Describe method?

Statistical summary.

Q23. What is axis?

Axis 0 = rows, Axis 1 = columns.

Q24. Add column?

df['C'] = value

Q25. Delete column?

df.drop('C', axis=1)

Q26. What is loc?

Label-based indexing.

Q27. What is iloc?

Integer-based indexing.

Q28. Select row?

df.loc[0]

Q29. Select multiple rows?

df.iloc[0:3]

Q30. Boolean indexing?

df[df['A'] > 2]

Q31. What is index alignment?

Automatic matching of labels.

Q32. Series from NumPy?

pd.Series(np.array([1,2]))

Q33. What is values?

Returns underlying data.

Q34. What is columns?

Returns column labels.

Q35. Rename columns?

df.rename(columns={'A':'X'})

Q36. Check null values?

df.isnull()

Q37. Fill null values?

df.fillna(0)

Q38. Drop null?

df.dropna()

Q39. Unique values?

df['A'].unique()

Q40. Value counts?

df['A'].value_counts()

Q41. What is reindexing in Pandas?

Reindexing is the process of changing the labels of rows and columns.
df.reindex([0,1,2])

Q42. What happens when reindex introduces missing labels?

It fills missing values with NaN.

Q43. What is MultiIndex?

MultiIndex allows multiple levels of indexing in rows or columns.

Q44. How to create MultiIndex?

pd.MultiIndex.from_tuples([(1,'a'),(1,'b')])

Q45. What is sorting in Pandas?

Arranging data in ascending or descending order.
df.sort_values('A')

Q46. Sort by index?

df.sort_index()

Q47. What is copy()?

Creates a deep copy of the DataFrame.

Q48. Difference between copy and view?

Copy creates new memory, view refers to original data.

Q49. Iterating DataFrame rows?

for index,row in df.iterrows():

Q50. Iterating columns?

for col in df.columns:

Q51. What is transpose?

Swaps rows and columns.
df.T

Q52. What is memory_usage()?

Returns memory consumption of DataFrame.

Q53. What is astype()?

Used to change data type.
df['A'].astype(int)

Q54. What is apply()?

Applies function across rows/columns.

Q55. What is map()?

Used for element-wise operations on Series.

Q56. What is applymap()?

Applies function element-wise on DataFrame.

Q57. What is vectorization?

Performing operations on entire arrays efficiently.

Q58. What is broadcasting?

Automatic expansion of smaller arrays during operations.

Q59. Arithmetic operations in DataFrame?

df['A'] + df['B']

Q60. What is alignment?

Matching labels before performing operations.

Q61. Combine DataFrames?

pd.concat([df1, df2])

Q62. What is append()?

Adds rows (deprecated, use concat).

Q63. What is conditional selection?

df[df['A'] > 5]

Q64. What is where()?

Replaces values based on condition.

Q65. What is query()?

Filters data using string expressions.

Q66. What is set_index()?

Sets column as index.

Q67. What is reset_index()?

Resets index to default.

Q68. What is drop_duplicates()?

Removes duplicate rows.

Q69. What is duplicated()?

Returns duplicate rows.

Q70. What is isin()?

Checks if values exist in list.

Q71. What is clip()?

Limits values to threshold.

Q72. What is rank()?

Ranks values in data.

Q73. What is diff()?

Difference between rows.

Q74. What is pct_change()?

Percentage change between rows.

Q75. What is stack()?

Converts columns to rows.

Q76. What is unstack()?

Converts rows to columns.

Q77. What is pivot()?

Reshapes data based on columns.

Q78. What is melt()?

Unpivots DataFrame.

Q79. What is crosstab()?

Frequency table of variables.

Q80. What is cut()?

Bins continuous data.

Q81. What is qcut()?

Quantile-based binning.

Q82. What is rolling()?

Rolling window calculations.

Q83. What is expanding()?

Expanding window operations.

Q84. What is ewm()?

Exponential weighted functions.

Q85. What is sample()?

Random sampling of data.

Q86. What is nlargest()?

Returns largest values.

Q87. What is nsmallest()?

Returns smallest values.

Q88. What is idxmax()?

Index of max value.

Q89. What is idxmin()?

Index of min value.

Q90. What is corr()?

Correlation between columns.

Q91. What is cov()?

Covariance of data.

Q92. What is replace()?

Replaces values in DataFrame.

Q93. What is to_numpy()?

Converts DataFrame to NumPy array.

Q94. What is memory optimization?

Reducing memory usage using correct dtypes.

Q95. What is categorical data?

Data with limited unique values.

Q96. Convert to category?

df['A'].astype('category')

Q97. What is sparse data?

Data with many missing values.

Q98. What is pipe()?

Applies function in chain.

Q99. What is eval()?

Evaluates expressions efficiently.

Q100. Why Pandas Data Structures are important?

They provide efficient data handling, analysis, and manipulation tools.

 

📢 Join Our WhatsApp Channel

💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.

👉 Join WhatsApp Now

📢 Join Our Telegram Channel

💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!

👉 Join Telegram

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2022 - 2025 itfreesource.com

Enable Notifications OK No thanks