Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help creating a new DataFrame in PYTHON PANDAS. df = pd.read_csv(https://www.stat.berkeley.edu/~statlabs/data/babies.data, delim_whitespace=True) df.head(10) #This is where I am extracting the data bars =

I need help creating a new DataFrame in PYTHON PANDAS.

df = pd.read_csv("https://www.stat.berkeley.edu/~statlabs/data/babies.data", delim_whitespace=True) df.head(10) #This is where I am extracting the data

bars = ("birth weight of babies with non-smoking mother", df.loc[df["smoke"] == 0]["bwt"], "birth weight of babies with smoker mother", df.loc[df["smoke"] == 1]["bwt"])

# this is what I will be displaying on stacked histogram

In order to create a "stacked histogram " with the above properties, I need help creating a "new data frame" first then create a stacked histogram.

I tried something like new_fram_data = pd.DataFrame(bars), but I get the error saying "setting an array element with a sequence" . If you have any other way, please feel free.

Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions