Last active
April 24, 2023 05:34
-
-
Save nqbao/c894d5abf78e0a3d64d1bc08ae0e88e9 to your computer and use it in GitHub Desktop.
my snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove outliner | |
upper = df.quantile(0.99) | |
cols = set(list(df)) - {"ts", "tss"} | |
df_clean = df | |
for col in cols: | |
df_clean = df_clean[(df_clean[col] < upper[col])] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Create a sample data set with three variables | |
data = pd.DataFrame(np.random.randn(1000, 4), columns=['Variable 1', 'Variable 2', 'Variable 3', 'Variables 4']) | |
target_variable = np.random.randn(1000) | |
# Create a multi-scatter plot for all variables against the target variable | |
fig, axs = plt.subplots(nrows=3, ncols=2, figsize=(10, 12)) | |
axs = axs.flatten() | |
for i, variable in enumerate(data.columns): | |
axs[i].scatter(data[variable], target_variable, alpha=0.2) | |
axs[i].set_xlabel(variable) | |
axs[i].set_ylabel('Target Variable') | |
plt.tight_layout() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment