PYTHON Pandas DataFrame I\'ve just cleaned a database, filtered potentially redu
ID: 3748250 • Letter: P
Question
PYTHON Pandas DataFrame
I've just cleaned a database, filtered potentially redundant information. Now, I am trying to store the modifed data in a Pandas DataFrame called dfBabies. This is all on jupyter notebook. If you need more clarity, please ask.
so far, this is what i have.
df = pd.read_csv("https://www.stat.berkeley.edu/~statlabs/data/babies.data", delim_whitespace=True)
df.head(10) # simply calling and reading the database
df[(df.smoke != 9) & (df.weight != 999) & (df.height != 99) & (df.parity != 9) &
(df.gestation != 999) & (df.bwt != 999)] #Modification
Thank yoU!
Explanation / Answer
#simpy assign the modified dataframe to a new variable, which is dfbabies in your case dfbabies = df[(df.smoke != 9) & (df.weight != 999) & (df.height != 99) & (df.parity != 9) & (df.gestation != 999) & (df.bwt != 999)] #Modification #Modification
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.