Data Types and Structures

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Explain how the Supreme Court's ruling in Brown vs. Board of Education influenced the events that unfolded at Little Rock Central High School in 1957.

The Brown vs. Board of Education ruling declared state-sponsored segregation in public schools unconstitutional, which legally required Little Rock Central High School to desegregate. However, resistance to this ruling by figures like Governor Faubus led to the Little Rock Crisis.

Describe the role of the NAACP during the Montgomery Bus Boycott.

The NAACP played a key role in the Montgomery Bus Boycott as a well-organized and planned action in the city. Rosa Parks was the secretary for the local NAACP since 1943.

How did the Greensboro sit-in in February 1960, demonstrate a shift in civil rights activism compared to earlier forms of protest?

The Greensboro sit-in demonstrated a shift towards more direct and confrontational methods of civil rights activism, as it involved students actively occupying segregated spaces and demanding service.

What were Jim Crow laws and where were they enforced?

<p>Jim Crow Laws were laws that institutionalized segregation and discrimination in the Southern States of the USA.</p> Signup and view all the answers

Describe the link between the Montgomery Bus Boycott and the Supreme Court's decision regarding bus segregation.

<p>The Montgomery Bus Boycott was a response to bus segregation laws. Following the Alabama federal district court ruling, the Supreme Court upheld the federal court ruling that bus segregation was unconstitutional and therefore illegal.</p> Signup and view all the answers

Discuss the significance of federal intervention during the Little Rock Crisis. What did it reveal about the balance of power between state and federal authority regarding civil rights?

<p>President Eisenhower sent federal troops to enforce integration, demonstrating federal supremacy in upholding constitutional rights over state defiance.</p> Signup and view all the answers

How did the actions of Governor Faubus and President Eisenhower during the Little Rock Crisis illustrate the tension between state sovereignty and federal authority during the Civil Rights Movement?

<p>Governor Faubus's attempt to block the Little Rock Nine from entering Central High defied the federal court order for desegregation. Eisenhower sending federal troops to enforce the court order showed the federal government's power.</p> Signup and view all the answers

To what extent did the success of the Montgomery Bus Boycott rely on economic factors, and how did this affect the bus company?

<p>The bus company lost 65% of its profit during the bus boycott. This economic pressure contributed to ending bus segregation.</p> Signup and view all the answers

How did the Civil Rights Act in 1964 address Jim Crow laws and discrimination in US society?

<p>The Civil Rights Act of 1964 sought to dismantle Jim Crow laws by prohibiting discrimination based on race, color, religion, sex, or national origin. The Act outlawed segregation in public accommodations, employment, and federally funded programs.</p> Signup and view all the answers

Describe the philosophy of passive resistance as expressed by civil rights activists.

<p>Passive resistance, initiated by Mahatma Gandhi, protests unjust laws, with peaceful protests of unjust laws, civil disobedience, and non-violent methods.</p> Signup and view all the answers

Flashcards

Passive Resistance

The non-violent protests initiated by Mahatma Gandhi and adopted by Martin Luther King Jr and other civil rights activists.

Civil Disobedience

Refusal to comply with unjust laws as a form of protest.

Desegregation

Putting an end to racial segregation/divide.

Civil Rights

The right to equal treatment, to vote and to receive legal justice.

Signup and view all the flashcards

Jim Crow Laws

Segregation laws that were enforced in the Southern States.

Signup and view all the flashcards

Integration

Closing the racial divide in an attempt to give equal rights.

Signup and view all the flashcards

Brown vs Board of Education

Declared that racial segregation in public schools violated the Fourteenth Amendment to the Constitution (1954).

Signup and view all the flashcards

Little Rock Nine

Nine African American students who enrolled at Central High in Little Rock in 1957, testing the Supreme Court's ruling.

Signup and view all the flashcards

Federal Troops

Was used to enforce integration at Little Rock High and protect the Little Rock Nine.

Signup and view all the flashcards

Montgomery Bus Boycott

The Alabama bus boycott sparked by Rosa Parks' arrest.

Signup and view all the flashcards

Study Notes

Data Types

  • Numerical data is either discrete (integer) or continuous (float, double).
  • Categorical data is either ordinal (ordered) or nominal (unordered).

Data Structures

Lists

  • Lists are ordered, mutable, and can contain duplicate elements.
  • Use my_list = [1, 2, 3] to create a list.
  • Use my_list.append(4) to add a single element to the end.
  • Use my_list.extend([5, 6]) to add multiple elements to the end.
  • Use my_list.insert(0, 0) to insert an element at a specific index.
  • Use my_list.remove(0) to remove the first occurrence of a specific element.
  • Use my_list.pop(0) to remove and return the element at a specific index.
  • Use del my_list to delete the item at index.
  • Use my_list.clear() to remove all elements.

Dictionaries

  • Dictionaries store key-value pairs and are mutable.
  • Use my_dict = {'a': 1, 'b': 2} to create a dictionary.
  • Use my_dict['c'] = 3 to add a new key-value pair.
  • Use my_dict['a'] = 4 to modify the value of an existing key.
  • Use del my_dict['a'] to delete a key-value pair.
  • Use my_dict.pop('b') to remove and return an item.
  • Use my_dict.clear() to remove key-value pairs from a dictionary.

Tuples

  • Tuples are ordered and immutable.
  • Use my_tuple = (1, 2, 3) to create a tuple.

Sets

  • Sets are unordered and contain unique elements.
  • Use my_set = {1, 2, 3} to create a set.
  • Use my_set.add(4) to add an element.
  • Use my_set.remove(4) to remove a given element.
  • Use my_set.discard(4) to remove an element if it exists, without raising an error.
  • Use my_set.pop() to remove an arbitrary element.
  • Use my_set.clear() to remove all elements.

Data Preprocessing (with Pandas)

Handle Missing Data

  • Use df.isnull() to identify missing values.
  • Use df.notnull() to identify non-missing values.
  • Use df.isnull().sum() to count missing values per column.
  • Use df.dropna() to drop rows with any missing values.
  • Use df.dropna(axis=1) to drop columns with any missing values.
  • Use df.fillna(value) to fill missing values with a specified value.
  • Use df.fillna(df.mean()) to fill missing values with the column mean.
  • Use df.fillna(df.median()) to fill missing values with the column median.

Data Formatting

  • Use df['column'].astype('int') to change the data type of a column.

Data Normalization

  • Simple Scaling: df['column'] = df['column'] / df['column'].max()
  • Min-Max: df['column'] = (df['column'] - df['column'].min()) / (df['column'].max() - df['column'].min())
  • Z-score: df['column'] = (df['column'] - df['column'].mean()) / df['column'].std()

Data Discretization

  • Use pd.cut() or pd.qcut() for data discretization.

Exploratory Data Analysis (EDA)

Descriptive Statistics

  • Numerical data:
    • Use df.describe() to get descriptive statistics.
    • Use df['column'].mean() to get the mean.
    • Use df['column'].median() to get the median.
    • Use df['column'].mode() to get the mode.
    • Use df['column'].std() to get the standard deviation.
    • Use df['column'].var() to get the variance.
    • Use df['column'].min() to get the minimum value.
    • Use df['column'].max() to get the maximum value.
    • Use df['column'].sum() to get the sum.
    • Use df['column'].quantile(0.25) to get the 25th percentile.
    • Use df['column'].value_counts() to count occurrences.
  • Categorical data:
    • Use df['column'].value_counts() to get frequency counts.

Grouping

  • Use df.groupby('column')['another_column'].mean() to group by one column and get the mean of another column.

Visualization

  • Histograms: plt.hist()
  • Scatter plots: plt.scatter()
  • Box plots: plt.boxplot()

Machine Learning

Model Evaluation Metrics

Regression
  • Mean Absolute Error (MAE): $MAE = \frac{1}{n} \sum_{i=1}^{n} | y_i - \hat{y}_i |$
  • Mean Squared Error (MSE): $MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2$
  • Root Mean Squared Error (RMSE): $RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}$
  • R-squared: $R^2 = 1 - \frac{\sum_{i=1}^{n} (y_i - \hat{y}i)^2}{\sum{i=1}^{n} (y_i - \bar{y})^2}$
Classification
  • Accuracy: $\frac{TP + TN}{TP + TN + FP + FN}$
  • Precision: $\frac{TP}{TP + FP}$
  • Recall: $\frac{TP}{TP + FN}$
  • F1-Score: $2 * \frac{Precision * Recall}{Precision + Recall}$
  • AUC-ROC: Area under the Receiver Operating Characteristic curve

Common Algorithms

Regression
  • Linear Regression
  • Decision Tree
  • Random Forest
Classification
  • Logistic Regression
  • Support Vector Machine (SVM)
  • K-Nearest Neighbors (KNN)
  • Decision Tree
  • Random Forest
Clustering
  • K-Means
Dimensionality Reduction
  • Principal Component Analysis (PCA)

Ischemic Stroke Management Guidelines

Summary Points

  • Rapid recognition and assessment of stroke symptoms are crucial.
  • Immediate transfer to a stroke center is essential for eligible patients.
  • Intravenous thrombolysis with alteplase should be considered within 4.5 hours of symptom onset.
  • Endovascular thrombectomy is indicated for patients with large vessel occlusion within 24 hours of symptom onset.
  • Blood pressure management, glucose control, and temperature regulation are important aspects of acute stroke care.
  • Secondary prevention strategies should be implemented to reduce the risk of recurrent stroke.

Acute Management Algorithm

  • Initial Assessment: Assess ABCs, obtain history, perform neurological examination (NIHSS), and rule out stroke mimics.
  • Rapid Transport: Activate EMS and transport to the nearest stroke center, alerting the receiving hospital.
  • Emergency Department Evaluation: Obtain CT or MRI brain imaging, perform lab tests, and assess eligibility for thrombolysis and/or thrombectomy.
  • Thrombolysis: Administer intravenous alteplase within 4.5 hours of symptom onset if eligible, and monitor for bleeding complications.
  • Endovascular Thrombectomy: Transfer to a thrombectomy-capable center if large vessel occlusion is present, and perform thrombectomy as soon as possible within 24 hours of symptom onset.
  • Supportive Care: Manage blood pressure, glucose, and temperature, and prevent/treat complications.
  • Secondary Prevention: Start antiplatelet therapy, initiate statin therapy, and address modifiable risk factors.

Key Considerations

  • Blood Pressure Management:
    • Maintain blood pressure below 180/105 mmHg during acute phase.
    • Use labetalol, nicardipine, or other appropriate agents.
    • Avoid excessive blood pressure reduction, which can worsen ischemia.
  • Glucose Control:
    • Maintain blood glucose between 140-180 mg/dL.
    • Use insulin for hyperglycemia.
    • Avoid hypoglycemia, which can mimic stroke symptoms.
  • Temperature Regulation:
    • Treat fever aggressively with antipyretics.
    • Avoid hypothermia, which can worsen outcomes.

Discharge Planning

  • Assess patient's functional status and rehabilitation needs.
  • Provide education on secondary prevention strategies.
  • Schedule follow-up appointments.

Performance Measures

  • Percentage of patients receiving thrombolysis within 60 minutes of arrival
  • Percentage of patients with large vessel occlusion undergoing thrombectomy within 24 hours of symptom onset
  • Rate of symptomatic intracranial hemorrhage following thrombolysis

Matplotlib

What is Matplotlib?

  • Matplotlib is a comprehensive Python library for creating static, animated, and interactive visualizations.
  • It simplifies common tasks and tackles complex visualizations.
  • Matplotlib is useful for:
    • Creating publication-quality plots
    • Making interactive figures
    • Customizing visual style and layout
    • Exporting to many file formats
    • Embedding in JupyterLab and graphical user interfaces
    • Utilizing third-party packages built on Matplotlib

Matplotlib Simple Plotting

  • Import necessary libraries:
    • import matplotlib.pyplot as plt
    • import numpy as np
  • Generate data:
    • t = np.arange(0.0, 2.0, 0.01)
    • s = 1 + np.sin(2 * np.pi * t)
  • Plot data:
    • fig, ax = plt.subplots()
    • ax.plot(t, s)
  • Customize plot:
    • ax.set(xlabel='time (s)', ylabel='voltage (mV)', title='About as simple as it gets, folks')
    • ax.grid()
  • Save and display plot:
    • fig.savefig("test.png")
    • plt.show()

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Data Structures Quiz
10 questions

Data Structures Quiz

InsightfulTourmaline avatar
InsightfulTourmaline
Data Types and Structures Quiz
5 questions
Data Structures and ADT Quiz
5 questions

Data Structures and ADT Quiz

ConsistentTransformation avatar
ConsistentTransformation
Advantage of Abstract Data Types
10 questions
Use Quizgecko on...
Browser
Browser