Question: Python Help!!! Instructions: Using only the pandas library, write code that randomly splits a dataframe into two subsets. One subset should be called sample and
Python Help!!! Instructions: Using only the pandas library, write code that randomly splits a dataframe into two subsets. One subset should be called sample and comprised of 65% of the dataset. The second subset shoud be comprised of the remaining 35% and should be named valid. The skeleton code is provided. import pandas as pd def my_function (name): name.sample_df, name.valid_df = name.get_valid_and_sample() def get_valid_and_sample(name): file = name.file valid_df = pd.DataFrame([]) sample_df = pd.DataFrame([]) ***** Add code here that randomly splits a dataframe in to two subsets: one subset should be called sample and comprised of 35% of the dataset. The second subset shoud be comprised of the remaining 65% and should be named valid.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
