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

  • 73Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Data Preparation
In Spyder, the Python library used to change the working directory is
.

73 questions

  1. 1
    In Spyder, the Python library used to change the working directory is
    _____
    .
    Hint

    Think of the library whose directory-changing command is used to set where files are accessed.

    Answer

    os

    Explanation

    The os library is used to change the working directory before accessing data files.

  2. 2
    The library used to work with data frames in the lecture is
    _____
    .
    Hint

    It is commonly imported with the short alias pd.

    Answer

    pandas

    Explanation

    Pandas provides tools for reading and working with data frames.

  3. 3
    The alias used for the pandas library in the examples is
    _____
    .
    Hint

    It is the short name placed before pandas functions such as crosstab.

    Answer

    pd

    Explanation

    The lecture imports pandas as pd and then calls its functions using that alias.

  4. 4
    The os command used to change the current working directory is
    _____
    .
    Hint

    Its name refers to changing a directory.

    Answer

    os.chdir

    Explanation

    The command os.chdir changes the working directory to the supplied path.

  5. 5
    The pandas function used to read a comma-separated-values file is
    _____
    .
    Hint

    Its name combines the action of reading with the file format.

    Answer

    read_csv

    Explanation

    The lecture uses pandas read_csv to load CSV data into Spyder.

  6. 6
    In the Toyota data import, setting the index column to zero makes the
    _____
    column the index.
    Hint

    Zero-based indexing refers to the item at the beginning of a sequence.

    Answer

    first

    Explanation

    The example sets the index column to 0, so the first column is used as the data frame index.

  7. 7
    The special question-mark strings in the Toyota file are treated as
    _____
    values during import.
    Hint

    They are converted to Python's standard representation for unavailable data.

    Answer

    NaN

    Explanation

    The question marks do not convey meaningful data in this example, so they are read as NaN values.

  8. 8
    A copy of the original data frame is made with the
    _____
    function.
    Hint

    It creates a separate version of the data frame for further operations.

    Answer

    copy

    Explanation

    Using the copy function allows changes to be made to the copied data frame without modifying the original.

  9. 9
    The new data frame created from the original Toyota data is named
    _____
    in the example.
    Hint

    It is the object name that ends in the numeral two.

    Answer

    cars_data_2

    Explanation

    The lecture saves the copied data frame in an object called cars_data_2.

  10. 10
    The main reason for making a separate copy before modifying data is to preserve the
    _____
    data set for comparison.
    Hint

    It is the unmodified source version of the data.

    Answer

    original

    Explanation

    Keeping the original data unchanged makes it possible to cross-check it during analysis.

  11. 11
    A frequency table for one categorical variable shows the count for each of its
    _____
    .
    Hint

    These are the distinct groups or values represented by the variable.

    Answer

    categories

    Explanation

    A frequency table summarizes how often each category occurs in a categorical variable.

  12. 12
    The pandas function used in the lecture to create frequency tables is
    _____
    .
    Hint

    It can tabulate one or more variables.

    Answer

    crosstab

    Explanation

    The pandas crosstab function computes cross-tabulations and, by default, produces frequency counts.

  13. 13
    To obtain a frequency distribution for one variable with crosstab, that variable is passed as the
    _____
    .
    Hint

    This is the argument that identifies the row variable in the example.

    Answer

    index

    Explanation

    The lecture supplies Fuel Type under the index argument to count its categories.

  14. 14
    Setting the missing-value exclusion option to true removes records with
    _____
    values from the frequency-table calculation.
    Hint

    These values are unavailable or represented as NaN.

    Answer

    missing

    Explanation

    With missing values dropped, the frequency table is calculated only from records that remain.

  15. 15
    The Toyota data initially contained
    _____
    rows before missing Fuel Type records were excluded.
    Hint

    This is the original data size reported in the example.

    Answer

    1436

    Explanation

    The original data frame had 1436 rows before dropping records with missing Fuel Type.

  16. 16
    After rows with missing Fuel Type values were excluded, the example retained
    _____
    records.
    Hint

    Subtract the 100 records with missing Fuel Type from the original row count.

    Answer

    1336

    Explanation

    The resulting data included 1336 records after missing Fuel Type rows were dropped.

  17. 17
    The difference between the original 1436 rows and the 1336 retained rows is
    _____
    records with missing Fuel Type.
    Hint

    Compare the before-and-after row counts.

    Answer

    100

    Explanation

    Dropping missing Fuel Type values removed 100 records from the data.

  18. 18
    The Fuel Type categories listed in the Toyota frequency table are CNG, petrol, and
    _____
    .
    Hint

    It is the remaining fuel category besides CNG and petrol.

    Answer

    diesel

    Explanation

    The three reported Fuel Type categories are CNG, petrol, and diesel.

  19. 19
    In the example, the frequency of cars with CNG Fuel Type is
    _____
    .
    Hint

    It is the smallest of the three category counts reported.

    Answer

    15

    Explanation

    The frequency table shows 15 cars with CNG as their Fuel Type.

  20. 20
    In the example, the frequency of cars with diesel Fuel Type is
    _____
    .
    Hint

    This count is greater than the CNG count but less than the petrol count.

    Answer

    144

    Explanation

    The table reports 144 cars with diesel Fuel Type.

  21. 21
    The number of cars with petrol Fuel Type is
    _____
    in the example, making it the most common category.
    Hint

    It is the largest of the three category frequencies.

    Answer

    1177

    Explanation

    The frequency table shows 1177 petrol cars, so petrol is the most common Fuel Type in this data.

  22. 22
    A two-way table is used to examine the relationship between
    _____
    categorical variables.
    Hint

    It cross-tabulates one variable against another.

    Answer

    two

    Explanation

    The lecture uses a two-way table to compare the frequencies of two categorical variables.

  23. 23
    In the example two-way table, the gearbox variable is named
    _____
    .
    Hint

    It records whether the car has a manual or automatic gearbox using coded values.

    Answer

    Automatic

    Explanation

    The variable called Automatic represents the gearbox type in the Toyota data.

  24. 24
    In the Automatic variable, the value 0 represents a
    _____
    gearbox.
    Hint

    It is the non-automatic gearbox category.

    Answer

    Manual

    Explanation

    The example defines 0 as a car with a Manual gearbox.

  25. 25
    In the Automatic variable, the value 1 represents an
    _____
    gearbox.
    Hint

    The coded value matches the variable's name.

    Answer

    Automatic

    Explanation

    The example defines 1 as a car with an Automatic gearbox.

  26. 26
    To tabulate gearbox counts by fuel type, the example places Automatic in the index and Fuel Type in the
    _____
    .
    Hint

    This argument determines which variable appears across the top of the table.

    Answer

    columns

    Explanation

    The two-way table uses Automatic for its rows and Fuel Type for its columns.

  27. 27
    When missing values are dropped in the two-way table, a row is included only if both Automatic and Fuel Type are
    _____
    .
    Hint

    Neither variable may be unavailable for that record.

    Answer

    observed

    Explanation

    The table counts rows only when both variables have values; rows missing either one are skipped.

  28. 28
    In the two-way table, the 15 cars with CNG Fuel Type and a Manual gearbox appear at the intersection of the CNG column and the
    _____
    row.
    Hint

    The row corresponds to the gearbox category represented by zero.

    Answer

    Manual

    Explanation

    The count of 15 describes cars that have both CNG Fuel Type and a Manual gearbox.

  29. 29
    The example's two-way table shows that cars with Automatic gearboxes have only
    _____
    Fuel Type.
    Hint

    The table has zero Automatic cars for the other two listed fuel categories.

    Answer

    petrol

    Explanation

    The table reports no Automatic cars with CNG or diesel Fuel Type; the Automatic cars shown have petrol Fuel Type.

  30. 30
    The two-way table reports
    _____
    cars with a Manual gearbox and diesel Fuel Type.
    Hint

    This is the diesel count in the Manual gearbox row.

    Answer

    144

    Explanation

    The example identifies 144 cars as having both a Manual gearbox and diesel Fuel Type.

  31. 31
    Joint probability describes the probability that two events occur at the
    _____
    time.
    Hint

    The events are considered together rather than separately.

    Answer

    same

    Explanation

    A joint probability gives the likelihood of two events happening together.

  32. 32
    In a crosstab, setting normalize to true converts frequency counts into
    _____
    .
    Hint

    These are relative values that can be interpreted as probabilities.

    Answer

    proportions

    Explanation

    Normalization changes the table values from raw counts to proportions.

  33. 33
    In the example, the joint probability of a Manual gearbox and CNG Fuel Type is approximately
    _____
    .
    Hint

    This is the small proportion reported for that combination.

    Answer

    0.01

    Explanation

    The normalized table gives a joint probability of about 0.01 for Manual gearbox and CNG Fuel Type.

  34. 34
    In the example, the joint probability of a Manual gearbox and petrol Fuel Type is approximately
    _____
    .
    Hint

    This is the comparatively large proportion reported for the combination.

    Answer

    0.82

    Explanation

    The joint probability for a Manual gearbox together with petrol Fuel Type is about 0.82 in the example.

  35. 35
    Marginal probability concerns the occurrence of a
    _____
    event considered alone.
    Hint

    It does not describe the combined occurrence of two events.

    Answer

    single

    Explanation

    A marginal probability gives the probability of one event without conditioning on another event.

  36. 36
    In crosstab, the option used to add row and column totals for marginal probabilities is
    _____
    .
    Hint

    Turning this option on adds an All total row and column.

    Answer

    margins

    Explanation

    Setting margins to true adds row and column sums, which can be used to read marginal probabilities.

  37. 37
    When a normalized table includes margins, the row and column totals are displayed under the label
    _____
    .
    Hint

    This label identifies the totals added by the margins option.

    Answer

    All

    Explanation

    The table displays the added row and column totals in an All row and column.

  38. 38
    The total probability across all cells of a complete probability table sums to
    _____
    .
    Hint

    This represents the certainty that one of the outcomes in the table occurs.

    Answer

    1

    Explanation

    The probabilities across all outcomes in the table sum to 1.

  39. 39
    The marginal probability of a Manual gearbox reported in the example is approximately
    _____
    .
    Hint

    It is the first marginal value discussed in the lecture.

    Answer

    0.946895

    Explanation

    The lecture interprets 0.946895 as the probability of a Manual gearbox across the fuel categories.

  40. 40
    The marginal probability of petrol Fuel Type reported in the example is approximately
    _____
    .
    Hint

    It is the probability of petrol regardless of gearbox type.

    Answer

    0.88

    Explanation

    The petrol marginal probability combines cars with Automatic and Manual gearboxes and is about 0.88.

  41. 41
    Conditional probability is the probability of event A given that event B has already
    _____
    .
    Hint

    The second event is treated as having happened already.

    Answer

    occurred

    Explanation

    Conditional probability describes the chance of one event under the condition that another event has occurred.

  42. 42
    Normalizing a crosstab by index makes each
    _____
    sum to 1.
    Hint

    In the example, this conditions on the gearbox type represented by each row.

    Answer

    row

    Explanation

    Index normalization produces conditional probabilities across each row, so each row totals 1.

  43. 43
    With index normalization, the table answers questions about fuel type given the type of
    _____
    .
    Hint

    This is the variable placed in the rows of the example table.

    Answer

    gearbox

    Explanation

    Each row represents a gearbox type, so the normalized entries give fuel-type probabilities conditional on gearbox type.

  44. 44
    Given a Manual gearbox, the example's probability of CNG Fuel Type is approximately
    _____
    .
    Hint

    Use the row-normalized table and look at the CNG entry in the Manual row.

    Answer

    0.01

    Explanation

    The conditional probability of CNG given a Manual gearbox is reported as 0.01.

  45. 45
    Given a Manual gearbox, the example's probability of petrol Fuel Type is approximately
    _____
    .
    Hint

    It is the largest fuel-type probability in the Manual row.

    Answer

    0.87

    Explanation

    The row-normalized table gives a petrol probability of about 0.87 for cars with a Manual gearbox.

  46. 46
    Normalizing by columns makes each
    _____
    sum to 1.
    Hint

    This reverses the conditioning direction compared with index normalization.

    Answer

    column

    Explanation

    Column normalization creates conditional probabilities within each column, making every column total 1.

  47. 47
    With column normalization, the table answers questions about gearbox type given the car's
    _____
    .
    Hint

    This is the variable represented by the columns in the example.

    Answer

    Fuel Type

    Explanation

    Each column fixes a Fuel Type, so the normalized entries give probabilities for gearbox types conditional on that Fuel Type.

  48. 48
    In the example, given CNG Fuel Type, the probability of a Manual gearbox is
    _____
    .
    Hint

    There are no Automatic cars in the CNG column of the table.

    Answer

    1

    Explanation

    All observed CNG cars in this example have Manual gearboxes, giving a conditional probability of 1.

  49. 49
    Given petrol Fuel Type, the example's probability of a Manual gearbox is approximately
    _____
    .
    Hint

    Read the Manual entry in the petrol column-normalized values.

    Answer

    0.93

    Explanation

    The column-normalized table reports a probability of about 0.93 for a Manual gearbox given petrol Fuel Type.

  50. 50
    Correlation measures the strength of association between two
    _____
    variables in the lecture's examples.
    Hint

    The measure is contrasted with cross-tabulation of categorical variables.

    Answer

    numerical

    Explanation

    The lecture uses correlation to study the association between numerical variables.

  51. 51
    A scatter plot with points tending to rise as one variable increases indicates a
    _____
    trend.
    Hint

    Both variables tend to increase together.

    Answer

    positive

    Explanation

    A positive trend means that larger values of one variable tend to accompany larger values of the other.

  52. 52
    If a car's weight increases and its price tends to increase as well, the relationship has a
    _____
    trend.
    Hint

    The two quantities move in the same direction.

    Answer

    positive

    Explanation

    When both variables tend to increase together, their relationship is positive.

  53. 53
    A scatter plot with points spread without a discernible pattern suggests
    _____
    correlation.
    Hint

    The plot does not show a consistent relationship between the variables.

    Answer

    no

    Explanation

    When the points are scattered without a pattern, the lecture describes the variables as having no correlation.

  54. 54
    Correlation values are bounded between
    _____
    and plus 1.
    Hint

    The lower endpoint represents the strongest negative direction on the scale.

    Answer

    minus 1

    Explanation

    The correlation coefficient ranges from minus 1 to plus 1.

  55. 55
    A correlation of 0 represents
    _____
    correlation between two numerical variables.
    Hint

    It indicates an absence of linear association as described in the lecture.

    Answer

    no

    Explanation

    The lecture states that a value of 0 represents no correlation between the variables.

  56. 56
    A correlation value closer to positive 1 indicates a stronger
    _____
    association.
    Hint

    The sign identifies the direction of the relationship.

    Answer

    positive

    Explanation

    Values closer to positive 1 indicate stronger positive correlation.

  57. 57
    A correlation value closer to minus 1 indicates a stronger
    _____
    association.
    Hint

    The sign indicates that the variables tend to move in opposite directions.

    Answer

    negative

    Explanation

    Values closer to minus 1 indicate stronger negative correlation.

  58. 58
    The lecture describes a correlation above 0.7 as a
    _____
    correlation between numerical variables.
    Hint

    This is the strength description used for values beyond the stated threshold.

    Answer

    fair

    Explanation

    The lecture says that, theoretically, a value above 0.7 indicates a fair correlation.

  59. 59
    If car age increases while price tends to decrease, the relationship is a
    _____
    correlation.
    Hint

    The variables move in opposite directions.

    Answer

    negative

    Explanation

    Older cars tending to have lower prices is an example of a negative relationship.

  60. 60
    The pandas data-frame method used to calculate correlations is
    _____
    .
    Hint

    It is called on a data frame to calculate correlations among its columns.

    Answer

    corr

    Explanation

    The lecture uses the corr method to calculate correlation values for data-frame columns.

  61. 61
    The corr method calculates
    _____
    correlations among columns when applied to a data frame.
    Hint

    It evaluates relationships between pairs of columns.

    Answer

    pairwise

    Explanation

    The method computes pairwise correlations among the selected data-frame columns.

  62. 62
    By default, the correlation calculation excludes
    _____
    values.
    Hint

    These unavailable observations should not be used in the calculation.

    Answer

    missing

    Explanation

    The correlation method excludes missing values when calculating correlations.

  63. 63
    The default correlation method discussed in the lecture is
    _____
    correlation.
    Hint

    It is the standard measure described for numerical variables.

    Answer

    Pearson

    Explanation

    The lecture states that the default method is Pearson correlation.

  64. 64
    Pearson correlation is used to measure the strength of association between two
    _____
    variables.
    Hint

    It is the measure selected after categorical variables are excluded.

    Answer

    numerical

    Explanation

    Pearson correlation is used here to assess the association between numerical variables.

  65. 65
    For ordinal variables, the lecture names Kendall rank correlation and
    _____
    rank correlation as alternatives.
    Hint

    It is the other rank-based measure mentioned alongside Kendall.

    Answer

    Spearman

    Explanation

    The lecture suggests Kendall rank correlation or Spearman rank correlation for ordinal variables.

  66. 66
    To calculate Pearson correlations for numerical columns only, the example excludes columns of data type
    _____
    .
    Hint

    This data type is used for categorical columns in the example.

    Answer

    object

    Explanation

    Excluding object columns removes categorical variables before calculating Pearson correlations.

  67. 67
    After excluding categorical columns, the example's numerical data frame contains
    _____
    variables.
    Hint

    The original data had ten variables, and two were excluded.

    Answer

    eight

    Explanation

    The numerical data frame has eight variables after categorical columns are removed.

  68. 68
    The numerical data frame in the example contains
    _____
    observations.
    Hint

    This is the row count reported for the selected numerical data.

    Answer

    1436

    Explanation

    The selected numerical data frame is reported as having 1436 observations.

  69. 69
    The correlation between a variable and itself appears as
    _____
    on the principal diagonal of the correlation matrix.
    Hint

    A variable is perfectly correlated with itself.

    Answer

    one

    Explanation

    Each diagonal entry compares a variable with itself, so its correlation is 1.

  70. 70
    The example reports a correlation of about minus 0.87 between car price and car
    _____
    .
    Hint

    As this quantity increases, the example says price tends to decrease.

    Answer

    age

    Explanation

    The price-age correlation is approximately minus 0.87, indicating a strong negative association in the data.

  71. 71
    The correlation between car price and kilometre is about minus
    _____
    .
    Hint

    Its magnitude is slightly above 0.5, and its direction is negative.

    Answer

    0.57

    Explanation

    The example gives a price-kilometre correlation of approximately minus 0.57, consistent with higher mileage tending to accompany lower prices.

  72. 72
    The example reports a positive correlation of about
    _____
    between car weight and price.
    Hint

    Heavier cars tend to have higher prices in the example.

    Answer

    0.58

    Explanation

    A correlation of about 0.58 indicates that weight and price tend to increase together in the data.

  73. 73
    The example describes the relationship between car kilometre and age as positive, with a correlation around
    _____
    .
    Hint

    Older cars tend to have accumulated more kilometres.

    Answer

    0.5

    Explanation

    The lecture reports an approximate positive correlation of 0.5 between kilometre and age.

1 of 73
Question 1 of 73

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent