Link to home
Start Free TrialLog in
Avatar of Member_2_7966113
Member_2_7966113

asked on

Convert Pandas to Python

Experts,

Can someone show me how to convert the following code written in pandas to python?

import pandas as pd
import numpy as np

data = pd.read_csv('CC1_TrainTestSpit.csv')

#get 20% data

df=data.sample(frac=0.2)

# split data

def trainTestSplit(df):
    train=df.sample(frac=0.8) 
    test=df.drop(train.index)
    
    summary=train.describe(include=[np.number]).loc[['mean','min','max'],:]
    
    return train,test,summary

Open in new window



Thanks
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_7966113
Member_2_7966113

ASKER

OK, that was a silly question :-)
Cheers mate. Much appreciated.