Introduction
Data science is a field where speed and accuracy matter. Whether you are cleaning messy datasets, building predictive models, or crafting visualizations, having a library of battle-tested prompts can save hours. This article compiles 30 concrete, working prompts for Pandas, Matplotlib, and Seaborn — tested on real-world datasets as of July 2026. Each prompt includes a usage example and a brief note on when to apply it. No fluff, just practical value.
Why Prompts Matter in Data Science
Modern data work often involves iterative coding. Prompts act as reusable snippets that solve specific problems: handling missing values, merging DataFrames, customizing chart aesthetics, or computing grouped statistics. According to the Pandas official documentation (pandas.pydata.org/docs), the library is used by over 10 million data professionals globally as of 2024. Prompts help standardize common operations, reduce debugging time, and make collaboration easier.
Pandas Prompts (Data Manipulation)
| # | Prompt Description | Example Usage |
|---|---|---|
| 1 | Drop rows with missing values in specific columns | df.dropna(subset=['column1', 'column2'], inplace=True) |
| 2 | Fill missing values with column mean | df.fillna(df.mean(), inplace=True) |
| 3 | Group by and aggregate multiple functions | df.groupby('category').agg({'sales': 'sum', 'profit': 'mean'}) |
| 4 | Create a pivot table with margins | pd.pivot_table(df, values='revenue', index='region', columns='year', aggfunc='sum', margins=True) |
| 5 | Rename columns with a dictionary | df.rename(columns={'old_name': 'new_name'}, inplace=True) |
| 6 | Filter rows based on multiple conditions | df[(df['age'] > 25) & (df['city'] == 'New York')] |
| 7 | Apply a custom function to a column | df['discounted_price'] = df['price'].apply(lambda x: x * 0.9) |
| 8 | Merge two DataFrames on a key | pd.merge(df1, df2, on='user_id', how='left') |
| 9 | Detect and remove duplicates | df.drop_duplicates(subset=['email'], keep='first') |
| 10 | Create a new column based on conditions | df['status'] = np.where(df['score'] > 80, 'Pass', 'Fail') |
| 11 | Resample time series data to monthly frequency | df.resample('M').mean() |
| 12 | Get summary statistics for numeric columns | df.describe(percentiles=[.25, .5, .75]) |
| 13 | One-hot encode categorical variables | pd.get_dummies(df, columns=['color', 'size']) |
| 14 | Sort DataFrame by multiple columns | df.sort_values(by=['revenue', 'date'], ascending=[False, True]) |
| 15 | Efficiently iterate over rows with iterrows | for index, row in df.iterrows(): process(row) |
Each prompt can be adapted to your specific dataset. For example, prompt #8 (merge) is commonly used when combining customer data from different sources. ASI Biont supports connecting to multiple data sources via API — more details at asibiont.com/courses.
Matplotlib Prompts (Static Visualization)
| # | Prompt Description | Example Usage |
|---|---|---|
| 16 | Basic line plot with labels | plt.plot(x, y); plt.xlabel('Time'); plt.ylabel('Value'); plt.show() |
| 17 | Bar chart with error bars | plt.bar(categories, values, yerr=errors, capsize=5) |
| 18 | Histogram with custom bins | plt.hist(data, bins=30, edgecolor='black') |
| 19 | Scatter plot with color mapping | plt.scatter(x, y, c=z, cmap='viridis', s=50) |
| 20 | Add grid and adjust tick parameters | plt.grid(True, linestyle='--', alpha=0.7); plt.xticks(rotation=45) |
| 21 | Create a subplot layout | fig, axes = plt.subplots(2, 2, figsize=(10, 8)) |
| 22 | Add annotations to specific points | plt.annotate('peak', xy=(x_val, y_val), xytext=(x_val+0.2, y_val+0.2), arrowprops=dict(facecolor='black')) |
| 23 | Save figure with high DPI | plt.savefig('plot.png', dpi=300, bbox_inches='tight') |
| 24 | Adjust legend position outside plot | plt.legend(loc='upper left', bbox_to_anchor=(1, 1)) |
| 25 | Use LaTeX for axis labels | plt.xlabel(r'$\Delta$ Time (seconds)') |
Matplotlib remains the most widely used plotting library in Python, with over 50 million downloads per month (PyPI stats, 2026). These prompts cover the most common chart types and customization needs.
Seaborn Prompts (Statistical Visualization)
| # | Prompt Description | Example Usage |
|---|---|---|
| 26 | Boxplot to detect outliers | sns.boxplot(x='category', y='value', data=df) |
| 27 | Heatmap of correlation matrix | sns.heatmap(df.corr(), annot=True, cmap='coolwarm') |
| 28 | Pairplot for multivariate exploration | sns.pairplot(df, hue='target') |
| 29 | Violin plot for distribution comparison | sns.violinplot(x='group', y='score', data=df, inner='quartile') |
| 30 | Countplot with hue | sns.countplot(x='product', hue='region', data=df) |
Seaborn is built on Matplotlib and simplifies complex statistical plots. Prompt #27 (heatmap) is especially useful for feature selection in machine learning — it quickly reveals multicollinearity.
Practical Workflow Example
Let’s say you have a sales dataset with missing values, multiple regions, and time series data. A typical analysis might use prompts #1 (drop missing), #3 (group by region), #16 (line plot over time), and #27 (correlation heatmap between numeric features). This combination gives you a clean dataset, aggregated insights, visual trends, and feature relationships — all in under 20 lines of code.
Conclusion
These 30 prompts are a starting point. As you work with data, you will tailor them to your own patterns. The key is to keep a personal library of prompts that solve recurring problems. In 2026, with the rise of automated machine learning tools, having strong foundational skills in Pandas, Matplotlib, and Seaborn remains essential for any data scientist. Start with these, practice on real data, and your efficiency will grow significantly.
Comments