AI generated prompt for Python Data Analysis with Pandas
**Context**: Python's Pandas library is a powerful tool for data analysis and manipulation, providing data structures and functions to efficiently handle structured data, including tabular data such as spreadsheets and SQL tables. The library offers a robust set of tools for data cleaning, filtering, sorting, grouping, merging, reshaping, and pivoting data. **Detailed Instructions**: Write a Python script that utilizes the Pandas library to perform advanced data analysis on a given dataset. The dataset should contain at least 10,000 rows and include various data types such as integers, floats, and strings. The script should: 1. Load the dataset from a CSV file. 2. Perform data cleaning by handling missing values, removing duplicates, and converting data types as necessary. 3. Filter the data based on specific conditions (e.g., values within a certain range, matching specific strings). 4. Group the data by one or more columns and calculate aggregate statistics (e.g., mean, median, count). 5. Merge the dataset with another dataset based on a common column. 6. Pivot the data to transform it from a long format to a wide format. 7. Sort and rank the data based on specific columns. 8. Visualize the results using matplotlib or seaborn to create informative plots (e.g., bar charts, histograms, scatter plots). **Output Format**: The output should include: - A brief description of the dataset and the analysis performed. - A summary of the data cleaning process, including the number of missing values removed and duplicates dropped. - The results of the filtering, grouping, and merging operations, including the number of rows affected. - The pivoted data in a wide format. - The sorted and ranked data. - At least three visualizations of the data. **Examples**: For example, if the dataset contains information about sales transactions, the script could filter the data to include only transactions above a certain amount, group the data by region and calculate the total sales for each region, and then visualize the results in a bar chart. Another example could involve analyzing a dataset of student grades, where the script groups the data by student ID and calculates the average grade for each student, then merges this data with a dataset containing student demographic information to analyze the relationship between demographics and academic performance.
This coding prompt is designed to help you get better results from AI assistants like ChatGPT, Claude, and Gemini. Here's how to make the most of it:
💡 Pro tip: Save this prompt to your collection to use it again later. Well-crafted prompts can save hours of back-and-forth with AI.
Adjust the prompt to match your specific industry, audience, or use case. Adding relevant context improves output quality.
Specify your desired output length (e.g., "in 200 words" or "in 3 bullet points") to get more targeted responses.
Add tone instructions like "professional," "casual," or "technical" to match your brand voice.
Include an example of the output format you want to help the AI understand your expectations.
This prompt has been tested and optimized for all major AI models. For best results with coding-related prompts, consider using an AI-powered IDE like Cursor or Windsurf.
Learn more about using prompts effectively with our comprehensive guides:
0 people found this prompt helpful
Based on 0 reviews
Be the first to share your experience with this prompt!
This prompt was reviewed and verified to work with current AI models.
Tested with ChatGPT, Claude & Gemini. Reviewed by community users.
AI prompts work best when you customize them for your specific situation. Follow these steps to get the most out of Python Data Analysis With Pandas.