1. Home
  2. Explore
  3. Statistics
  4. Exploratory Data Analysis

Study methods

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

Exploratory Data Analysis

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

Why import the os library when preparing to work with data in Spyder?

Tap to flipClick to flipspace

To change the working directory, for example with os.chdir().

Or swipe the card

58 cards

  1. Why import the os library when preparing to work with data in Spyder?

    To change the working directory, for example with os.chdir().

  2. Which Python library is used to work with data frames, and what alias is commonly used for it?

    Pandas, commonly imported with the alias pd.

  3. Which pandas function reads a CSV file into a data frame?

    pd.read_csv().

  4. What does setting index_col=0 when reading a CSV do?

    It uses the first column of the CSV as the data frame’s index.

  5. How can question marks in a CSV be treated as missing values while reading it?

    Pass the question mark as a missing-value marker using the na_values argument to pd.read_csv().

  6. Why convert question marks to the default missing-value representation?

    It allows Python and pandas’ missing-data functions to handle those values more easily.

  7. How can you make a separate copy of a pandas data frame before modifying it?

    Use the data frame’s .copy() method and assign the result to a new object.

  8. What attributes are described in the Toyota cars dataset?

    Car details including price, age, kilometres travelled, and fuel type.

  9. What is a frequency table used for when analyzing a categorical variable?

    It shows the count, or frequency, of each category in that variable.

  10. What pandas function can create a frequency table for one or more variables?

    pd.crosstab(); by default, it returns category counts.

  11. How do you use pd.crosstab() to count the categories of a single variable?

    Pass the variable as the index argument, such as pd.crosstab(index=cars_data['Fuel Type']).

  12. What does setting dropna=True in the lecture’s crosstab examples aim to do?

    Exclude missing-value cases from the frequency counts or table.

  13. How many Toyota dataset rows remained after excluding records with missing fuel type?

    There were 1,336 rows remaining from an original 1,436.

  14. How many records in the Toyota dataset had missing fuel type?

    One hundred records.

  15. Which fuel types appeared in the Toyota dataset, and what were their reported counts?

    CNG: 15; diesel: 144; petrol: 1,177.

  16. What conclusion follows from the Toyota dataset’s fuel-type frequency table?

    Petrol was the most common fuel type by a large margin.

  17. What is a two-way table used to examine?

    The frequency distribution or relationship between two categorical variables.

  18. In the Toyota dataset, what do the gearbox codes 0 and 1 represent?

    0 represents a manual gearbox; 1 represents an automatic gearbox.

  19. In the gearbox-by-fuel two-way table, what does each row represent and what does each column represent?

    Rows represent gearbox type (Automatic); columns represent fuel type.

  20. What does joint probability describe?

    The probability that two events occur together.

  21. How can a crosstab’s counts be converted to proportions representing joint probabilities?

    Set normalize=True in pd.crosstab().

  22. In a normalized two-way table, what does a cell’s joint probability represent?

    The proportion of all observations that belong to both the row category and the column category.

  23. What was the reported joint probability of a manual gearbox and CNG fuel in the Toyota example?

    Approximately 0.01.

  24. What was the reported joint probability of a manual gearbox and petrol fuel in the Toyota example?

    Approximately 0.82.

  25. What did the Toyota example’s two-way table show about automatic cars and CNG or diesel fuel?

    The table showed zero observations for automatic cars with CNG or diesel; the automatic cars in the data used petrol.

  26. What is marginal probability?

    The probability of a single event, considered without specifying the other variable’s category.

  27. How do you request marginal probabilities and totals in a normalized crosstab?

    Use normalize=True and margins=True.

  28. What do the margins added to a normalized two-way table show?

    Row sums and column sums, which give the marginal probabilities for the corresponding categories.

  29. What is the sum of all probabilities in a complete probability table?

  30. What is conditional probability?

    The probability of an event given that another event has occurred.

  31. How does normalize='index' produce conditional probabilities in a two-way table?

    It normalizes each row to sum to 1, giving the column-category probabilities conditional on each row category.

  32. In the Toyota example, given a manual gearbox, what were the approximate probabilities of CNG, diesel, and petrol?

    CNG: 0.01; diesel: 0.11; petrol: 0.87.

  33. What does the Toyota example indicate about fuel type given an automatic gearbox?

    The observed automatic cars were all petrol, so the conditional probability of petrol was 1 and of CNG or diesel was 0.

  34. How does normalize='columns' produce conditional probabilities in a two-way table?

    It normalizes each column to sum to 1, giving the row-category probabilities conditional on each column category.

  35. In the Toyota example, given that a car used CNG, what was the probability it had a manual gearbox?

    1; all observed CNG cars had manual gearboxes.

  36. In the Toyota example, given petrol fuel, what was the reported probability of a manual gearbox?

    Approximately 0.93.

  37. What does correlation measure in this lecture?

    The strength of association between two numerical variables.

  38. What does a positive trend in a scatter plot indicate?

    As one variable increases, the other tends to increase as well.

  39. What does a scatter plot with no visible pattern suggest?

    Little or no correlation between the variables.

  40. What are the possible bounds of a correlation coefficient?

    From −1-1−1 to 111, inclusive.

  41. How should a correlation coefficient near 111 be interpreted?

    It indicates a strong positive association.

  42. How should a correlation coefficient near −1-1−1 be interpreted?

    It indicates a strong negative association: as one variable increases, the other tends to decrease.

  43. What does a correlation coefficient of 0 represent in the lecture’s interpretation?

    No correlation between the two numerical variables.

  44. What example illustrates a negative relationship between car age and price?

    As a car’s age increases, its price tends to decrease.

  45. What correlation threshold does the lecture use to describe a fair relationship?

    A correlation above 0.7 is described as fair.

  46. Which pandas method calculates correlations among data-frame columns?

    The .corr() method.

  47. What does pairwise correlation mean when calculating a data frame’s correlation matrix?

    The correlation is calculated for each pair of columns.

  48. How does pandas handle missing values when calculating correlations, according to the lecture?

    It excludes missing values from the correlation calculations.

  49. Which correlation method does pandas use by default in .corr()?

    Pearson correlation.

  50. What kind of variables is Pearson correlation used to assess in this lecture?

    The strength of association between numerical variables.

  51. Which alternative correlation measures are mentioned for ordinal variables?

    Kendall rank correlation and Spearman rank correlation.

  52. How can categorical columns be excluded before calculating numerical correlations?

    Select numerical columns, for example by using select_dtypes() and excluding the object data type.

  53. How many observations and numerical variables were in the Toyota dataset after categorical variables were excluded?

    1,436 observations and 8 numerical variables.

  54. Why are the diagonal entries of a correlation matrix equal to 1?

    Each diagonal entry is the correlation of a variable with itself.

  55. What did the Toyota correlation matrix indicate about car price and age?

    They had a strong negative correlation of approximately −0.87-0.87−0.87; older cars tended to cost less.

  56. What did the Toyota correlation matrix indicate about price and kilometres travelled?

    They had a negative correlation of approximately −0.57-0.57−0.57; cars with more kilometres tended to have lower prices.

  57. What did the Toyota correlation matrix indicate about car weight and price?

    They had a positive correlation of approximately 0.580.580.58; heavier cars tended to have higher prices.

  58. What did the Toyota correlation matrix indicate about car age and kilometres travelled?

    They had a positive correlation of approximately 0.50.50.5; older cars tended to have travelled more kilometres.

Card 1 of 58
Card 1 of 58

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent