1. Home
  2. Explore
  3. Computer Science
  4. Data Science Basics with Python

Study methods

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

Data Science Basics with Python

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

What is Anaconda?

Tap to flipClick to flipspace

A tool that simplifies setting up a data science environment by managing packages and dependencies.

Or swipe the card

60 cards

  1. What is Anaconda?

    A tool that simplifies setting up a data science environment by managing packages and dependencies.

  2. What is a Jupyter notebook?

    An interactive, web-based document that combines code, text (markdown), and visualizations in cells.

  3. How do you create a new Jupyter notebook in VS Code?

    Create a new file with .ipynb extension or use the command palette to create a new Jupyter notebook.

  4. What is the purpose of markdown cells in a Jupyter notebook?

    To add formatted text, headings, images, and documentation to explain the code and results.

  5. How do you execute a code cell in a Jupyter notebook?

    Press Shift+Enter or click the run button (triangle) next to the cell.

  6. How do you create a Python list?

    Using square brackets: [item1, item2, ...].

  7. How do you print a variable in Python?

    Use the print() function: print(variable).

  8. What is the difference between multiplying a list by 2 and multiplying a numpy array by 2?

    Multiplying a list duplicates its elements; multiplying a numpy array multiplies each element by 2.

  9. How do you import numpy?

    import numpy as np

  10. How do you create a numpy array?

    np.array([list])

  11. How do you get the shape of a numpy array?

    array.shape returns a tuple of dimensions (e.g., (22,) for a 1D array with 22 elements).

  12. What is the index of the first element in a numpy array?

    0

  13. How do you access a specific element in a 1D numpy array?

    array[index]

  14. How do you create a 2D numpy array from two lists?

    np.array([list1, list2])

  15. How do you access an element in a 2D numpy array?

    array[row_index, col_index] (e.g., array[0,1] for first row, second column).

  16. How do you import pandas?

    import pandas as pd

  17. What is a DataFrame?

    A two-dimensional, tabular data structure with labeled rows and columns, similar to a spreadsheet.

  18. How do you create a DataFrame from a dictionary?

    pd.DataFrame({'column1': data1, 'column2': data2})

  19. How do you access a row in a DataFrame using its index label?

    df.loc[row_label] (e.g., df.loc[0] for the first row).

  20. How do you access a column in a DataFrame?

    df['column_name'] or df.column_name (if the name is a valid Python identifier).

  21. How do you access a specific value in a DataFrame?

    df.loc[row_index, 'column_name']

  22. How do you filter rows in a DataFrame based on a condition?

    df[df['column'] == value] (or any boolean condition).

  23. How do you use the query method to filter a DataFrame?

    df.query('column == "value"') (use double quotes for string values inside the query).

  24. How do you load a CSV file into a DataFrame?

    pd.read_csv('filename.csv', delimiter=',', header=0) (or simply pd.read_csv('file.csv')).

  25. How do you check for null values in a DataFrame?

    df.isnull() returns a DataFrame of booleans (True where null).

  26. How do you get the count of null values per column?

    df.isnull().sum()

  27. How do you fill missing values in a column with the column mean?

    df['column'].fillna(df['column'].mean())

  28. How do you drop all rows that contain any null values?

    df.dropna(axis=0) (axis=0 for rows).

  29. How do you add a new column to a DataFrame based on a condition?

    Create a boolean Series and assign it: df['new_col'] = df['grade'] >= 60 (example).

  30. How do you group data by a column and calculate the mean of another?

    df.groupby('group_col')['value_col'].mean()

  31. How do you sort a DataFrame by a column?

    df.sort_values('column', ascending=True) (use False for descending).

  32. How do you import matplotlib.pyplot?

    import matplotlib.pyplot as plt

  33. How do you create a simple bar chart in matplotlib?

    plt.bar(x_values, heights) then plt.show()

  34. How do you add a title and axis labels to a matplotlib plot?

    plt.title('Title'), plt.xlabel('X label'), plt.ylabel('Y label')

  35. How do you rotate x‑axis labels in a matplotlib plot?

    plt.xticks(rotation=90) (or any angle).

  36. How do you change the color of bars in a bar chart?

    Add the color parameter: plt.bar(x, y, color='orange').

  37. How do you create a histogram?

    plt.hist(data, bins=10) (bins optional) then plt.show().

  38. How do you create a box plot?

    plt.boxplot(data) or df.boxplot(column='col').

  39. How do you create a scatter plot in matplotlib?

    plt.scatter(x, y) then plt.show()

  40. What is the difference between a figure and a plot in matplotlib?

    A figure is the entire window; a plot (or axes) is a single chart within the figure.

  41. How do you create subplots in matplotlib?

    fig, axes = plt.subplots(nrows, ncols, figsize=(w,h)); then use axes[0], axes[1], etc.

  42. How do you create a pie chart in matplotlib?

    axes.pie(data, labels=labels) (e.g., ax1.pie(counts, labels=['Fail','Pass'])).

  43. How do you plot directly from a pandas DataFrame?

    df.plot(kind='bar', x='col1', y='col2', figsize=(w,h)) (or other kinds like 'hist').

  44. How do you customize the size of a matplotlib figure?

    Set figsize parameter: plt.figure(figsize=(width_inches, height_inches)) or in subplots.

  45. What is the describe() method in pandas?

    df.describe() returns summary statistics (count, mean, std, min, quartiles, max) for numeric columns.

  46. What is the mean of a dataset?

    The arithmetic average: sum of all values divided by the number of values.

  47. What is the median of a dataset?

    The middle value when the data is sorted in ascending order (or average of two middle values if even count).

  48. What is the mode of a dataset?

    The value that appears most frequently in the dataset.

  49. What is the range of a dataset?

    The difference between the maximum and minimum values: max−min\text{max} - \text{min}max−min.

  50. What is variance?

    The average of the squared differences from the mean: 1n∑i=1n(xi−xˉ)2\frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^2n1​∑i=1n​(xi​−xˉ)2.

  51. How is standard deviation related to variance?

    Standard deviation is the square root of the variance: σ=variance\sigma = \sqrt{\text{variance}}σ=variance​.

  52. What percentage of data falls within one standard deviation of the mean in a normal distribution?

    Approximately 68%.

  53. How do you normalize data using MinMaxScaler?

    from sklearn.preprocessing import MinMaxScaler; scaler = MinMaxScaler(); scaler.fit_transform(data)

  54. How do you calculate the correlation between two columns in a DataFrame?

    df['col1'].corr(df['col2'])

  55. What is the range of the correlation coefficient?

    From -1 to 1, where -1 indicates perfect negative linear relationship, 0 no linear relationship, and 1 perfect positive linear relationship.

  56. Does correlation imply causation?

    No. Correlation does not mean one variable causes the other; there may be confounding factors.

  57. What is linear regression in the form y=mx+by = mx + by=mx+b?

    A model that describes the linear relationship between an independent variable x and a dependent variable y, where m is the slope and b is the y-intercept.

  58. How do you obtain the slope and intercept of a linear regression using scipy?

    from scipy import stats; slope, intercept, r, p, se = stats.linregress(x, y)

  59. How do you plot a regression line on a scatter plot?

    First calculate predicted y: y_pred = m * x + b. Then plot the line with plt.plot(x, y_pred, color='cyan').

  60. How do you predict a value using a linear regression model?

    Use the equation y=mx+by = mx + by=mx+b with the calculated slope and intercept: prediction = m * new_x + b.

Card 1 of 60
Card 1 of 60

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent