Stratification of the continuous y (target) variable in regression setting Is it wise to stratify the continuous y (target) variable when you split your training and testing data from the total sample in regression setting? Here is the approach in python to do implement stratify the continuous target:
In Python (with the same libraries loaded as in the prior code snippet):

# Create the bins.  My `y` variable has
# 506 observations, and I want 50 bins.

bins = np.linspace(0, 506, 50)

# Save your Y values in a new ndarray,
# broken down by the bins created above.

y_binned = np.digitize(y, bins)

# Pass y_binned to the stratify argument,
# and sklearn will handle the rest

X_train, X_test, y_train, y_test = train_test_split(df, y, test_size=0.3, stratify=y_binned)

There you have it: stratification of a continuous numerical target value. However, I am not confident with this approach although stratification of the binary response variable is very common in classification setting to tackle class imbalance issues. I appreciate your suggestions!

You can try the verstack package to realize your requirement.
First, install it pip install verstack.
Then split the dataset based on the continuous label as:
from verstack.stratified_continuous_split import scsplit
train, valid = scsplit(df, df['continuous_column_name])

or
X_train, X_val, y_train, y_val = scsplit(X, y, stratify = y)

