str-data-frame

0.9.1 • Public • Published

Pandas like data-frame

This is an NPM package (Javascript), package name str-data-frame

Link to interactive data frame totorial

Installation

npm install --save str-data-frame

in your code import or require the package

const ff = require("str-data-frame")

Code Mirror Auto complete

<link rel="stylesheet" href="https://codemirror.net/addon/hint/show-hint.css">
<script src="https://codemirror.net/addon/hint/show-hint.js"></script>

The javascript code

const editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
  mode: "javascript",
  lineNumbers: true,
  extraKeys: { "Ctrl-Space": "autocomplete" },
});

// Custom autocomplete function
function customHint(editor) {
  const cursor = editor.getCursor();
  const token = editor.getTokenAt(cursor);
  const start = token.start;
  const end = cursor.ch;
  const word = token.string;
  
  // Define your custom completion options
  const list = ["function", "const", "let", "var", "console.log"].filter(item =>
    item.startsWith(word)
  );

  return {
    list: list,
    from: CodeMirror.Pos(cursor.line, start),
    to: CodeMirror.Pos(cursor.line, end)
  };
}

// Attach custom hinting function
editor.on("inputRead", function(cm, change) {
  if (change.text[0].match(/\w/)) {
    cm.showHint({ hint: customHint });
  }
});

Package Functionalty

This is a utility library providing the following category of functionality

  • Pandas (python) like data frame

    • This allows you CSV like tabular data like an in memory databse table
  • Loading and and initializing data from CSV and tsv files

  • Filtering and sorting data

  • Array processing utilities

  • Frame processing

    • Group by functionality (on multiple columns)
      • Aggrigation functions supported
        • max - maximun value from the aggridated list
        • min - minumum value from the aggridated list
        • sum - sum of the numeric values in the aggrigated list
        • mean - mean of the numeric values
        • StdDev - standard deviation of the numeric values
    • SQL like Equality join of two frames
      • Inner join
      • Left join
      • Right join
  • Some general string processing and onject utilities

Sections

  • array

    • arrayutils
    • flatten
    • intset
    • prod - vector products
  • frame

    • colutils
    • frame ^
    • frame_element
    • frequency

TODO:

Readme

Keywords

none

Package Sidebar

Install

npm i str-data-frame

Weekly Downloads

2

Version

0.9.1

License

ISC

Unpacked Size

488 kB

Total Files

168

Last publish

Collaborators

  • nurulc