Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Python Snippets For Data ScienceNew to Visual Studio Code? Get it now.
Python Snippets For Data Science

Python Snippets For Data Science

Sunil Yadav

|
9,183 installs
| (1) | Free
Data Science Snippets for Python
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Python Snippets For Data Science

COVID19: Wear Mask, Keep distance, Stay Home, Stay Safe

Thank you for using these snippets, hope they make your coding faster, welcome your feedback!!!

- Classification Snippets included
- Clustering, Dimensionality Reduction, Association Rules(Recommender Systems),Deep Learning, Reinforcement Learning etc.. will come soon.

Get all great Python and Azure extension here

    TRICKS 🔔
  1. For Machine learning start type `ml` list of available snippets will appear then navigate to desired snippet

Snippets Naming Convention*

  • Machine Learning (Using scikit-learn) for most of snippets
    • Supervised Machine Learning
      • Snippets will start with ml
      • If it is for Regression then -r suffix will be added
      • If it is for Classification then -c suffix will be added (Coming Soon!!!)
      • Final will approach for example:
        • -slr ==> Linear Regression - Single Variable
        • -mlr ==> Linear Regression - Multiple Variables

So for simle linear regression snippet will be ml-r-slr. See available snippets below

  • Pandas
    • Snippets will start with p
  • Cell Creation in Python file
    • Snippets will start with c

List of available snippets:


Machine Learning Snippets

Regression

Snippet Key Description
ml-r-slr Simple Linear Regression
ml-r-mlr Multiple Linear Regression
ml-r-ply Polynomial Regression
ml-r-svr SVM Regressor with RBF kernel
ml-r-dtr Decision Tree Regressor
ml-r-rfr Random Forest Regressor

Classification

Snippet Key Description
ml-c-lr Logistic Regression Classification
ml-c-knn K-Nearest Neighbors (K-NN) Classification
ml-c-svm Support Vector Machine (SVM) Classification
ml-c-ksvm Kernel SVM Classification
ml-c-gnb Gaussian Naive Bayes
ml-c-mnb Multinomial Naive Bayes
ml-c-dtc Decision Tree Classification
ml-c-rfc Random Forest Classification

Pandas Dataframe snippets

Snippet Key Description
pd Import numpy, pandas and create a data frame from csv file
pp Above + matplotlib.pyplot
ps Above + seborn

Python File/Interactive window snippets

Snippet Key Description
c Create Cell (# %%)
cc Create Markdown cell(# %% [markdown])

Miscelanious

Snippet Key Description
r Ref Line

Requirements

You must be in python file.

Extension Settings

NA

Known Issues

NA

Release Notes

0.0.0.3-4

Adding snippets for Python File/Interactive window snippets

0.0.0.2

Message added in readme file

0.0.0.1

Initial release of Python Snippets For Data Science


Credits:

  • *Many (not all) Naming conventions and code flow are inspired from udemy course [Machine Learning A-Z™: Hands-On Python & R In Data Science] (https://www.udemy.com/course/machinelearning/), as I learned from it found very intuitive - Though we don't have any business deal ;)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft