1. Home
  2. Explore
  3. Computer Science
  4. Python Data Analysis

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Python Data Analysis

  • 94Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Python Setup
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is a Kaggle notebook?

Tap to flipClick to flipspace

An environment similar to a Jupyter notebook where code can be run alongside plain-text descriptions.

Or swipe the card

94 cards

  1. What is a Kaggle notebook?

    An environment similar to a Jupyter notebook where code can be run alongside plain-text descriptions.

  2. What alias is commonly used when importing pandas?

    pd

  3. What alias is commonly used when importing NumPy?

    np

  4. Which library is imported as plt for plotting?

    matplotlib.pyplot

  5. Why is Seaborn useful in exploratory data analysis?

    It provides helpful functions for creating exploratory plots and more advanced visualizations.

  6. How can the default Matplotlib and Seaborn plotting style be changed to the ggplot style?

    Use plt.style.use('ggplot').

  7. How can pandas be configured to display up to 200 columns?

    Use pd.set_option('display.max_columns', 200).

  8. How can a CSV file be loaded into a pandas DataFrame?

    Use pd.read_csv() and assign the result to a variable such as df.

  9. What does df.shape return?

    The number of rows and columns in a DataFrame.

  10. What does df.head() display?

    The first five rows of a DataFrame by default.

  11. How can the number of rows displayed by head() be changed?

    Pass the desired number as an argument, such as df.head(20).

  12. Why might df.head() show dots between columns?

    Pandas hides some columns by default when the DataFrame is too wide.

  13. How can all column names in a DataFrame be listed?

    Use df.columns.

  14. In pandas, what is a DataFrame column?

    A pandas Series.

  15. What does df.dtypes show?

    The data type assigned to each DataFrame column.

  16. What does an object data type commonly represent in a pandas column?

    String or text values.

  17. What does df.describe() provide?

    Summary statistics for numeric columns.

  18. What did the count of 171 for roller-coaster height indicate?

    There were 171 non-missing height values.

  19. What was the mean roller-coaster height in the example?

    101 feet.

  20. Why should unwanted columns or rows be removed before extensive cleaning?

    To avoid wasting time cleaning data that will not be used in the analysis.

  21. Why might a dataset contain both text and numeric versions of a feature?

    One column may include units or descriptive text, while another contains standardized numeric values.

  22. How can selected DataFrame columns be retained using a list?

    Place the list of desired column names inside double brackets, such as df[columns].

  23. How can a column be removed with pandas drop()?

    Use df.drop(columns='column_name', axis=1) or provide a list of columns.

  24. What does axis=1 mean when using drop()?

    Operate on columns.

  25. How can a selected subset of columns replace the original DataFrame?

    Assign it back to the DataFrame variable, such as df = df[columns].copy().

  26. Why is .copy() useful after subsetting a DataFrame?

    It creates a new DataFrame rather than a reference to the original data.

  27. What columns were retained in the cleaned roller-coaster subset?

    Fields such as coaster name, location, manufacturer, year introduced, latitude, longitude, material type, opening date, speed, height, inversions, g-force, and status.

  28. How did the dataset change after selecting the desired columns?

    It was reduced to 13 columns while retaining 1,087 rows.

  29. How can a column be converted to a datetime type?

    Use pd.to_datetime() on the column.

  30. Why should an opening-date column be converted from object to datetime?

    Because dates should be represented with a datetime type for correct interpretation and later analysis.

  31. How can a column be converted to a numeric type?

    Use pd.to_numeric() on the column.

  32. How are DataFrame columns renamed with rename()?

    Pass a dictionary mapping old names to new names through the columns argument.

  33. What naming improvements were made to the example columns?

    Column names were made more consistent, with uppercase first letters and removal of unnecessary _clean suffixes.

  34. What does df.isna() return?

    A Boolean DataFrame indicating whether each value is missing or null.

  35. How can the number of missing values in each column be calculated?

    Use df.isna().sum().

  36. Which example columns contained missing values?

    Status, latitude, longitude, and some g-force values.

  37. What does df.duplicated() identify?

    Rows that duplicate an earlier row or earlier matching row.

  38. Why does duplicated() normally ignore the first occurrence?

    It marks only the second and subsequent matching rows so they can be identified as redundant copies.

  39. How can the duplicated rows themselves be displayed?

    Use .loc with the Boolean result of duplicated(), such as df.loc[df.duplicated()].

  40. How can duplication be checked using only selected columns?

    Pass the relevant column names to the subset argument of duplicated().

  41. How many repeated coaster names were found in the example?

    97 duplicated rows.

  42. Why might the same coaster name appear in multiple rows?

    A coaster may have multiple records because it was introduced in different years or was taken offline and later reopened.

  43. How can a specific coaster be investigated with query()?

    Filter the DataFrame using a condition such as df.query("Coaster Name == 'Crystal Beach Cyclone'").

  44. Which columns were used to define duplicate roller-coaster records for removal?

    Coaster name, location, and opening date.

  45. How can the inverse of a Boolean duplicate mask be selected?

    Place the tilde operator, ~, before the Boolean mask.

  46. How can duplicate rows be removed while retaining the first matching record?

    Filter with the inverse of df.duplicated(subset=...) and assign the result back to the DataFrame.

  47. Why is reset_index() useful after dropping rows?

    It creates a consecutive index for the remaining rows.

  48. How can the old index be prevented from becoming a new column during reset?

    Use reset_index(drop=True).

  49. What was the final cleaned dataset size?

    990 unique roller coasters and 13 feature columns.

  50. What is univariate analysis?

    Analysis of one feature or column at a time.

  51. What does value_counts() calculate?

    The number of occurrences of each unique value in a Series.

  52. How does value_counts() order its results by default?

    From the most frequent value to the least frequent value.

  53. What did value_counts() show for the year introduced?

    1999 was the most common year, with 46 roller coasters introduced.

  54. How can the ten most common values be selected from value_counts()?

    Use .head(10) after calling value_counts().

  55. How can value counts be visualized as a bar plot?

    Call .plot(kind='bar') on the value-counts Series.

  56. How can a plot title and axis labels be added?

    Use a title-setting method and axis-label methods such as set_xlabel() and set_ylabel().

  57. What does a histogram show?

    The counts of continuous values within defined bins.

  58. Why can changing the number of histogram bins be useful?

    It can make the shape of a distribution clearer or easier to interpret.

  59. What did the roller-coaster speed histogram suggest?

    Speeds around 40–50 miles per hour were common, with some unusually high speeds that could be investigated as potential outliers.

  60. What is a kernel density estimate plot?

    A smoothed, normalized representation of a variable's distribution.

  61. How is a KDE plot created with pandas plotting?

    Use a density or KDE plot option, such as kind='kde'.

  62. What peaks appeared in the roller-coaster speed KDE plot?

    Approximate peaks occurred around 35 and 50 miles per hour.

  63. What does a scatter plot show?

    The relationship between two numeric features using one point per observation.

  64. How can a pandas scatter plot be created for speed and height?

    Use df.plot(kind='scatter', x='Speed', y='Height').

  65. Why might plt.show() be added after a pandas plot?

    To display the plot cleanly without printing the underlying Matplotlib object representation.

  66. How does Seaborn create a scatter plot?

    Use sns.scatterplot() with x, y, and data arguments.

  67. How can the arguments of a plotting function be inspected in a notebook?

    Use the notebook's documentation shortcut, such as Shift-Tab, inside the function call.

  68. What does the hue argument do in a Seaborn scatter plot?

    It colors points according to another variable.

  69. What is a Seaborn pair plot?

    A matrix of plots showing relationships between multiple features and distributions along the diagonal.

  70. What type of plot appears between feature pairs in a pair plot by default?

    A scatter plot.

  71. What appears along the diagonal of a pair plot?

    The distribution of each individual feature.

  72. How can a pair plot encode a third variable?

    Pass the variable to the hue argument.

  73. What pattern did material type and year introduced reveal?

    Steel coasters were uncommon in the earliest years and began appearing around the 1950s before becoming more popular.

  74. What does a correlation measure?

    The strength and direction of the relationship between numeric features.

  75. What correlation was observed between roller-coaster speed and height?

    Approximately 0.730.730.73.

  76. What does a negative correlation indicate?

    As one feature increases, the other tends to decrease.

  77. Why might year introduced have weak correlations with other features?

    It may not have a strong linear relationship with those features in the dataset.

  78. Why should null values be removed before calculating correlations?

    Correlation calculations should use paired numeric observations with available values.

  79. How is a correlation matrix calculated in pandas?

    Use the corr() method on a numeric DataFrame.

  80. What does a Seaborn heat map of correlations show?

    The strength and direction of correlations between features using color.

  81. Why are the diagonal values of a correlation matrix equal to 111?

    Each feature is perfectly correlated with itself.

  82. What does adding annotations to a correlation heat map provide?

    The numeric correlation values are displayed directly in the cells.

  83. What question was asked in the final analysis?

    Which locations have the fastest roller coasters, considering only locations with at least 10 coasters?

  84. Why was the location value other excluded from the final analysis?

    It was not a specific real location.

  85. How can rows with a location other than other be selected?

    Use a query condition such as Location != 'Other'.

  86. Why is grouping by location useful for this question?

    It allows speed statistics to be calculated separately for each location.

  87. What does the agg() method do in grouped analysis?

    It calculates one or more summary statistics for each group.

  88. Which statistics were calculated for speed at each location?

    The mean speed and the count of roller coasters.

  89. How was the minimum-location-size condition applied?

    Locations were filtered to those with a coaster count greater than or equal to 10.

  90. Why were the grouped results sorted by mean speed?

    To rank locations from lower to higher average coaster speed and identify the fastest locations.

  91. What type of plot was used to display average coaster speed by location?

    A horizontal bar plot.

  92. Which location had the highest average coaster speed in the final result?

    Busch Gardens.

  93. Which location followed Busch Gardens in average coaster speed?

    Cedar Point.

  94. What general lesson does asking a concrete data question provide?

    It guides the analyst toward the pandas operations needed to filter, group, aggregate, sort, and visualize the data.

Card 1 of 94
Card 1 of 94

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent