IP Practical File
IP Practical File
ANS 1
Complete the given Python code to get the required output as: Rajasthan
Ans2
Ans3
Consider two objects L and S. L is a list whereas S is a Series. Both have values 20, 40,90, 110. What will be
the output of the following two statements considering that the above objects have been created already.
ANS4
ANS 5
ANS6
Ans7
a- stock=pd.DataFrame()
b- stock [ 'discount']=[15,20,30,25]
c- stock.drop('discount',axis=1)
ANS8
Single Row Functions and Multi-Row Functions.
1. Single Row Functions: Single Row Functions operate on a single
row at a time and return a single result per row. These functions
are used to manipulate or modify data values within a single row
and return the modified value. Single Row Functions can be
further classified into the following categories:
Numeric Functions: These functions operate on numeric data
types and return numeric values.
String Functions: These functions operate on string data types
and return string values.
Date Functions: These functions operate on date and time data
types and return date and time values.
Conversion Functions: These functions are used to convert data
from one data type to another.
Miscellaneous Functions: These functions include various other
types of functions that do not fit into the above categories.
ANS9
Ans10
Ans11
difference between the following two statements, which are creating
two dataframes using the same dataframe, is as follows:
1. Df2=pd.DataFrame(df1): This statement creates a new
dataframe Df2 using the existing dataframe df1. The new
dataframe Df2 is a reference to the existing dataframe df1. This
means that any changes made to Df2 will also affect the original
dataframe df1.
2. Df3=pd.DataFrame(df1, copy=True): This statement creates a
new dataframe Df3 using the existing dataframe df1 and sets
the copy argument to True. The new dataframe Df3 is a copy of the
existing dataframe df1. This means that any changes made
to Df3 will not affect the original dataframe df1.
Ans12
Ans13
Aggregate functions are a type of function in databases and
programming languages that perform a calculation on a set of values
and return a single value as a result. These functions are used to
summarize data, making it easier to analyze and understand trends or
patterns. They are particularly useful in SQL (Structured Query
Language) for database management systems, but they are also found
in other programming languages and data analysis tools.
some common aggregate functions and their descriptions:
1. COUNT: Counts the number of rows that match a specified criterion. It
can be used to count all rows or only those that are not null for a
specified column.
2. SUM: Adds together all the values in a particular column. It is typically
used with numeric data types.
3. AVG: Calculates the average of the values in a column. It ignores NULL
values and only works with numeric data types.
4. MIN: Finds the smallest value in a column. It can be used with numeric,
string, and date/time data types.
5. MAX: Finds the largest value in a column. It can also be used with
numeric, string, and date/time data types.
Ans14
The GROUP BY clause in SQL is used to group rows that have the same
values in one or more columns, and it is often used in conjunction with
aggregate functions to perform calculations for each group. The GROUP
BY clause follows the FROM clause and comes before the ORDER
BY clause if it's used.
Ans15
Ans16
Ans17
Ans18
i.
ii.
Ans19
Ans20