CHATGPT
CHEATSHEET
Mazher Khan - IIT (BHU) - B.Tech (DR-2)
Senior Data Analyst | Ex - OLX (EU)
YouTube - 8M+ (Views) l LinkedIn 17k+
Book for Career Guidance,
https://topmate.io/mazher_khan
CV review & interview tip
Book 1:1 Mentorship Plan -
https://www.preplaced.in/profile/mazher-khan
1,3, 6 Months
Follow me on Linkedin https://www.linkedin.com/in/mazher-khan/
Follow on Instagram https://www.instagram.com/khan.the.analyst
Follow on Youtube https://youtube.com/@imzhr.?si=KdMGmWt-vTy12hxV
Practice Workbook - 100 https://docs.google.com/spreadsheets/d/1eP8evU2JIsawAVJ7GH_
Days Challenge NNd_2xNLOT7abpJTs5O9iUQI/edit#gid=775777503
Telegram Link- https://t.me/+XTjv6r80eDc5ZWU1
Prompts for
general coding
workflows
Code debugging workflows
Debugging Python code
PROMPT STRUCTURE
I want you to be a Python programmer, here is a piece of Python code
containing {problem} — {insert code snippet} — I am getting the following error
{insert error}. What is the reason for the bug?
Code debugging workflows
Debugging R code
PROMPT STRUCTURE
I want you to be an R programmer, here is a piece of R code containing
{problem} — {insert code snippet} — I am getting the following error
{insert error}. What is the reason for the bug?
Code debugging workflows
Debugging SQL code
PROMPT STRUCTURE
I want you to be a SQL programmer, here is a piece of SQL code
containing {problem} — {insert code snippet} — I am getting the following
error {insert error}. What is the reason for the bug?
Code explanation workflows
Python code explanation
PROMPT STRUCTURE
I want you to act as a code explainer in Python. I don't understand
this function. Can you please explain what it does, and provide an
example? {Insert function}
Code explanation workflows
R code explanation
PROMPT STRUCTURE
I want you to act as a code explainer in R. I don't understand
this function. Can you please explain what it does, and
provide an example? {Insert function}
Code explanation workflows
SQL code explanation
PROMPT STRUCTURE
I want you to act as a code explainer in SQL. I don't
understand this snippet. Can you please explain what it does,
and provide an example?
{Insert SQL query}
Code optimization workflows
Python code optimization
PROMPT STRUCTURE
I want you to act as a code optimizer in Python. {Describe
problem with current code, if possible}. Can you make the
code {more Pythonic/cleaner/more efficient/run faster/more
readable}? {Insert Code}
Code optimization workflows
R code optimization
PROMPT STRUCTURE
I want you to act as a code optimizer in R. {Describe problem with
current code, if possible}. Can you make the code {cleaner/more
efficient/run faster/more readable}? {Insert Code}
Code optimization workflows
SQL code optimization
PROMPT STRUCTURE
I want you to act as a query optimizer in SQL. {Describe problem
with current code, if possible}. Can you suggest ways to make the
query {run faster/more readable/simpler}? {Insert Code}
Code simplification workflows
Python code simplification
PROMPT STRUCTURE
I want you to act as a programmer in Python. Please simplify this
code while ensuring that it is {efficient/easy to read/Pythonic}?
{Insert Code}
Code simplification workflows
R code simplification
PROMPT STRUCTURE
I want you to act as a programmer in R. Please simplify this code
while ensuring that it is {efficient/easy to read}? {Insert Code}
Code simplification workflows
SQL code simplification
PROMPT STRUCTURE
I want you to act as a SQL programmer. I am running
{PostgreSQL 14/MySQL 8/SQLite 3.4/other versions.}. Can you
please simplify this query {while ensuring that it is efficient/
easy to read/insert any additional requirements}?
Code translation workflows
From R to Python code translation
PROMPT STRUCTURE
I want you to act as a programmer in R. Please translate this
code to Python. {Insert code}
Code translation workflows
From Python to R code translation
PROMPT STRUCTURE
I want you to act as a programmer in Python. Please translate
this code to R. {Insert code}
Code quality and testing workflows
Compare function speeds in python
PROMPT STRUCTURE
I want you to act as a Python programmer. Can you write
code that compares the speed of two functions {functionname}
and {functionname}? {Insert functions}
Code quality and testing workflows
Write unit tests in R
PROMPT STRUCTURE
I want you to act as a R Programmer. Can you please write unit
tests for the function {functionname}? {Insert requirements for
unit tests, if any} {Insert code}
Code quality and testing workflows
Write unit tests in Python
PROMPT STRUCTURE
I want you to act as a Python Programmer. Can you please
write unit tests for the function {functionname}? {Insert
requirements for unit tests, if any} {Insert code}
Prompts for
data analysis
workflows
SQL data analysis workflows
Data generation & creating tables
PROMPT STRUCTURE
I want you to act as a data generator. Can you write
SQL queries in {database version} that create a table
{table name} with the columns {column name}. Include
relevant constraints and index.
SQL data analysis workflows
Common table expressions
PROMPT STRUCTURE
I want you to act as a SQL code programmer. I
am running {database version}. Can you rewrite
this query using CTE? {Insert query}
SQL data analysis workflows
Write SQL queries from natural language
PROMPT STRUCTURE
I want you to act as a data scientist. {Insert
description of tables}. Can you {count/sum/take
average} of {value} which are {insert filters}
Example: Data aggregation in SQL
SQL data analysis workflows
Write SQL queries from natural language
PROMPT STRUCTURE
I want you to act as a data scientist. I am running {PostgreSQL 14/MySQL 8/
SQLite 3.4/other versions.}. I have the tables {table_name} which are {table
description}. The sales table consists of the columns {column names}. Can
you please write a query that finds the 7-day running average of {quantity}?
Example: 7 day running average in SQL
SQL data analysis workflows
Write SQL queries from natural language
PROMPT STRUCTURE
I want you to act as a data scientist. I am running {PostgreSQL
14/MySQL 8/SQLite 3.4/other versions.}. I have the tables
{table_name} which are {table description}. The sales table
consists of the columns {column names}. Can you please write
a query that finds {required window function}?
Example: Window functions in SQL
Python data analysis workflows
Data generation workflow
PROMPT STRUCTURE
I want you to act as a data generator in Python. Can you
generate a Markdown file that contains {data requirement}.
Save the file to {filename}
Example: Generate Markdown
Python data analysis workflows
Data generation workflow
PROMPT STRUCTURE
I want you to act as a data generator in Python. Can you
generate a CSV file that contains {data requirement}. Save
the file to {filename}
Example: Generate CSV
Python data analysis workflows
Data generation workflow
PROMPT STRUCTURE
I want you to act as a data generator in Python. Can you
generate a JSON file that contains {data requirement}.
Save the file to {filename}
Example: Generate JSON
Python data analysis workflows
Data cleaning workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in
Python Pandas. Given a CSV file that contains data of
{dataframe name} with the columns {colum names}
for {dataset context}, write code to clean the data?
{Insert requirements for data}
Python data analysis workflows
Data analysis workflow in pandas
PROMPT STRUCTURE
I want you to act as a data scientist programming in
Python Pandas. Given a table {table name} that
consists of the columns {column names} can you
please write a query that finds {requirement}?
Example: Data Aggregation
Python data analysis workflows
Data analysis workflow in pandas
PROMPT STRUCTURE Example: Data Merging
I want you to act as a data
scientist programming in
Python Pandas. Given a table
{table 1 name} that consists of
the columns {column names}
and another table {table 2
name} with the columns
{column names} , please
merge the two tables. {Insert
additional requirement, if any}
Python data analysis workflows
Data analysis workflow in pandas
PROMPT STRUCTURE Example: Data Reshaping
I want you to act as a data
scientist programming in
Python Pandas. Given a table
{table name} that consists of
the columns {column names}
can you aggregate the
{value} by {column} and
convert it from long to wide
format?
R data analysis workflows
Data generation workflow
PROMPT STRUCTURE Example: Generate Markdown
I want you to act as a data
generator in R. Can you
generate a Markdown file that
contains {data requirement}.
Save the file to {filename}
R data analysis workflows
Data generation workflow
PROMPT STRUCTURE
I want you to act as a data generator in R. Can
you generate a CSV file that contains {data
requirement}. Save the file to {filename}
Example: Generate CSV
R data analysis workflows
Data generation workflow
PROMPT STRUCTURE
I want you to act as a data generator in R. Can
you generate a JSON file that contains {data
requirement}. Save the file to {filename}
Example: Generate JSON
R data analysis workflows
Data cleaning workflow
PROMPT STRUCTURE
I want you to act as a data scientist
programming in R tidyr. You are given the
{dataframe name} dataframe containing the
columns {column name}. {Insert requirement}
R data analysis workflows
Data analysis workflow in tidyr
PROMPT STRUCTURE
I want you to act as a data scientist
programming in R tidyr. You are given the
{dataframe name} dataframe containing the
columns {column name}. {Insert requirement}
Example: Data Aggregation
R data analysis workflows
Data analysis workflow in tidyr
PROMPT STRUCTURE Example: Data Merging
I want you to act as a data scientist
programming in R tidyr. You are given
the {dataframe 1 name} dataframe
containing the columns {column name}.
You also have a {dataframe 2 name}
dataframe containing the columns
{column name}. Find the {required
output}
R data analysis workflows
Data analysis workflow in tidyr
PROMPT STRUCTURE
I want you to act as a data scientist
programming in R tidyr. You are given the
{dataframe name} dataframe containing the
columns {column name}. Please convert the
data to wide format.
Example: Data Reshaping (Long to Wide)
R data analysis workflows
Data analysis workflow in tidyr
PROMPT STRUCTURE Example: Data Reshaping (Wide to Long)
I want you to act as a data scientist
programming in R tidyr. You are given
the {dataframe name} dataframe
containing the columns {column
name}. Please convert the data to long
format.
Prompts for
data visualization
workflows
R data visualization workflows
Creating plots in ggplot2
PROMPT STRUCTURE
I want you to act as a data scientist
coding in R. Given a dataframe
{dataframe name} containing the
columns {column names} Use ggplot2
to plot a {chart type and requirement}.
R data visualization workflows
Gridplot visualizations in ggplot2
PROMPT STRUCTURE
I want you to act as a data scientist coding in R.
Given a dataframe {dataframe name} containing
the columns {column names}. Use ggplot2 to plot
a pair plot that shows the relationship of one
variable against another.
R data visualization workflows
Annotating and formatting plots
PROMPT STRUCTURE
I want you to act as a data scientist
coding in R. Given a dataframe
{dataframe name} containing the
columns {column names}, use ggplot2
to plot a {chart type} the relationship
between {variables}. {Insert annotation
and formatting requirements}
R data visualization workflows
Changing plot themes in ggplot2
PROMPT STRUCTURE
I want you to act as a data scientist coding in R. Given a
dataframe {dataframe name} containing the columns {column
names}, use ggplot2 to to plot a {chart type} the relationship
between {variables}. Change the color theme to match that of
{theme}
Python data visualization workflows
Creating plots with matplotlib
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a dataframe
{dataframe name} containing the
columns {column names} Use
matplotlib to plot a {chart type and
requirement}.
Python data visualization workflows
Crating pairplots with matplotlib
PROMPT STRUCTURE
I want you to act as a data scientist coding in Python. Given a
dataframe {dataframe name} containing the columns {column
names}. Use matplotlib to plot a pair plot that shows the
relationship of one variable against another.
Python data visualization workflows
Annotating and formatting plots in matplotlib
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a dataframe
{dataframe name} containing the
columns {column names}, use
matplotlib to to plot a {chart type} the
relationship between {variables}. {Insert
annotation and formatting
requirements}
Python data visualization workflows
Changing plot themes in matplotlib
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a dataframe
{dataframe name} containing the
columns {column names}, use
matplotlib to to plot a {chart type} the
relationship between {variables}.
Change the color theme to match that
of {theme}
Prompts for
machine learning
workflows
General machine learning workflow
Feature engineering ideation
PROMPT STRUCTURE
I want you to act as a data scientist.
Given a dataset of {dataset name} that
contains the {columns}, you are to
predict {predicted variable}. Suggest
data that will be helpful for this
problem and perform feature
engineering for this problem.
Python machine learning workflow
Model training workflow
PROMPT STRUCTURE
I want you to act as a data scientist
programming in Python. Given a
dataset of {dataframe name} that
contains the {column name}, write code
to predict {output variable}.
Python machine learning workflow
Hyperparameter tuning workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in Python.
Given a {type of model} model, write code to tune the
hyperparameter.
Example:
Python machine learning workflow
Model explainability workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in
Python. Given a {type of model} that predicts the
{predictor variable}, write code that explains an output
using Shap values.
Example:
R machine learning workflow
Model training workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in R.
Given a dataframe of {dataframe name} that contains
{column names}, write code to predict {output}.
Example: Train a classification model in R
R machine learning workflow
Hyperparameter tuning workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in R.
Given a {type of model} model, write code to tune the
hyperparameter.
Example:
R machine learning workflow
Model explainability workflow
PROMPT STRUCTURE
I want you to act as a data scientist programming in R .
Given a {type of model} that predicts the {predictor variable},
write code that explains an output using Shap values.
Example:
Prompts for time
series analysis
workflows
Python time series analysis workflows
Changing time horizons using pandas
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a time series
data in a Pandas dataframe
{dataframe name} with timestamp
Index in {original frequency} frequency
with one column {column name},
convert the timestamp frequency to
{desired frequency}.
Python time series analysis workflows
Build test series model
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a time series
data in a dataframe {dataframe name}
with timestamp Index in {original
frequency} frequency with one column
{column name}, build a forecasting
model, assuming data is stationary.
Python
Promptstime seriesSeries
for Time analysis workflows
Workflows
Perform stationarity test
PROMPT STRUCTURE
I want you to act as a data scientist
coding in Python. Given a time series
data in a dataframe {dataframe name}
with timestamp Index in {original
frequency} frequency with one column
{column name}, perform a Dicky Fuller
test.
R time series analysis workflows
Changing time horizons
PROMPT STRUCTURE
I want you to act as a data scientist
coding in R. Given a time series data in
a dataframe {dataframe name} with
timestamp Index in {original frequency}
frequency with one column {column
name}, convert the timestamp
frequency to {desired frequency}
R time series analysis workflows
Build test series model
PROMPT STRUCTURE
I want you to act as a data scientist
coding in R. Given a time series data in
a dataframe {dataframe name} with
timestamp Index in {original frequency}
frequency with one column {column
name}, build a forecasting model,
assuming data is stationary.
R time series analysis workflows
Perform stationarity test
PROMPT STRUCTURE
I want you to act as a data scientist
coding in R. Given a time series data in
a dataframe {dataframe name} with
timestamp Index in {original frequency}
frequency with one column {column
name}, perform a Dicky Fuller test.
Prompts for
natural language
processing
workflows
Prompts for natural language processing workflows
Classify text sentiment
PROMPT STRUCTURE
I want you to act as a sentiment classifier. Classify the
following text which came from {describe text origin} as
“positive”, “negative”, “neutral” or “unsure”: {Insert text
to be classifier}
Prompts for natural language processing workflows
Create regular expressions
PROMPT STRUCTURE
I want you to act as a programmer coding in Python,
use regular expressions to test if a string {insert
requirements}
Prompts for natural language processing workflows
Text dataset generation
PROMPT STRUCTURE
I want you to act as a dataset generator. Please
generate {number of text} texts on {required text and
the context}. {Insert additional requirements}
Prompts for natural language processing workflows
Machine translation
PROMPT STRUCTURE
I want you to act as a translator. Please translate {phrase} from
{origin language} to {translated language}.
Conceptual and
career oriented
prompts
Conceptual and career oriented prompts
Explain data concepts for business executives
PROMPT STRUCTURE
I want you to act as a data scientist of a corporate
company. {Describe content in detail, if required} Please
explain to a business executive what {concept} means.
Conceptual and career oriented prompts
Summarize article/paper
PROMPT STRUCTURE
I want you to act as a data scientist in
a research start-up. Please explain the
paper {paper} to a {level of difficulty,
e.g. software developer, five-year-old,
business executive, professor}.
Conceptual and career oriented prompts
Suggest portfolio projects and ideas
PROMPT STRUCTURE
I want you to act as a data science
career coach. I am a {describe your
background} and I would like to
{describe career objective}. Suggest
portfolio projects and ideas {describe
objective of portfolio}
Conceptual and career oriented prompts
Write tutorials
PROMPT STRUCTURE
I want you to act as a data scientist writer. Please write
the {number-of-words}-word introduction to a tutorial on
{title}. {Insert relevant key points}.