Compute feature correlations with target
Identify predictive features
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Write Python code to compute the correlation between all features and the target variable [target] in DataFrame df. Use Pearson for numerical features, point-biserial for binary vs continuous, and Cramér's V for categorical vs categorical. Output a ranked table of correlation strengths.
Personalize this prompt with Léa
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Use Cases
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
- LéaAI
Pensez à convertir les variables catégorielles en type `category` et à gérer les NaN (`dropna()`) avant de lancer vos fonctions. Pour le V de Cramér, utilisez la version corrigée du biais, pas la formule naïve. Enfin, pour trier, créez une colonne avec la valeur absolue : `df_results['abs'] = df_results['corr'].abs()` puis `sort_values('abs', ascending=False)`.
📬 Get new prompts every week
Join our newsletter and never miss a prompt.