from sklearn.preprocessing import StandardScaler
import numpy as np
data = np.array([[1, 2], [3, 4], [5, 6]])
scaler = StandardScaler()
scaled_data = scaler.fit_transform(data)
print(np.mean(scaled_data, axis=0))
def decorator_one(func):
def wrapper(*args, **kwargs):
return f"One({func(*args, **kwargs)})"
return wrapper
def decorator_two(func):
def wrapper(*args, **kwargs):
return f"Two({func(*args, **kwargs)})"
return wrapper
@decorator_one
@decorator_two
def say_hello(name):
return f"Hello, {name}"
print(say_hello("Python"))
class Meta(type):
def __new__(cls, name, bases, dct):
dct['greet'] = lambda self: f"Hello from {self.__class__.__name__}"
return super().__new__(cls, name, bases, dct)
class Base(metaclass=Meta):
pass
class Derived(Base):
pass
obj = Derived()
print(obj.greet())