Pandas DataFrame Operations
30 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What data structure in pandas is a 1-dimensional array?

  • Dataframe
  • Dictionary
  • Series (correct)
  • Array

What is the minimum number of arguments required to pass in a pandas Series?

  • 3
  • 2
  • 0
  • 1 (correct)

Which of the following is not a feature of a pandas Series?

  • Homogeneous data
  • Immutable size
  • Mutable data
  • Multiple columns (correct)

What is the full form of NaN in pandas?

<p>Not a Number (D)</p> Signup and view all the answers

What package is required to create a pandas Series?

<p>Pandas (D)</p> Signup and view all the answers

What data structure can be used to analyze data in pandas?

<p>Both (D)</p> Signup and view all the answers

What is the output of the following code: import pandas as pd; s = pd.Series(5, index=[0, 1, 2, 3]); print(s)?

<p>0 5 (D)</p> Signup and view all the answers

What is the minimum number of arguments required to pass in a pandas Series?

<p>1 (D)</p> Signup and view all the answers

What can be used to create a pandas Series?

<p>All of them (A)</p> Signup and view all the answers

What is the output of the following code: import pandas as pd; s = pd.Series(5, index=[0, 1, 2, 3]); print(s)?

<p>0 5 1 5 2 5 3 5 dtype: int64 (A)</p> Signup and view all the answers

What does NaN stand for in pandas?

<p>Not a Number (A)</p> Signup and view all the answers

What is the output of the following code: import pandas as pd; s = pd.Series([1,2,3]); t = pd.Series([1,2,4]); u = s-t; print(u)?

<p>0 0 1 0 2 -1 dtype: int64 (C)</p> Signup and view all the answers

What is a DataFrame in Pandas?

<p>A two-dimensional array with heterogeneous data (A)</p> Signup and view all the answers

What is the purpose of the drop() function in a DataFrame?

<p>To delete a column or row (A)</p> Signup and view all the answers

Which function can be used to read a dataset from a large text file?

<p>read_csv (B)</p> Signup and view all the answers

What can be used to create a DataFrame in Pandas?

<p>All of the above (D)</p> Signup and view all the answers

What is the full form of a CSV file?

<p>Comma Separated Value (A)</p> Signup and view all the answers

What is the correct Pandas syntax to read in a CSV file and assign it to a DataFrame?

<p>df = pd.read_csv('file.csv') (B)</p> Signup and view all the answers

What does the line of code 'df.dropna()' do?

<p>Drops NaN values (C)</p> Signup and view all the answers

What is the default number of rows returned by the head() function in a Series?

<p>5 (D)</p> Signup and view all the answers

What is the difference between a DataFrame and a Series?

<p>A DataFrame is two-dimensional, while a Series is one-dimensional (B)</p> Signup and view all the answers

What does the iteritems() function do?

<p>Returns a tuple with the column name and the content as a Series (C)</p> Signup and view all the answers

What is the dimension of a Series in Pandas?

<p>1 Dimensional Array (A)</p> Signup and view all the answers

What is the minimum number of arguments required to pass in a Pandas Series?

<p>1 (D)</p> Signup and view all the answers

Which of the following statements will display the last few rows of the dataframe?

<p>Print(df.tail()) (D)</p> Signup and view all the answers

Which of the following commands will delete the 'rank2' row from the dataframe?

<p>df.drop('rank2') (A)</p> Signup and view all the answers

What is the correct way to add a new column 'Marks' to the dataframe with the values 12, 22, 21, 24?

<p>df['marks'] = [12, 22, 21, 24] (B)</p> Signup and view all the answers

What is the attribute used to specify column labels in a DataFrame?

<p>columns (B)</p> Signup and view all the answers

Which of the following functions can be used to extract a row or column from a DataFrame?

<p>All of the above (D)</p> Signup and view all the answers

What is the number of arguments required by the insert function in a DataFrame?

<p>3 (D)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser