Download pool/shard001/Python/0009119_conftest.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 791 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/Python/0009119_conftest.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard001/Python/0009119_conftest.py
-
curl -L -o 0009119_conftest.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/Python/0009119_conftest.py
791 Bytes
| ##################################################################### | |
| ##### IMPORT STANDARD MODULES | |
| ##################################################################### | |
| from ..data import DataBlock | |
| import pandas as pd | |
| from sklearn.datasets import load_iris | |
| import pytest | |
| ##################################################################### | |
| ##### DEFINE FIXTURES | |
| ##################################################################### | |
| 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') | |