1.
Which of the following thing can be data in Pandas?
Correct Answer
D. All of the mentioned
Explanation
All of the mentioned options can be data in Pandas. Pandas is a powerful Python library used for data manipulation and analysis. It provides various data structures such as Series (1-dimensional labeled array), DataFrame (2-dimensional labeled data structure), and Panel (3-dimensional labeled data structure). Pandas can handle different types of data, including python dictionaries, ndarrays (n-dimensional arrays), and scalar values. Therefore, all of the mentioned options can be considered as data in Pandas.
2.
Point out the correct statement.
Correct Answer
B. NaN is the standard missing data marker used in pandas
Explanation
The correct statement is that NaN is the standard missing data marker used in pandas. In pandas, NaN stands for "Not a Number" and is used to represent missing or undefined values in a DataFrame or Series. It is a common practice in data analysis to use NaN to indicate missing data and pandas provides various methods to handle and manipulate these missing values.
3.
The result of an operation between unaligned Series will have the ________ of the indexes involved.
Correct Answer
B. Union
Explanation
The result of an operation between unaligned Series will have the union of the indexes involved. This means that all the unique indexes from both Series will be included in the result, regardless of whether they are present in one or both of the Series.
4.
Which of the following input can be accepted by DataFrame?
Correct Answer
D. All of the mentioned
Explanation
DataFrame is a data structure in pandas that can accept various types of input data. It can accept a structured ndarray, which is a multidimensional array with a defined data type. It can also accept a series, which is a one-dimensional labeled array. Additionally, DataFrame can accept another DataFrame as input. Therefore, the correct answer is "All of the mentioned" because DataFrame can accept all of these types of input data.
5.
Point out the wrong statement.
Correct Answer
A. A DataFrame is like a fixed-size dict in that you can get and set values by index label
Explanation
The given statement is incorrect because a DataFrame is not like a fixed-size dict. While both a DataFrame and a dict have index labels, a DataFrame is a two-dimensional data structure with labeled axes (rows and columns) whereas a dict is a collection of key-value pairs. In a DataFrame, values can be accessed and set using both index labels and column labels.
6.
Which of the following takes a dict of dicts or a dict of array-like sequences and returns a DataFrame?
Correct Answer
A. DataFrame.from_items
Explanation
The correct answer is DataFrame.from_items. This method takes a dictionary of dictionaries or a dictionary of array-like sequences and converts it into a DataFrame. It is used to create a DataFrame from a nested dictionary structure, where the outer dictionary represents the columns and the inner dictionary represents the rows. This method is useful when you have data organized in a nested dictionary format and want to convert it into a tabular format for analysis or manipulation.
7.
Which of the following works analogously to the form of the dict constructor?
Correct Answer
A. DataFrame.from_items
Explanation
The correct answer is DataFrame.from_items. This function works analogously to the form of the dict constructor, where it takes a list of (key, value) pairs and creates a DataFrame from it. It is used to create a DataFrame from a dictionary-like object, where the keys are the column names and the values are the data in each column.
8.
Which of the following operation works with the same syntax as the analogous dict operations?
Correct Answer
D. All of the mentioned
Explanation
All of the mentioned operations (getting columns, setting columns, and deleting columns) work with the same syntax as the analogous dict operations. This means that you can use similar syntax to perform these operations on a dictionary as well as on other data structures.
9.
Best way to import the pandas module in your program ?
Correct Answer
D. All of the above
Explanation
All of the above options are correct ways to import the pandas module in a program. The first option "import pandas" imports the pandas module using its full name. The second option "import pandas as p" imports the pandas module and assigns it the alias "p". The third option "from pandas import *" imports all the functions and classes from the pandas module directly into the program's namespace. Therefore, all three options are valid ways to import the pandas module.
10.
DataFrame in pandas is
Correct Answer
B. 2 dimensional array
Explanation
A DataFrame in pandas is a 2-dimensional array because it is a tabular data structure that consists of rows and columns. Each column can have a different data type, and it can be thought of as a spreadsheet or a SQL table. It provides a convenient way to manipulate and analyze data, and it is one of the most commonly used data structures in pandas.
11.
For what purpose a Pandas is used ?
Correct Answer
C. To create a High level array
Explanation
Pandas is a popular library in Python used for data manipulation and analysis. It provides high-level data structures like DataFrames, which are essentially high-level arrays, allowing users to easily work with structured data. With Pandas, users can perform various operations on arrays such as filtering, sorting, grouping, and aggregating data. It is not used for creating GUI programming or databases, so the correct answer is "To create a High level array".
12.
Minimum number of argument we require to pass in pandas series ?
Correct Answer
B. 1
Explanation
To create a pandas series, we need to pass at least one argument. This argument can be a list, array, dictionary, or scalar value. The series will be created with the passed argument as the data.
13.
Series in Pandas is
Correct Answer
A. 1 dimensional array
Explanation
A Series in Pandas is a one-dimensional array-like object that can hold any data type. It is similar to a column in a spreadsheet or a SQL table. Each element in the Series has a unique label called an index, which allows for easy and efficient data manipulation and analysis. Therefore, the correct answer is that a Series in Pandas is a one-dimensional array.
14.
We can analyze the data in pandas with :
Correct Answer
C. Both of the above
Explanation
The correct answer is "Both of the above" because pandas is a powerful library in Python that provides data structures and functions for efficient data manipulation and analysis. It offers two main data structures: Series and DataFrame. Series is a one-dimensional labeled array that can hold any data type, while DataFrame is a two-dimensional labeled data structure with columns of potentially different types. Therefore, pandas allows us to analyze data using both Series and DataFrame, making the answer "Both of the above" the correct choice.
15.
Which function from the options given below can read the dataset from a large text file?
Correct Answer
D. Read_csv
Explanation
The read_csv function can read the dataset from a large text file. This function is specifically designed to read data from comma-separated values (CSV) files. It can handle large files efficiently and is commonly used for reading tabular data. The other options, read_json, read_pickle, and read_hdf, are used for reading data from different file formats and may not be suitable for reading large text files.
16.
This function in the library of Pandas allows you to manipulate data and create new variables:
Correct Answer
C. Apply function
Explanation
The apply function in the Pandas library allows users to manipulate data and create new variables. It is commonly used to apply a function to each element or row/column of a DataFrame. This function is useful for performing operations like data transformation, filtering, and aggregation on the data. It helps to modify the data in a flexible and efficient manner, making it a powerful tool for data manipulation in Pandas.
17.
Which of these is an invalid writer function in Pandas?
Correct Answer
B. To_text
Explanation
The to_text function is not a valid writer function in Pandas. Pandas does not have a built-in to_text function for writing data to a text file. Instead, Pandas provides other writer functions such as to_csv, to_excel, and to_json for writing data to different file formats.
18.
Identify the correct statement:
Correct Answer
D. All of the above
Explanation
The correct answer is "All of the above". This is because all three statements are true. Moving window statistics is indeed present in pandas, as it provides functions like rolling mean and rolling standard deviation. Pandas does have a set of array data structures which are labelled, such as Series and DataFrame, which allow for easy manipulation and analysis of data. Lastly, pandas does consist of an integrated group by engine for transforming and aggregating data sets, which is useful for tasks like grouping data by a specific column and performing operations on the groups.
19.
Data structures in Pandas can be mutated in the terms of ____ but not of _____.
Correct Answer
B. Value,size
Explanation
Data structures in Pandas can be mutated in terms of their values, meaning that the values within the data structure can be changed or modified. However, the size of the data structure, which refers to the number of elements or rows in the structure, cannot be directly mutated.
20.
Assume that you are given two lists:
a = [1,2,3]
b = [4,5,6]
Your task is to create a list which contains all the elements of a and b in a single dimension. Output:
a = [1,2,3,4,5,6]
Which of the following functions will you use?
Correct Answer
B. A.extend(b)
Explanation
The correct answer is "a.extend(b)" because the extend() function is used to append all the elements of one list to the end of another list. In this case, it will append all the elements of list b to the end of list a, resulting in a single dimension list containing all the elements of both lists. The append() function, on the other hand, would add the entire list b as a single element at the end of list a, resulting in a nested list.
21.
If data is an ndarray, index must be the same length as data.
Correct Answer
A. True
Explanation
This statement is true because in NumPy, when indexing an ndarray, the index must be of the same length as the data. This means that if the data is a 1-dimensional array, the index must be a single value. If the data is a 2-dimensional array, the index must be a tuple of two values specifying the row and column indices. If the lengths do not match, a ValueError will be raised.
22.
Are DataFrames container for Series.
Correct Answer
A. True
Explanation
DataFrames are indeed containers for Series. A DataFrame is a two-dimensional data structure that can hold multiple Series objects. Each column in a DataFrame is a Series, and the entire DataFrame is a collection of these columns. This allows for easy manipulation and analysis of tabular data, as each column can be accessed and operated on individually. Therefore, the given answer of "True" is correct.
23.
Pandas is an Open source Software.
Correct Answer
A. True
Explanation
Pandas is indeed an open source software. This means that its source code is freely available and can be modified and distributed by anyone. Open source software encourages collaboration and transparency, allowing developers and users to contribute to its development and improvement. Pandas, specifically, is a popular data manipulation and analysis library for the Python programming language, widely used in data science and data analysis projects. Its open source nature has contributed to its widespread adoption and continuous development by a large community of contributors.
24.
The Boolean values like 1 & 2 can be used as indexes in panda dataframe.
Correct Answer
B. False
Explanation
The statement is incorrect. Boolean values like 1 & 2 cannot be used as indexes in a pandas dataframe. The index of a dataframe must be a unique identifier for each row, and it is typically an integer or a string. Using boolean values as indexes would lead to ambiguity and potential errors in indexing and retrieving data from the dataframe.
25.
Once NumPy array is created its size can be changed.
Correct Answer
B. False
Explanation
Once a NumPy array is created, its size cannot be changed. The size of a NumPy array is determined at the time of creation and remains fixed. If you want to change the size of a NumPy array, you need to create a new array with the desired size and copy the data from the original array to the new array.
26.
Every numPy array consists of only homogenous types.
Correct Answer
A. True
Explanation
The given statement is true. A NumPy array is a grid of values, all of the same type, and is indexed by a tuple of nonnegative integers. This means that all the elements in a NumPy array must have the same data type, such as integers, floats, or strings. This homogeneity of data types allows for efficient storage and computation on the array.
27.
Full form of NumPy is Numerator Python.
Correct Answer
B. False
Explanation
The given statement is incorrect. The full form of NumPy is not "Numerator Python". NumPy stands for "Numerical Python". It is a library in Python used for scientific computing and working with arrays and matrices.
28.
A pandas Series can be created using the following constructor − pandas.Series( data, index, dtype, copy)
Correct Answer
A. True
Explanation
The given statement is true. A pandas Series can indeed be created using the constructor pandas.Series( data, index, dtype, copy). This constructor allows us to create a one-dimensional labeled array-like object called a Series, where data can be a list, ndarray, or scalar value, index is the index labels for each element in the data, dtype is the data type of the values in the Series, and copy is a boolean parameter indicating whether to copy the data or not.
29.
The power of Pandas is brought to the physical sciences by x-ray.
Correct Answer
A. True
Explanation
Pandas is a powerful data manipulation and analysis library in Python. It provides various functionalities and tools that can be used in different fields, including the physical sciences. X-ray is a common technique used in the physical sciences for imaging and analyzing materials. By using Pandas, scientists can efficiently handle and analyze the data obtained from x-ray experiments, making it a valuable tool in the physical sciences. Therefore, the statement "The power of Pandas is brought to the physical sciences by x-ray" is true.
30.
If the data is in the form of an ndarray, the index and the data must be of the same length.
Correct Answer
A. True
Explanation
This statement is true because in an ndarray, the index and the data must be aligned properly. The index represents the position of each element in the array, while the data represents the actual values of the elements. For the array to be valid, the length of the index and the length of the data must be the same. If they are not of the same length, the data would not be aligned correctly with the index, resulting in an inconsistent and incorrect representation of the data. Therefore, the statement is true.