File size: 791 Bytes
3ea44ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#####################################################################
##### IMPORT STANDARD MODULES
#####################################################################

from ..data import DataBlock

import pandas as pd
from sklearn.datasets import load_iris
import pytest

#####################################################################
##### DEFINE FIXTURES
#####################################################################

@pytest.fixture(scope='module')
def datablock():
	X,y = load_iris(return_X_y=True)
	df = pd.DataFrame(X,columns=['var%d'%i for i in range(4)])
	df['target'] = y

	#make 1 variable categorical
	df['var3'] = df['var3'].apply(lambda x: int(x)).astype(object)

	#make outcome binary
	df['target'].loc[df['target']==2]=1
	return DataBlock(df,df,df,'target')