Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sklearn standardscaler to selected column only

# PYTHON

cols_to_scale= ['Alcohol','Gdp','Population', 'Percentage expenditure', 'Schooling']

X_train[cols_to_scale]=scaler.fit_transform(X_train[cols_to_scale])
X_test[cols_to_scale]=scaler.transform(X_test[cols_to_scale])
Comment

sklearn standardscaler for numerical columns

# Author: Pedro Morales <part.morales@gmail.com>
#
# License: BSD 3 clause

import numpy as np

from sklearn.compose import ColumnTransformer
from sklearn.datasets import fetch_openml
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split, GridSearchCV

np.random.seed(0)

# Load data from https://www.openml.org/d/40945
X, y = fetch_openml("titanic", version=1, as_frame=True, return_X_y=True)
Comment

PREVIOUS NEXT
Code Example
Python :: lists example in python 
Python :: Get index for value_counts() 
Python :: disable kivy button in kv 
Python :: django register form return a 302 request 
Python :: iterate over the dataset and compute the mean vector. 
Python :: fetchall in python sqilite3 
Python :: InvalidArgumentError: logits and labels must be broadcastable: logits_size=[16,3] labels_size=[16,2] [[node categorical_smooth_loss/softmax_cross_entropy_with_logits 
Python :: function for permutation sampling and test statistic from a specified operation 
Python :: Python RegEx re.compile() Set class [s,.] will match any whitespace character ‘,’ or ‘.’ 
Python :: Horizontal stacked bar chart with annotations 
Python :: django python get more commands paramaters 
Python :: Extract the best model from gridsearch cv 
Python :: visualising data with tsne 
Python :: time, date 
Python :: Python Code for Checking if a number is an Odd number 
Python :: find difference between two triangular numbers python 
Python :: how to choose appropriate graph for dataset visualization 
Python :: add column to wandb.Table 
Python :: are you dumb python program 
Python :: Add value on top of each bar using function 
Python :: basic decorator example 
Python :: custom_settings in scrpay 
Python :: plt.text background alpha 
Python :: Subtract layers 
Python :: python input byte array 
Python :: shorten all floats in a list 
Python :: how to access a variable from another py file in vs code 
Python :: micropython string to int 
Python :: random word generator django 
Python :: ciclo while python 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =