apply()
Click to see answer
The apply() function allows you to apply a function along either the row (axis=1) or column (axis=0) of a DataFrame.
Click to see question
apply()
The apply() function allows you to apply a function along either the row (axis=1) or column (axis=0) of a DataFrame.
What is loc in the context of accessing rows in a DataFrame?
loc is label-based indexing, allowing access to specific rows using row labels or indices.
What is Element-wise subtraction in DataFrames?
Element-wise subtraction between two DataFrames is done using the '-' operator, producing a new DataFrame that contains the difference of corresponding elements from the first DataFrame minus the second.
What is accessing columns in a DataFrame?
Accessing a specific column of the DataFrame by using the column name, e.g., print(df['Name']) for a single column or print(df[['Name', 'City']]) for multiple columns.
What is Element-wise addition in DataFrames?
Element-wise addition of two DataFrames is performed using the '+' operator, resulting in a new DataFrame that contains the sum of corresponding elements from both DataFrames.
What is Indexing in Pandas?
Indexing in Pandas refers to the method of accessing data in DataFrames and Series using row and column labels or positions.
What is iloc in the context of accessing rows in a DataFrame?
iloc is integer-location based indexing, which allows access to rows using their positions based on a 0-based index.
What is the applymap() function?
The applymap() function is used to apply a function element-wise across the entire DataFrame.
What is Merging in Pandas?
Merging is the process of using pd.merge() to merge DataFrames based on a common column or index.
What does the map() function do?
The map() function is used for element-wise transformations in Series objects and can accept a dictionary, a Series, or a function.
What is Element-wise division in NumPy?
Element-wise division is the operation that divides corresponding elements of one array by another, resulting in a new array.
What are the main uses of SciPy?
SciPy is frequently used for statistical computations, signal processing, and solving differential equations.
How can you access the 'name' field in a structured array?
You can access the 'name' field in a structured array by using the syntax students['name'].
What is Hierarchical Indexing in pandas?
Hierarchical indexing (or MultiIndex) allows for more complex data structures in pandas, where data can be indexed by multiple levels.
What is the Mean in the context of NumPy arrays?
The Mean is the average value of the array elements, calculated using the function np.mean(arr).
What is an ndarray in NumPy?
The ndarray is the core data structure in NumPy, representing a multidimensional array that allows for efficient storage and manipulation of large datasets.
What is data wrangling?
Data wrangling (also known as data cleaning or data preprocessing) involves transforming raw data into a more usable format.
What are the key features of ndarray?
Key features of ndarray include homogeneous data, where all elements must be of the same type, and multi-dimensional capability, allowing the creation of arrays of any number of dimensions (1D, 2D, 3D, etc.).
What is Boolean indexing in Pandas?
Boolean indexing in Pandas is a method of filtering data using conditions to select specific rows based on boolean values.
How do you compute the average salary using Pandas?
You can compute the average salary by using the syntax df['Salary'].mean().
What is the purpose of the df.dropna() function in Pandas?
The df.dropna() function is used to drop missing values from a DataFrame.
How do you create a 1D NumPy array?
A 1D NumPy array can be created using the np.array() function with a list as an argument, for example, np.array([1, 2, 3]).
What is Fancy indexing?
Fancy indexing allows you to retrieve multiple elements or rows/columns from an array using another array of indices.
What is the syntax for adding a new column using an arithmetic operation in Pandas?
The syntax is df['column1'] + df['column2'], which allows you to perform arithmetic operations between columns.
What does the addition operation df1 + df2 do?
It adds elements of DataFrame df1 and df2 element-wise.
How can you transpose a matrix in NumPy?
You can transpose a matrix in NumPy using the transpose() function or the .T attribute.
How do you access multiple rows and columns by position in Pandas?
You can use df.iloc[0:2, 1:3] to access multiple rows and columns by position.
What is Conditional Selection in Pandas?
Conditional Selection allows you to filter data based on specific conditions, selecting rows that meet certain criteria.
What does Data selection in Pandas involve?
Data selection in pandas involves accessing specific rows, columns, or elements from a DataFrame.
What is the function of the map() method in Pandas?
The map() method is used to substitute values in a Series based on a dictionary or function.
What is a Transposed Matrix?
A transposed matrix is obtained by swapping the rows and columns of the original matrix. For example, the transposed form of [[1, 4], [2, 5], [3, 6]] is [[1, 2, 3], [4, 5, 6]].
What is the purpose of the 'apply' function in pandas?
The 'apply' function in pandas is used to apply a function along an axis of the DataFrame, allowing for transformations or calculations on specific columns or rows.
What is the purpose of np.max?
The function np.max is used to find the maximum value in a NumPy array.
What is the Mean in NumPy?
The mean (average) of the elements in the array can be computed using the mean() function.
What is Element-wise division in DataFrames?
Element-wise division is the operation where each element of one DataFrame is divided by the corresponding element of another DataFrame, resulting in a new DataFrame.
What does Standard Deviation measure in NumPy?
The standard deviation measures how spread out the values are, and the variance is the square of the standard deviation.
What is Combining Datasets?
Combining datasets involves merging, concatenating, or joining multiple DataFrames.
What does loc[] do in Pandas?
The loc[] function in Pandas is used for label-based indexing, allowing selection of data based on row and column labels.
What is Element-wise multiplication in DataFrames?
Element-wise multiplication of two DataFrames is achieved using the '*' operator, resulting in a new DataFrame that contains the product of corresponding elements from both DataFrames.
What is Element-wise subtraction in NumPy?
Element-wise subtraction is the operation that subtracts corresponding elements of one array from another, resulting in a new array.
What is an array in NumPy?
An array in NumPy is a grid of values, all of the same type, and is indexed by a tuple of non-negative integers.
What is a structured array in NumPy?
A structured array is an array that allows you to define the data types for each column using a list of tuples that specify the name and data type of each field.
What does slicing an array mean?
Slicing an array means selecting a subset of elements from the array based on specified indices.
What is Joining in Pandas?
Joining is the process of using df.join() to join DataFrames on their index.
What is the output of slicing the first 3 elements of an array?
The output is the first three elements of the array, for example, [10, 20, 30].
What does the df.fillna(0) function do in Pandas?
The df.fillna(0) function is used to fill missing values in a DataFrame with zero.
What is Fancy Indexing in NumPy?
Fancy indexing is a method in NumPy that allows access to specific elements of an array using an array of indices.
What is the natural logarithm function in NumPy?
The natural logarithm function computes the natural logarithm (ln) of each element in the array.
What is the purpose of df.reset_index(inplace=True)?
It resets the index of the DataFrame to the default integer index, removing any custom index that was set.
What is the function of np.std() in NumPy?
The np.std() function calculates the standard deviation of the elements in an array.
What are Structured Arrays in NumPy?
Structured arrays in NumPy are used to handle heterogeneous data, allowing different types of data (e.g., integers, floats, strings) within a single array, similar to tables.
What is the purpose of df.loc[]?
df.loc[] is used to access rows and columns by labels in a DataFrame.
What is a Series in Pandas?
A Series is a one-dimensional labeled array capable of holding any data type, and it can be accessed using the column name from a DataFrame.
What is the purpose of the passed_students variable?
passed_students is a boolean array indicating which students have marks greater than 50, signifying they passed.
What is iloc[] in Pandas?
The iloc[] function selects data by row and column positions using a 0-based index.
What is df.fillna(value) in Pandas?
A method used to fill missing data in a DataFrame with a specified value or method, such as forward filling or backward filling.
What is NumPy?
NumPy (Numerical Python) is a fundamental package in Python for scientific computing, providing support for arrays, matrices, and a large number of mathematical functions to operate on these data structures efficiently.
How can you find the Min and Max values in an array using NumPy?
You can find the minimum and maximum values in an array using min() and max() functions.
What is the syntax for Slicing in NumPy?
The syntax for slicing in NumPy is array[start:end:step], which allows you to access a subset of an array.
What does the Max function do in NumPy?
The max() function returns the maximum value in an array.
What is the cumulative sum in NumPy?
The cumulative sum is computed using the cumsum() function, which returns the cumulative sum of the array elements.
What is the purpose of the percentile() function?
The percentile() function gives the value below which a given percentage of observations fall.
What is Pandas?
Pandas is a powerful Python library for data manipulation and analysis, providing data structures like Series and DataFrame to work with structured data, such as tabular datasets, facilitating easy data cleaning, preparation, and analysis.
What is loc in Pandas?
loc is a method in Pandas used to access a group of rows and columns by labels or a boolean array.
What is the purpose of the np.add() function?
The np.add() function performs element-wise addition of two arrays.
What does the corrcoef() function compute?
The corrcoef() function computes the correlation coefficient matrix between two arrays.
How can you categorize age using a custom function in Pandas?
You can categorize age by defining a custom function and applying it to the age column using df['column_name'].apply(function).
What are Structured arrays?
Structured arrays are useful for handling heterogeneous data, like rows in a table, where each field can have a different data type.
What functions can be used to create NumPy arrays with initial values?
Functions like np.zeros(), np.ones(), and np.arange() can be used to create NumPy arrays with initial values.
What is Pandas?
Pandas is a powerful Python library used for data manipulation and analysis, providing data structures like DataFrames and Series for easy handling of structured data.
How do you create a DataFrame using a dictionary in Pandas?
You can create a DataFrame by passing a dictionary to the pd.DataFrame() constructor, where the keys represent column names and the values are lists of column data.
What is the syntax for filtering rows based on a condition in Pandas?
The syntax is df[df['column_name'] condition], which allows you to select rows that satisfy the given condition.
What is Boolean Logic in the context of NumPy?
Boolean Logic in NumPy refers to the use of boolean conditions to filter and select elements from arrays based on specified criteria.
What is a key advantage of vectorization?
Vectorized operations are significantly faster than for-loop based code.
What is a NumPy array?
A NumPy array is a powerful N-dimensional array object that allows for efficient storage and manipulation of numerical data.
What is a combined condition for filtering in Pandas?
A combined condition for filtering can be created using logical operators, such as using & to combine conditions like (df['Age'] > 30) & (df['Salary'] < 85000).
What are some methods to handle missing data in pandas?
Pandas provides methods like 'pd.isna()' or 'pd.isnull()' to detect missing values, which can be used to handle missing data effectively.
What are the sample data structures used to create the DataFrames in the example?
The sample data structures are dictionaries named 'data1' and 'data2', each containing lists of values for columns 'A', 'B', and 'C'.
What is Group By in Pandas?
Group By is a method in Pandas that allows you to group data using df.groupby() and apply aggregation functions like sum(), mean(), etc.
How do you create a MultiIndex DataFrame in pandas?
You can create a MultiIndex DataFrame using the pd.MultiIndex.from_arrays method, providing arrays for the index levels.
What does Indexing in NumPy allow you to do?
Indexing in NumPy allows you to access specific elements of an array, with arrays being zero-indexed.
What is Pandas?
Pandas is the most popular library for data manipulation and analysis in Python, providing powerful tools for handling structured data like DataFrames and Series.
What is the Min function in NumPy?
The min() function returns the minimum value in an array.
How does Pandas handle missing data during arithmetic operations?
Pandas handles missing values (NaN) gracefully during arithmetic operations; if either element is NaN, the result will also be NaN unless specified otherwise using the fill_value parameter.
What is iloc[] used for in Pandas?
The iloc[] function in Pandas is used for position-based indexing, allowing selection of data based on integer positions.
What is a pivot table?
A pivot table is a data processing tool that allows for the summarization and organization of data, typically used to group and aggregate values based on specific categories.
What is Openpyxl?
Openpyxl is used for reading and writing Excel files.
What is NumPy?
NumPy is a fundamental package for numerical computations in Python, providing support for creating and manipulating large arrays and matrices of numeric data.
What is the purpose of the CSV module?
The CSV module is used for working with CSV files.
What is a 1D NumPy array?
A 1D NumPy array is a one-dimensional array created using the np.array() function, which can hold a sequence of elements.
What is Pandas used for?
Pandas is used for advanced data wrangling tasks like filtering, transforming, and aggregating data.
How do you create a 2D NumPy array?
A 2D NumPy array can be created using the np.array() function with a list of lists as an argument, for example, np.array([[1, 2], [3, 4]]).
What do the sum() and prod() functions do?
The sum() function computes the sum of all elements in an array, while the prod() function computes the product of all elements.
How do you add a new column 'New_Salary' by increasing 'Salary' by 10% in Pandas?
You can add the new column using the syntax df['New_Salary'] = df['Salary'] * 1.1.
What is the purpose of the apply() method in Pandas?
The apply() method applies a function along the axis of the DataFrame.
What does np.ones() do?
The np.ones() function creates an array filled with ones, with a specified shape.
How do you select a single column in a DataFrame?
You can select a single column by using the syntax df['column_name'].
How do you select columns in Pandas?
You can select a single or multiple columns using the column name with syntax: df['column_name'] or df[['column1', 'column2']].
What is the syntax to select a row using iloc?
The syntax to select a row using iloc is df.iloc[row_index].
What is NaN in a DataFrame?
NaN stands for 'Not a Number' and is used to represent missing or undefined values in a DataFrame.
applymap()
The applymap() function is used to apply a function to each element of a DataFrame, returning a DataFrame of the same shape.
What is the Median in NumPy?
The median of the elements can be computed using the median() function.
What happens when you perform arithmetic operations with Scalars in Pandas?
When performing arithmetic operations with a scalar, the operation is applied to each element of the DataFrame, resulting in a new DataFrame with the scalar added to each element.
What does df.dropna() do in Pandas?
A method used to remove rows or columns from a DataFrame that contain missing data.
How can you filter rows where Age is greater than 30?
You can filter rows where Age is greater than 30 using the expression df[df['Age'] > 30].
How can you filter rows where Salary is less than 80000?
You can filter rows where Salary is less than 80000 using the expression df[df['Salary'] < 80000].
What is Element-wise multiplication in NumPy?
Element-wise multiplication is the operation that multiplies corresponding elements of two arrays, resulting in a new array.
What is SciPy?
SciPy builds on NumPy and provides additional utilities for scientific computing, including modules for optimization, integration, and interpolation.
What does the cumprod() function do in NumPy?
The cumprod() function computes the cumulative product of the array elements.
What does the 50th percentile represent?
The 50th percentile, also known as the median, is the value that separates the higher half from the lower half of the data set.
What does the exponential function do in NumPy?
The exponential function computes e raised to the power of each element in the array.
What does df.set_index('Name') do?
It sets the 'Name' column as the index of the DataFrame, allowing for easier access to data using names.
What is a 2D NumPy array?
A 2D NumPy array is a two-dimensional array created using the np.array() function, which can hold a matrix of elements.
What are apply(), applymap(), and map() in Pandas?
They are powerful tools to apply functions and transformations to DataFrames and Series.
What is a DataFrame in Pandas?
A DataFrame is a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns) in Pandas.
What are NumPy arrays?
NumPy arrays are a key feature of the NumPy library that provide efficient storage and manipulation of large datasets, especially numerical data.
What is the primary use of NumPy?
Numerical computing and array handling.
What is the purpose of np.arange()?
The np.arange() function creates an array with a range of values, specified by a start, stop, and step size.
How do you select rows where salary is greater than 55,000 in Pandas?
You can select these rows using the syntax high_salary = df[df['Salary'] > 55000].
What is vectorization in NumPy?
Applying operations on entire arrays (or ndarrays) without explicit loops, allowing for concise and efficient code.
What is the purpose of the loc[] method in Pandas?
The loc[] method is used for label-based indexing to filter specific rows and select specific columns in a DataFrame.
What are aggregation functions in NumPy?
Aggregation functions in NumPy, such as sum(), mean(), and std(), are used to perform common mathematical operations across the elements of arrays.
What is the primary use of Pandas?
Data manipulation and analysis.
What is loc[] in Pandas?
Label-based indexing for selecting rows/columns in a DataFrame.
What is a Pivot Table in Pandas?
A Pivot Table is a data summarization tool in Pandas created using pd.pivot_table() that allows you to summarize data by specifying values, index, and columns.
What is Vectorized addition in NumPy?
Vectorized addition is the operation that adds corresponding elements of two arrays without the need for a loop.
What does Boolean Indexing allow you to do?
Boolean indexing allows you to filter data based on conditions, selecting rows where a specific condition is met.
What is Element-wise addition in NumPy?
Element-wise addition is the operation that adds corresponding elements of two arrays, resulting in a new array.
What is Concatenation in Pandas?
Concatenation is the process of using pd.concat() to concatenate DataFrames along rows or columns.
What is Element-wise Comparison in NumPy?
Element-wise Comparison produces boolean arrays that indicate where comparisons between elements hold true.
What is a DataFrame in pandas?
A 2-dimensional labeled data structure, similar to a table in a database, a spreadsheet, or a dictionary of Series objects.
What is Boolean Masking in NumPy?
Boolean Masking allows you to filter out specific elements of an array using a boolean array that indicates which elements to keep.
How do you define the data types for fields in a structured array?
You define the data types for fields in a structured array by creating a list of tuples, where each tuple contains the field name and its corresponding data type.
What are Basic Arithmetic Operations in Pandas?
Pandas allows for vectorized operations between columns or between DataFrames, enabling arithmetic calculations directly on DataFrame columns.
What is iloc in Pandas?
iloc is a method used to access rows and columns by position in a DataFrame.
What is a DataFrame in Pandas?
A DataFrame is a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns) in Pandas.
What is the output of accessing the 'age' and 'weight' fields in a structured array?
The output of accessing the 'age' and 'weight' fields in a structured array is a list of tuples containing the values from those fields.
What does the iloc[] method do in Pandas?
iloc[] is used for integer-based indexing to select rows or columns in a DataFrame.
What is the logarithm base 10 function in NumPy?
The logarithm base 10 function computes the logarithm of each element in the array with base 10.
What does the loc[] method do in Pandas?
loc[] is used for label-based indexing to select rows or columns in a DataFrame.
What does the applymap() method do in Pandas?
The applymap() method applies a function element-wise to all the DataFrame elements.
What data structure does Pandas use?
Series and DataFrame.
How can you filter a DataFrame based on a condition in Pandas?
You can filter a DataFrame by using boolean indexing, where you specify a condition that returns a boolean Series, and use it to index the DataFrame.
What is Fancy Indexing in NumPy?
Fancy Indexing in NumPy is the process of indexing or slicing an array using another array of indices, allowing access to multiple elements simultaneously.
How do you create a 3D array in NumPy?
A 3D array can be created using np.array() with nested lists, for example, np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]).
What is the performance characteristic of NumPy for numerical operations?
High performance for numerical operations.
What is iloc[] in Pandas?
Position-based indexing for selecting rows/columns in a DataFrame.
What does Combining Datasets involve?
Combining Datasets involves merging, concatenating, and joining DataFrames to create a unified dataset.
What is iloc in Pandas?
iloc is a method in Pandas used to access rows and columns by integer-location based indexing.
What is np.cumsum()?
Cumulative sum of elements in an array.
What does the Standard Deviation represent in NumPy?
The Standard Deviation measures the amount of variation or dispersion of the array elements, calculated using np.std(arr).
What is np.cumprod()?
Cumulative product of elements in an array.
What is the purpose of the mean() function in Pandas?
The mean() function is used to compute the average value of a specified column in a DataFrame.
What is NumPy?
NumPy is essential for handling numerical data in Python, providing support for large, multi-dimensional arrays and matrices, along with a wide range of mathematical functions.
How can a DataFrame be created in pandas?
A DataFrame can be created using various methods, such as from a dictionary, a list of lists, NumPy arrays, or from an external file like a CSV or Excel.
What is the role of the apply() function in data transformation?
The apply() function is used to apply a specified function to each element in a DataFrame column for data transformation.
What is df_sum_with_nan in the context of DataFrame addition?
df_sum_with_nan is the result of adding two DataFrames (df1 and df2) while filling missing values (NaN) with 0.
What does transposing an array mean?
Transposing an array means flipping it over its diagonal, changing its rows into columns and vice versa.
What does df.iloc[3, 1] do?
It accesses the element at row 3, column 2 (index 1) in the DataFrame.
What is a 2D NumPy array?
A 2D NumPy array, also known as a matrix, is an array that contains rows and columns, allowing for the representation of data in two dimensions.
How do structured arrays behave compared to regular arrays and dictionaries?
Structured arrays behave like a hybrid of regular arrays and dictionaries, allowing access to individual fields by name.
What is filtered_arr in the context of NumPy?
filtered_arr is an array that contains elements from the original array 'arr' that are greater than 3.
How can a NumPy array be created?
A NumPy array can be created from Python lists or by using built-in functions like np.array(), np.zeros(), np.ones(), etc.
What does df['Name'] do?
It accesses a specific column named 'Name' in the DataFrame.
What type of data does NumPy handle?
Homogeneous data types.
What does the isin() method do in Pandas?
The isin() method allows filtering of DataFrame rows based on whether the values in a specified column are contained in a provided list of values.
What is Data Selection in pandas?
Data Selection in pandas involves selecting specific rows or columns using indexers like 'loc' or 'iloc'.
How do you create a 2D array in NumPy?
You create a 2D array in NumPy by passing a list of lists to the np.array function, such as np.array([[1, 2, 3], [4, 5, 6]]).
What is the purpose of the 'print' function in the provided example?
The 'print' function is used to output the DataFrame to the console for visualization.
What are NumPy Basics?
NumPy Basics refer to the foundational concepts of creating arrays and performing operations on them within the NumPy library.
What does df.loc[2, 'Name'] return?
df.loc[2, 'Name'] returns the element at row 2 in the 'Name' column of the DataFrame.
What is Efficient Memory Usage in ndarray?
The ndarray uses contiguous blocks of memory, which allows for fast operations and access.
What is Matplotlib?
Matplotlib is a versatile plotting library used for data visualization.
What does the np.mean() function calculate?
The np.mean() function calculates the mean (average) of the elements in an array.
What is Seaborn?
Seaborn is built on top of Matplotlib and provides a high-level interface for drawing attractive and informative statistical graphics.
What does np.zeros() do?
The np.zeros() function creates an array filled with zeros, with a specified shape.
How do you create a scatter plot using Seaborn?
You can create a scatter plot using Seaborn with the command sns.scatterplot(x='A', y='B', data=df) followed by plt.show().
What does np.percentile() compute?
The np.percentile() function computes the specified percentile of the elements in an array.
What does the condition (arr > 2) & (arr < 5) represent?
The condition represents a logical operation that finds elements in 'arr' that are greater than 2 and less than 5.
How do you select multiple columns in a DataFrame?
You can select multiple columns by using the syntax df[['column1', 'column2']].
What does the output of filtering a DataFrame show?
The output shows only the rows of the DataFrame that meet the specified condition, such as employees with a salary greater than a certain amount.
What type of indexing does Pandas use?
Label and integer-based indexing.
What does swapping axes 0 and 2 in a 3D array do?
Swapping axes 0 and 2 rearranges the dimensions of the 3D array, changing the order of the elements along those axes.
What is Data Indexing in pandas?
Data Indexing refers to setting and accessing custom indices in a DataFrame, allowing for more flexible data retrieval.
What is Boolean Indexing in Pandas?
Filtering rows based on conditions in a DataFrame.
How do you access multiple rows using iloc?
You can access multiple rows by providing a range of positions, for example, df.iloc[1:3] returns rows 1 and 2.
What is the purpose of Swapping Axes in NumPy?
Swapping any two axes of an array, for example, using np.swapaxes(array_3d, 0, 2).
What is the result of performing element-wise operations on an ndarray?
The result is a new array where each element is squared, for example, squared_array = array_1d ** 2 results in [1, 4, 9, 16, 25].
How do you slice an ndarray to extract a column?
You can slice the ndarray using sub_array = array_2d[:, 1] to extract the second column.
What does the .T attribute do in NumPy?
The .T attribute is used to obtain the transposed version of a NumPy array.
What is the purpose of the swapaxes() function?
The swapaxes() function is used to swap any two axes of an array, making it useful for multi-dimensional arrays.
What is the purpose of boolean masking in NumPy?
Boolean masking in NumPy allows for filtering data and applying logical conditions to arrays, enabling selection of elements that meet specific criteria.
What does the function np.sum do?
The function np.sum calculates the sum of all elements in an array or along a specified axis (rows or columns).
What does Array with Range refer to?
Array with Range refers to a NumPy array that contains a sequence of numbers, typically generated using functions like np.arange or np.linspace.
What does np.min do?
The function np.min is used to find the minimum value in a NumPy array.
What are Arithmetic Operations in DataFrames?
Element-wise arithmetic operations such as addition, subtraction, multiplication, and division between DataFrames.
What is Vectorization in NumPy?
Performing element-wise operations without explicit loops, such as a + b which adds two arrays element-wise.
What is the Exponential function in NumPy?
The Exponential function in NumPy calculates the value of e raised to the power of each element in an array, resulting in an output like [2.71828183, 7.3890561, 20.08553692].
What are Trigonometric Functions in NumPy?
Trigonometric Functions in NumPy include sine, cosine, and tangent, as well as their inverse functions, allowing for calculations based on the angles in radians.
What does the Cosine function compute in NumPy?
The Cosine function computes the cosine of each element in an array (in radians), resulting in an output like [0.54030231, -0.41614684, -0.9899925].
What does the 'Age_Category' column represent in the DataFrame?
'Age_Category' is a new column created to categorize individuals based on their age, using a function applied to the 'Age' column.
What is an Array of Ones?
An Array of Ones is a NumPy array filled with the value 1, often used for initializing data structures.
What does the 'pd.DataFrame' function do?
The 'pd.DataFrame' function is used to create a DataFrame object from various data structures such as dictionaries, lists, or arrays.
What does isin() do in Pandas?
Filters rows where column values match a specified list.
What does df.iloc[2] return?
df.iloc[2] returns the row at position 2 (the 3rd row) of the DataFrame.
What is the Log base 10 function in NumPy?
The Log base 10 function in NumPy calculates the logarithm of each element in an array to the base 10, resulting in an output like [0., 0.30103, 0.47712125].
How can you filter employees older than 30 and select specific columns?
You can use df.loc[df['Age'] > 30, ['Name', 'Department']] to filter employees older than 30 and select the 'Name' and 'Department' columns.
What is a DataFrame in Pandas?
A DataFrame is a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns) in the Pandas library.
What is Hierarchical Indexing?
Hierarchical Indexing is a method in Pandas that allows for multi-level indexing, enabling the organization of complex data structures.
How do you set values in a DataFrame using loc[]?
You can modify data in specific cells based on a condition, e.g., df.loc[df['Name'] == 'Bob', 'Salary'] = 90000.
How can you access specific elements of a DataFrame?
You can combine row and column access using loc, for example, df.loc[1, ['Name', 'City']] accesses elements in row 1 for the 'Name' and 'City' columns.
What are Vectorized Operations in NumPy?
NumPy arrays support element-wise operations, eliminating the need for loops and making code concise and faster.
What does the Square root function compute in NumPy?
The Square root function computes the square root of each element in an array, producing an output like [1., 1.41421356, 1.73205081].
What is Aggregation in data analysis?
Aggregation is the process of grouping data and creating pivot tables for summarization, allowing for easier analysis of large datasets.
What does Indexing refer to in NumPy?
Accessing elements of an array, for example, arr[0] accesses the first element.
What does Transposing an array mean?
Flipping an array over its diagonal, represented as matrix.T for the transpose of a matrix.
What does the Sine function compute in NumPy?
The Sine function computes the sine of each element in an array (in radians), producing an output like [0.84147098, 0.90929743, 0.14112001].
What are Basic Arithmetic Functions in NumPy?
Element-wise operations such as addition, subtraction, multiplication, and division.
What is Slicing and Indexing in NumPy?
Slicing provides powerful tools for slicing arrays and accessing subarrays.
What is Slicing in the context of NumPy?
Accessing a subarray, such as arr[:3] which retrieves the first 3 elements.
What does the Natural log function do in NumPy?
The Natural log function in NumPy computes the natural logarithm (base e) of each element in an array, producing an output like [0., 0.69314718, 1.09861229].
How do you create a 1D ndarray?
You can create a 1D ndarray using np.array([1, 2, 3, 4, 5]).
How do you create a 2D ndarray?
You can create a 2D ndarray (matrix) using np.array([[1, 2, 3], [4, 5, 6]]).
What does the Tangent function compute in NumPy?
The Tangent function computes the tangent of each element in an array (in radians), producing an output like [1.55740772, -2.18503986, -0.14254654].
What does the Power function do in NumPy?
The Power function raises each element in an array to a specified power, such as squaring each element, resulting in an output like [1, 4, 9].