Data Interview Qs - Normalizing cholesterol data

InterviewQs

Normalizing cholesterol data

Python Normalizing Data ML Concept Data Processing

Forward this email to a friend or colleague and challenge them to solve it.

Hi, 

Given this dataset on heart disease, write code to normalize the "chol" (cholesterol) column such that the distribution of the data remains the same, but the range is adjusted to be between 0 and 1.

There are built in functions that will normalize data for you, but try to avoid them in this question -- the goal here is to understand how the math underneath works.

To get you started, the code below loads in the dataset. You can also make a copy of this Google Colab notebook.

      

# Importing packages

import pandas as pd

import numpy as np

# Reading in data

df = pd.read_csv('https://raw.githubusercontent.com/erood/interviewqs.com_code_snippets/master/ Datasets/heart_disease.csv', parse_dates=True)

df.head()

age sex cp trestbps chol fbs restecg thalach exang oldpeak slope ca thal target
0 63 1 3 145 233 1 0 150 0 2.3 0 0 1 1
1 37 1 2 130 250 0 1 187 0 3.5 0 0 2 1
2 41 0 1 130 204 0 0 172 0 1.4 2 0 2 1
3 56 1 1 120 236 0 1 178 0 0.8 2 0 2 1
4 57 0 0 120 354 0 1 163 1 0.6 2 0 2 1

Solution will be written in Python for premium users.



 

You’ve accumulated 282 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.


Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Older messages

Allocating votes from pooled elections

Monday, April 18, 2022

SQL, Database Querying, Subquery, InterviewQs Allocating votes from pooled elections SQL Database Querying Subquery Forward this email to a friend or colleague and challenge them to solve it. Hi,

Estimating the confidence interval for the length of an angelfish

Monday, April 11, 2022

Statistics, Confidence Intervals, InterviewQs Estimating the confidence interval for the length of an angelfish Statistics Confidence Intervals Forward this email to a friend or colleague and challenge

Classifying animals in SQL

Friday, April 8, 2022

SQL, Database Querying, Window Function, Subquery, InterviewQs Classifying animals in SQL SQL Database Querying Window Function Subquery Forward this email to a friend or colleague and challenge them

Plotting New York Airbnb listings

Wednesday, April 6, 2022

Python, Arrays, Data Structures, Data Visualization, InterviewQs Plotting New York Airbnb listings Python Arrays Data Structures Data Visualization Forward this email to a friend or colleague and

Simulating and visualizing rolls of a die

Monday, April 4, 2022

Python, Arrays, Data Structures, Algorithms, Simulation, Data Visualization, InterviewQs Simulating and visualizing rolls of a die Python Arrays Data Structures Algorithms Simulation Data Visualization

You Might Also Like

Apple renews OpenAI talks 🧠, Google fires Python team 👨‍💻, React 19 beta ⚛️

Monday, April 29, 2024

Apple has renewed discussions with OpenAI to use its generative AI technology to power new features coming to the iPhone Sign Up |Advertise|View Online TLDR Together With QA Wolf TLDR 2024-04-29 😘 Kiss

Architecture Weekly #177 - 29nd April 2024

Monday, April 29, 2024

How do you make predictions about tech without the magical crystal ball? We did that today by example. We analysed what Redis and Terraform license changes relate to the new Typescript framework Effect

Software Testing Weekly - Issue 217

Monday, April 29, 2024

How do you deal with conflicts in QA? ⚔️ View on the Web Archives ISSUE 217 April 29th 2024 COMMENT Welcome to the 217th issue! How do you deal with conflicts in QA? Ideally, you'd like to know how

📧 Did you watch the free MMA chapters? (1+ hours of content)

Monday, April 29, 2024

Did you watch the free MMA chapters? Hey there! 👋 I wish you a fantastic start to the week. Last week, I launched Modular Monolith Architecture. More than 300+ students are already deep into the MMA

WP Weekly 191 - Essentials - Duplicate in Core, White Label Kadence, Studio for Mac

Monday, April 29, 2024

Read on Website WP Weekly 191 / Essentials It seems many essential features are being covered in-house, be it the upcoming duplicate posts/pages feature in the WordPress core or the launch of Studio

SRE Weekly Issue #422

Monday, April 29, 2024

View on sreweekly.com A message from our sponsor, FireHydrant: FireHydrant is now AI-powered for faster, smarter incidents! Power up your incidents with auto-generated real-time summaries,

Quick question

Sunday, April 28, 2024

I want to learn how I can better serve you ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Kotlin Weekly #404 (NOT FOUND)

Sunday, April 28, 2024

ISSUE #404 28st of April 2024 Announcements Kotlin Multiplatform State of the Art Survey 2024 Help to shape and understand the Kotlin Multiplatform Ecosystem! It takes 4 minutes to fill this survey.

📲 Why Is It Called Bluetooth? — Check Out This AI Text to Song Generator

Sunday, April 28, 2024

Also: What to Know About Emulating Games on iPhone, and More! How-To Geek Logo April 28, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to your

Daily Coding Problem: Problem #1425 [Easy]

Sunday, April 28, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Suppose an arithmetic expression is given as a binary tree. Each leaf is an