DATAFRAME : A DataFrame is a primary data structure in the Pandas library, a powerful open-source data manipulation and analysis library for Python. A DataFrame is a two-dimensional, size-mutable, and heterogeneous tabular data structure with labeled axes (rows and columns). It is similar in structure to a spreadsheet or a SQL table, with rows and columns of data. DataFrames can be created from various data sources such as lists, dictionaries, numpy arrays, and CSV files. They also provide a rich set of methods and attributes for manipulating, transforming, and analyzing data. DataFrames are widely used in data science and machine learning projects for data cleaning, feature engineering, and model building.
PYTHON DATAFRAME
1.What is the primary data structure in the
Pandas library? a) List b) Tuple c) Dataframe d) Dictionary
|
Answer: c)
Dataframe |
2.What is the function used to display the
first 5 rows of a dataframe in Pandas? a) head() b) top() c) first() d)
print()
|
Answer: a) head() |
3.How do you select a specific column in a
dataframe? a) df["column_name"] b) df.column_name c)
df[column_name] d) df.get("column_name")
|
Answer: a)
df["column_name"] |
4.What is the function used to sort a
dataframe by a specific column in Pandas? a) sort() b) sort_by() c)
order() d) sort_values()
|
Answer: d)
sort_values() |
5.What is the function used to drop a column
from a dataframe in Pandas? a) remove() b) delete() c) drop() d)
discard()
|
Answer: c) drop() |
6.What is the function used to concatenate two
dataframes in Pandas? a) join() b) merge() c) concat() d) append()
|
Answer: c)
concat() |
7 How do you rename a column in a dataframe? a) df.rename(column_name) b) df.change_name(column_name) c)
df.rename(columns={old_name: new_name}) d) df.rename_column(old_name,
new_name)
|
Answer: c)
df.rename(columns={old_name: new_name}) |
8.What is the function used to find the unique
values in a column of a dataframe? a) unique() b) distict() c) values() d) set()
|
Answer: a)
unique() |
9.What is the function used to find the mean
of all numeric columns in a dataframe? a) mean() b) average() c) median() d) sum()
|
Answer: a) mean() |
10.What is the function used to fill missing
values in a dataframe? a) fillna() b) replace() c) impute() d)
fill_missing()
|
Answer: a)
fillna() |
No comments:
Post a Comment