Paste as ... dataframe

This VS Code extension allows you to quickly transform any text table from your clipboard into a dataframe object in your favorite language — R , Python , Julia or JavaScript

Pastum adds commands to your command palette and right-click context menu, so you can paste any text table from your clipboard into the editor as a dataframe object of your framework of choice. It ships with recognition of float, integer, and strings types and built-in support of pandas, polars, tibble, data.table and DataFrames.jl.

Paste as "..." your way

No matter who you are, whether you are an advocate of using a pointing device (i.e., computer mouse) or a fan of keybindings, Pastum has options for all of you. With the right-click context menu inside the editor window, you can call the "Paste as default dataframe" command, which can be configured in the settings to use with your preferred language-framework pair (e.g., Python-Pandas or R-tibble). If you often switch between languages and want more control, the command palette (Ctrl/Cmd+Shift+P) has a set of commands that allow you to select the language and framework on the go.

Pastum context menu and command palette commands

Examples

With Pastum, you can copy any table from the internet, MS Excel, or MS Word and paste it as a dataframe object. Here is an example of transforming table from the Wikipedia page about Palmerston North into a tibble::tribble() (or transposed tibble) object in R.

Pastum is capable of detecting the main value types: strings (or character vectors in R), integer, and float. A numeric column is considered to be float if at least one of the values is float. Otherwise, the entire column will be treated as integer. By default, trailing zeroes are added to all float values to comply with polars rules (i.e., numeric values c(1, 2, 3, 4.5) are transformed to c(1.0, 2.0, 3.0, 4.5)).

Pastum example. Copy wikipedia table and paste as tibble in R.

Paste from Wikipedia as ...


tibble::tribble(
  ~Nationality,    ~Population2018,
  "England",       2748L,          
  "India",         1539L,          
  "China",         1440L,          
  "Australia",     1155L,          
  "South Africa",  903L,           
  "Philippines",   693L,           
  "Fiji",          528L,           
  "United States", 468L,           
  "Samoa",         441L,           
  "Malaysia",      390L
)
              

data.frame(
  Nationality = c("England", "India", "China", "Australia", "South Africa", "Philippines", "Fiji", "United States", "Samoa", "Malaysia"),
  Population2018 = c(2748L, 1539L, 1440L, 1155L, 903L, 693L, 528L, 468L, 441L, 390L)
)
              

import pandas as pd

pd.DataFrame({
    "Nationality": ["England", "India", "China", "Australia", "South Africa", "Philippines", "Fiji", "United States", "Samoa", "Malaysia"],
    "Population2018": [2748, 1539, 1440, 1155, 903, 693, 528, 468, 441, 390]
})
              

import {table} from "arquero";

const df = table({
    "Nationality": ["England", "India", "China", "Australia", "South Africa", "Philippines", "Fiji", "United States", "Samoa", "Malaysia"],
    "Population2018": [2748, 1539, 1440, 1155, 903, 693, 528, 468, 441, 390]
});
              

using DataFrames

DataFrame(
    :Nationality => ["England", "India", "China", "Australia", "South Africa", "Philippines", "Fiji", "United States", "Samoa", "Malaysia"],
    :Population2018 => [2748, 1539, 1440, 1155, 903, 693, 528, 468, 441, 390]
)
              
Pastum configuration options

Configuration

Pastum offers a variety of options and features to match your preferences. Just go to extension settings @ext:atsyplenkov.pastum

  • Turn on/off the context menu command by toggling pastum.showContextMenu option

  • Choose the default language-framework pair for easy and fast pasting using the context menu or keybinding.

  • By default, the column names are renamed following the PascalCase convention. However, the user can specify the preferred naming convention in the settings — pastum.defaultConvention.

  • Users can control the decimal separator (e.g., '.' in 12.45) and the digit group separator (i.e., in numbers over 999) through the pastum.decimalPoint config. By default, it is set up for a dot (.) as the decimal separator and a comma (,) as the group separator.

Get Started

Pastum is available for download from the Open VSX Registry, VS Marketplace, or from GitHub.

You can manually install it from inside VS Code, go to the extensions view either by executing the View: Show Extensions command (click View → Command Palette...) or by clicking on the extension icon on the left side of the VS Code window. In the extensions view, simply search for the term pastum in the marketplace search box, then select the extension named Pastum and click the install button.

Open VSX Registry

Install Rating & Reviews

VS Marketplace

Install Rating & Reviews