Disclaimer:
Educational Use Only:
The website links provided are to be used strictly for educational and knowledge-gaining purposes only.
No Misuse:
Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.
Respect for Websites and Businesses:
Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.
Acknowledge Value of Knowledge:
Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.
No Endorsement:
The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.
User Responsibility:
By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.
Overall MCQs for Reference
- Which of the following objects can be used as data in a Pandas DataFrame?
a. a Python dict
b. an ndarray
c. a scalar value
d. all of the mentioned
Answer: d. all of the mentionedsanfoundry - Which method returns the first 5 rows of a DataFrame by default?
a. start()
b. top()
c. head()
d. first()
Answer: c. head()scribd - What does Pandas stand for?
a. Panel Data Analysis
b. Panel Data analyst
c. Panel Data
d. Panel Dashboard
Answer: a. Panel Data Analysiscsiplearninghub - Which function is used to read a CSV file into a DataFrame?
a. read_csv()
b. load_csv()
c. import_csv()
d. get_csv()
Answer: a. read_csv()scribd - Important data structures of Pandas are:
a. Series
b. DataFrame
c. Both of the above
d. None of the above
Answer: c. Both of the abovecsiplearninghub - Which argument in DataFrame constructor assigns custom row labels?
a. label
b. axis
c. index
d. row
Answer: c. indexsanfoundry - Which library is used in Python for plotting graphs and visualization?
a. Pandas
b. NumPy
c. Matplotlib
d. None of the above
Answer: c. Matplotlibcsiplearninghub - Which Pandas function is used to merge two DataFrames by columns?
a. concat()
b. append()
c. combine()
d. merge()
Answer: d. merge()scribd - What is the result when you add two Series objects with non-matching indexes?
a. Error
b. NaN values for unmatched indexes
c. Concatenation
d. None of the above
Answer: b. NaN values for unmatched indexessanfoundry - What function is used to export a DataFrame to a CSV file?
a. write_csv()
b. toFile()
c. to_csv()
d. save_as_csv()
Answer: c. to_csv()scribd - Which function gives the summary statistics of DataFrame columns?
a. avg()
b. summary()
c. describe()
d. statistics()
Answer: c. describe()sanfoundry - The axis=1 argument in drop() refers to:
a. Columns
b. Rows
c. Index
d. All elements
Answer: a. Columnssanfoundry+1 - How to select a single column as a Series from a DataFrame ‘df’?
a. df[column_name]
b. df.column_name
c. Both a and b
d. None of the above
Answer: c. Both a and bscribd+1 - Which method is used to set a particular column as the index of DataFrame?
a. set_axis()
b. set_column()
c. set_index()
d. assign_index()
Answer: c. set_index()sanfoundry - Which of these creates an empty DataFrame?
a. pd.DataFrame()
b. pd.DataFrame(None)
c. pd.DataFrame([])
d. All of the above
Answer: d. All of the abovesanfoundry - What does df.info() display?
a. Data types, columns, and memory usage
b. Only column names
c. Only memory usage
d. None of the above
Answer: a. Data types, columns, and memory usagedatacamp - Which join combines only matching rows between DataFrames?
a. Left Join
b. Full Join
c. Inner Join
d. Right Join
Answer: c. Inner Joinscribd - How can you drop missing values from a DataFrame?
a. df.remove_na()
b. df.na_drop()
c. df.dropna()
d. df.clean_null()
Answer: c. df.dropna()sanfoundry - Which method is used for label-based row/column selection?
a. loc[]
b. iloc[]
c. at[]
d. index[]
Answer: a. loc[]scribd - Which method returns a DataFrame’s top n rows?
a. top(n)
b. head(n)
c. start(n)
d. first(n)
Answer: b. head(n)scribd - What data type is returned by df[‘column’]?
a. Series
b. DataFrame
c. List
d. ndarray
Answer: a. Seriessanfoundry - How can you convert a NumPy array ‘arr’ to a Pandas Series?
a. pd.Series(arr)
b. pd.DataFrame(arr)
c. arr.to_series()
d. series(arr)
Answer: a. pd.Series(arr)scribd - Which function changes all column names to lowercase?
a. df.columns.lower()
b. df.rename(str.lower, axis=1)
c. df.columns = df.columns.str.lower()
d. df.to_lower()
Answer: c. df.columns = df.columns.str.lower()sanfoundry - How to select rows where column ‘A’ is equal to 10?
a. df[‘A’] == 10
b. df[df[‘A’] == 10]
c. df[‘A’] = 10
d. df.where(‘A’ == 10)
Answer: b. df[df[‘A’] == 10]sanfoundry - Which of the following is the correct way to rename a column?
a. df.rename(columns={‘old’:’new’})
b. df.set_column(‘old’,’new’)
c. df.columns[‘new’] = ‘old’
d. df.rename_col({‘old’:’new’})
Answer: a. df.rename(columns={‘old’:’new’})scribd - How to get unique values of a DataFrame column ‘col’?
a. df.col.unique()
b. df[‘col’].unique()
c. df.unique(‘col’)
d. df[‘col’].distinct()
Answer: b. df[‘col’].unique()scribd - What does df.tail() return?
a. First 5 rows
b. Last 5 rows
c. Row indexes
d. Column names
Answer: b. Last 5 rowsdatacamp - Which function concatenates two DataFrames vertically?
a. pd.concat([df1,df2], axis=0)
b. pd.merge([df1,df2])
c. pd.stack([df1,df2])
d. pd.join([df1,df2])
Answer: a. pd.concat([df1,df2], axis=0)sanfoundry+1 - Which method reads Excel files into a DataFrame?
a. read_excel()
b. import_excel()
c. get_excel()
d. load_excel()
Answer: a. read_excel()scribd+1 - Which parameter in read_csv() specifies the delimiter?
a. sep
b. delimiter
c. split
d. Both a and b
Answer: d. Both a and bsanfoundry - Which method would you use to apply a function to each row?
a. df.apply(func, axis=1)
b. df.transform(func)
c. df.row_apply(func)
d. df.each(func)
Answer: a. df.apply(func, axis=1)sanfoundry - How can a missing value be filled with 0 in DataFrame df?
a. df.fillna(0)
b. df.replace_nan(0)
c. df.nulls_to_zero()
d. df.substitute(0)
Answer: a. df.fillna(0)sanfoundry - What will df.T return?
a. Transposes DataFrame
b. Type of DataFrame
c. Totals of DataFrame
d. None of the above
Answer: a. Transposes DataFramesanfoundry - What will df.sort_values(‘column’, ascending=False) do?
a. Sorts DataFrame by ‘column’ in descending order
b. Sorts DataFrame by ‘column’ in ascending order
c. Groups DataFrame by ‘column’
d. Filters DataFrame by ‘column’
Answer: a. Sorts DataFrame by ‘column’ in descending ordersanfoundry - Which method is used for grouping data?
a. groupby()
b. clusterby()
c. joinby()
d. collectby()
Answer: a. groupby()scribd+1 - What is the default axis for most reduction operations in DataFrame?
a. 0 (index/rows)
b. 1 (columns)
c. 2
d. -1
Answer: a. 0 (index/rows)scribd+1 - How do you get DataFrame descriptive statistics?
a. df.statistics()
b. df.describe()
c. df.stats()
d. df.summary()
Answer: b. df.describe()sanfoundry - Which method would you use to detect duplicate rows?
a. df.duplicate()
b. df.duplicates()
c. df.duplicated()
d. df.has_duplicates()
Answer: c. df.duplicated()scribd+1 - To drop columns in DataFrame ‘df’, use:
a. df.drop([‘col1’], axis=1)
b. df.remove(‘col1’)
c. df.delete(‘col1’)
d. df.eliminate(‘col1’)
Answer: a. df.drop([‘col1’], axis=1)scribd+1 - Which Pandas attribute provides the shape (rows, columns) of DataFrame?
a. shape
b. size
c. len
d. count
Answer: a. shapesanfoundry - What’s the result of pd.Series() + pd.Series()?gyansetu+4
a. NaN for unmatched index
b. Error
c. Sum of all elements
d. The resulting Series has 2 elements
Answer: a. NaN for unmatched indexcsiplearninghub - How can you reset row indexes of a DataFrame and create a new one?
a. df.reset_index()
b. df.update_index()
c. df.fresh_index()
d. df.rename_index()
Answer: a. df.reset_index()sanfoundry - Which method can read SQL data into Pandas?
a. read_sql()
b. import_sql()
c. sql_read()
d. get_sql()
Answer: a. read_sql()datacamp+1 - Which one filters numeric columns only from a DataFrame?
a. df.select_dtypes(include=[‘number’])
b. df.numeric()
c. df.filter_numeric()
d. df.types()
Answer: a. df.select_dtypes(include=[‘number’])datacamp - For time series data, which Pandas function creates date ranges?
a. pd.date_range()
b. pd.datetime_range()
c. pd.dates()
d. pd.timeseries()
Answer: a. pd.date_range()sanfoundry - How would you access the first row of DataFrame ‘df’?
a. df.iloc
b. df.loc
c. df.row(0)
d. df
Answer: a. df.ilocdatacamp+1 - What does chaining df[‘col1’].str.upper() do?
a. Converts strings in col1 to uppercase
b. Sorts column
c. Returns unique values
d. Fills missing values
Answer: a. Converts strings in col1 to uppercasedatacamp - Which function checks for missing values in DataFrame?
a. df.isnull()
b. df.ismissing()
c. df.is_nan()
d. df.checknull()
Answer: a. df.isnull()sanfoundry - Which of the following updates data in place in a DataFrame?
a. inplace=True
b. inplace=1
c. inplace=active
d. inplace=update
Answer: a. inplace=Truescribd+1
- https://www.sanfoundry.com/data-science-questions-answers-pandas-data-structure/
- https://www.scribd.com/document/858687143/Pandas-MCQ-and-Direct-QA
- https://csiplearninghub.com/pandas-mcq-questions-with-answers-class-12-ip/
- https://www.datacamp.com/blog/top-python-pandas-interview-questions-and-answers
- https://www.gyansetu.in/blog/data-analytics-mcq-quiz-interview-preparation/
- https://www.gyansetu.in/blog/data-science-objective-type-mcq-quiz-interview-preparation/
- https://www.machinelearningplus.com/python/101-pandas-exercises-python/
- https://rfaqs.com/r-graphics/python-pandas-data-frame-mcqs-17/
- https://www.includehelp.com/python/pandas-mcqs.aspx
- https://stackoverflow.com/questions/70051045/how-to-transform-multiple-choice-questions-into-readable-data-with-pandas-in-pyt
- https://www.scribd.com/document/851945567/Data-Analyst-Multiple-Choice-Questions
- https://www.scribd.com/document/523212529/Pandas-mcqs-with-answers
- https://www.w3schools.com/python/pandas/pandas_quiz.asp
- https://github.com/krishnaik06/The-Grand-Complete-Data-Science-Materials
- https://www.w3resource.com/python-exercises/pandas/index.php
- https://www.geeksforgeeks.org/python/python-multiple-choice-questions/
- https://www.interviewbit.com/pandas-interview-questions/
- https://www.nielit.gov.in/sites/default/files/headquarter/education/question/JUL2023/A101-R5_July2023.pdf