Overview
This prompt guides the creation of a Python script for analyzing loan default risk by credit score. Financial analysts and data scientists in lending will benefit from this template.
Prompt Overview
Purpose: To analyze car loan default rates using customer credit scores.
Audience: Data analysts and financial professionals in lending.
Distinctive Feature: Modular functions for preprocessing, analysis, and visualization.
Outcome: A clear visual and statistical summary of default risk.
Quick Specs
- Media: Image
- Use case: Generation
- Industry: Stock Brokerage & Trading, Data & Analysis, General Business Operations
- Techniques: Structured Output, Decomposition, System-First Instructions
- Models: GPT-4, Claude 3 Opus, Llama 4 Maverick
- Estimated time: 5-15 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Generate a Python script that analyzes car loan default rates based on customer credit scores.
# Steps
1. **Data Collection and Preprocessing:**
– Gather car loan data that includes customer credit scores and their default status.
– Clean the data by handling missing values and outliers.
– Ensure the data is in a format suitable for analysis.
2. **Data Analysis:**
– Calculate default rates across different credit score ranges.
– Use statistical methods to identify patterns and correlations between credit scores and default rates.
3. **Visualization:**
– Create graphs or charts to visually represent the relationship between credit scores and default rates.
4. **Conclusion:**
– Summarize the findings from the analysis.
# Output Format
Provide a well-documented Python script that includes the entire analysis process, from data preprocessing to conclusions. The script should be modular and include comments for clarity.
# Examples
– Import necessary libraries such as pandas, numpy, and matplotlib.
– Define functions for each step of the process, e.g., `data_preprocessing()`, `analyze_data()`, `visualize_data()`.
– Example code snippets:
“`python
import pandas as pd
def data_preprocessing(data):
# Handle missing values
# Normalize credit scores
return cleaned_data
“`
# Notes
– Ensure that the data used in the script is realistic and representative.
– Consider any legal and ethical implications of analyzing customer data.
Screenshot Examples
[Insert relevant screenshots after testing]
How to Use This Prompt
- Paste it into a ChatGPT or similar AI interface.
- Specify any adjustments to data sources or parameters needed.
- Run the generated Python script in your local environment.
- Review the analysis results and visualizations produced.
- Modify the script as necessary for your specific dataset.
Tips for Best Results
- Clean Data First: Always handle missing values and outliers in credit score data to prevent skewed default rate analysis.
- Segment by Score: Calculate default rates by grouping customers into clear credit score ranges (e.g., Poor, Fair, Good, Excellent) for actionable insights.
- Visualize the Trend: Use a simple line or bar chart to clearly show the inverse relationship between credit scores and default likelihood.
- Document Assumptions: Clearly state any simulated data usage and the ethical considerations of profiling based on credit scores.
FAQ
- What is the main purpose of this Python script?
To analyze car loan default rates based on customer credit scores through data processing, analysis, and visualization. - Which libraries are essential for this analysis?
Pandas for data manipulation, NumPy for calculations, and Matplotlib for creating visualizations of the results. - How should missing data be handled?
By removing rows with missing values or using imputation methods to maintain dataset integrity for analysis. - What ethical considerations are important?
Ensuring data privacy, avoiding bias in analysis, and using representative data to prevent discriminatory conclusions.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (March 2026): Initial release.


