Made with ScholarlyMake flashcards like these from your own notes
Question:What is the primary use of pandas.concat (pd.concat) in DataFrames?
Answer:To combine DataFrames along an axis (rows or columns)
Question:When concatenating, what does ignore_index=True do?
Answer:Resets the index in the concatenated result
Question:What is the purpose of adding multiindex keys in a concat?
Answer:Create a hierarchical index to differentiate concatenated DataFrames
Question:What are the three basic join categories in merging DataFrames based on keys?
Answer:One-to-one, many-to-one, many-to-many
Question:What keyword specifies common columns to merge on in a merge operation?
Answer:on
Question:When would you use left_on and right_on in a merge?
Answer:When column names differ between DataFrames
Question:What do left_index and right_index enable in a merge?
Answer:Merging using index values instead of columns
Question:What is the purpose of suffixes in merge operations?
Answer:Prevents column name conflicts on overlapping columns
Question:Name a basic aggregation function commonly used in GroupBy operations.
Answer:sum or mean or min or max
Question:What is the fundamental idea behind GroupBy: Split, Apply, Combine?
Answer:Group by a filter, apply aggregation, and combine results into a new table
Question:What does the GroupBy object support for selections besides aggregations?
Answer:Column indexing and iteration over groups
Question:What are the four primary methods associated with GroupBy for data manipulation?
Answer:aggregate, filter, transform, apply
Question:What does the aggregate method allow that the basic aggregates do not?
Answer:Multiple aggregations with flexible steps
Question:What is the purpose of the filter method in GroupBy?
Answer:Remove groups based on conditions on group properties
Question:What does the transform method achieve in GroupBy operations?
Answer:Modify data while preserving original shape
Question:What is a common use case for apply in GroupBy context?
Answer:Apply custom functions to groups (e.g., normalize within groups)
Question:What is a Pivot Table in pandas used for?
Answer:Summarize data with aggregated values across dimensions
Question:What is the basic Pivot Table syntax used for in pandas?
Answer:Basic syntax to pivot data by rows, columns, and values
Question:What are multilevel pivot tables used for?
Answer:Pivot with hierarchical row/column indices for complex summaries
Question:What is the purpose of the full pivot table call in pandas?
Answer:Comprehensive creation of a pivot table with all options
Question:Which pandas feature helps work with time-series data efficiently?
Answer:Time series data handling (pd.Timestamp, DatetimeIndex, Period, Timedelta)
Question:What Python module pairings underlie pandas time handling?
Answer:datetime, dateutil, numpy.datetime64
Question:What is a pd.Timestamp?
Answer:A single timestamp backed by numpy.datetime64
Question:What is a pd.DatetimeIndex?
Answer:Index of timestamps for time-series data
Question:What is a pd.Period?
Answer:A time period with a fixed frequency (e.g., month, year)
Question:What is a PeriodIndex used for?
Answer:Index for Period objects in time-series data
Question:What is a Pd.Timedelta designed to replace?
Answer:Python's datetime.timedelta with numpy.timedelta64 basis
Question:What is the purpose of pd.date_range?
Answer:Create a date range sequence
Question:What is the difference between date_range and period_range in pandas?
Answer:date_range yields daily timestamps; period_range yields periods (e.g., months)
Question:What does the freq parameter in time series functions control?
Answer:The time interval frequency (e.g., 'D','M','H')
Question:What is the typical use of a stock price time-series example in pandas?
Answer:Demonstrate date-time indexing and time-based calculations
Question:Why might you reset the index after a concatenation?
Answer:Original indices may be non-meaningful or duplicate
Question:What happens if you concatenate without ignore_index and there are overlapping indices?
Answer:The original indexing is preserved, which may cause duplicates
Question:When merging with overlapping column names, why use suffixes?
Answer:To avoid ambiguous/conflicting column names
Question:Which join type is equivalent to SQL INNER JOIN in pandas merge?
Answer:One-to-one merge or inner join
Question:What is a common scenario for many-to-one joins?
Answer:Lookup tables with duplicates on the key
Question:What scenario fits many-to-many joins?
Answer:Product-customer relationships with duplicates on both sides
Question:What does inner join in pandas ensure when merging?
Answer:Only matching keys are kept from both frames
Question:What is the result of an outer join in pandas?
Answer:All keys from both frames, with NaNs where missing
Question:What is meant by index alignment in concatenation?
Answer:Matching order of indices or keys across frames
Question:What is the purpose of the on keyword in merges?
Answer:Define the common merge keys explicitly
Question:How can you merge using different column names in each DataFrame?
Answer:Use left_on and right_on
Question:What is the significance of merging on indices rather than columns?
Answer:Aligns data by index labels instead of column values
Question:What is a practical reason to reset the index after concatenation?
Answer:To produce a clean, sequential index for the result
Question:Which operation is deprecated and recommended to replace for appending rows?
Answer:The Append method; use pd.concat with ignore_index
Question:What is the main advantage of a hierarchical index in concatenation?
Answer:Differentiates data sources within the combined DataFrame
Question:How do you ensure data is merged only on relevant data based on index?
Answer:Use inner or outer join types in pd.concat
Question:What does 'GroupBy' accomplish in pandas?
Answer:Split data, apply aggregations, and combine results
Question:What is the role of iteration over groups in GroupBy?
Answer:Access each group as a series for processing
Question:What is the recommended approach for handling time-series indexing in pandas?
Answer:Use Timestamp, DatetimeIndex, Period, Timedelta structures
Question:What does center the data by subtracting the group-wise mean illustrate in transform?
Answer:Centering within groups while preserving shape
Question:What is a key feature of groupby’s apply method?
Answer:Apply custom function to each group
Question:How does a simple aggregation function like sum differ from using aggregate with multiple steps?
Answer:Sum is a single agg; aggregate allows multiple ops
Question:What is a practical example of using pivot tables in data analysis?
Answer:Summarize data by categories with aggregated values
Question:Which pandas tool is useful for handling datasets with different shapes during concat?
Answer:ignore_index or keys for hierarchical concat
Question:What is a practical example of using keys in concat?
Answer:Distinguish sources in a multi-DataFrame merge
Question:Which data structure is used to index time series by timestamps?
Answer:pd.DatetimeIndex
Question:What type of information does a PeriodIndex store?
Answer:Fixed-frequency intervals (months, years)
Question:What does pd.date_range generate?
Answer:A sequence of timestamps with a defined frequency
Question:What does pd.period_range generate?
Answer:A sequence of periods with a fixed frequency
Question:Which two libraries underpin pandas time handling with numpy backing?
Answer:datetime and numpy (numpy.datetime64)
Question:What is a key benefit of using pandas for time series over plain Python lists?
Answer:Vectorized operations and efficient storage
Question:What does combining best features of datetime and numpy offer in pandas?
Answer:A Timestamp object with efficient storage and interface
Question:Why would you need to specify left_index and right_index in a merge?
Answer:When the merge keys are indices rather than columns
Question:What is the primary use of pd.concat on DataFrames?
Answer:Combine DataFrames along an axis (rows or columns) with optional keys/ignore_index
Question:Why use ignore_index in concatenation?
Answer:Reset the index to a consecutive range in the result
Question:What join types does pd.concat support for index alignment?
Answer:Inner and outer joins (default)
Question:What is a common pitfall when concatenating large datasets across files?
Answer:Index misalignment can lead to duplicates or data loss