{"id":13484026,"url":"https://github.com/javascriptdata/danfojs","last_synced_at":"2025-05-14T11:10:02.406Z","repository":{"id":39291438,"uuid":"263751330","full_name":"javascriptdata/danfojs","owner":"javascriptdata","description":"Danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.","archived":false,"fork":false,"pushed_at":"2024-07-08T17:05:40.000Z","size":84029,"stargazers_count":4807,"open_issues_count":121,"forks_count":209,"subscribers_count":31,"default_branch":"dev","last_synced_at":"2024-11-27T09:17:26.886Z","etag":null,"topics":["danfojs","data-analysis","data-analytics","data-manipulation","data-science","dataframe","javascript","pandas","plotting-charts","stream-data","stream-processing","table","tensorflow","tensors"],"latest_commit_sha":null,"homepage":"https://danfo.jsdata.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javascriptdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"danfojs"}},"created_at":"2020-05-13T21:53:26.000Z","updated_at":"2024-11-27T02:10:34.000Z","dependencies_parsed_at":"2024-08-02T19:01:11.771Z","dependency_job_id":"9c4a2655-54aa-4296-b39a-90d6dd9398f5","html_url":"https://github.com/javascriptdata/danfojs","commit_stats":null,"previous_names":["opensource9ja/danfojs"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascriptdata%2Fdanfojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascriptdata%2Fdanfojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascriptdata%2Fdanfojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascriptdata%2Fdanfojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javascriptdata","download_url":"https://codeload.github.com/javascriptdata/danfojs/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226210,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["danfojs","data-analysis","data-analytics","data-manipulation","data-science","dataframe","javascript","pandas","plotting-charts","stream-data","stream-processing","table","tensorflow","tensors"],"created_at":"2024-07-31T17:01:18.215Z","updated_at":"2025-05-14T11:10:02.384Z","avatar_url":"https://github.com/javascriptdata.png","language":"TypeScript","readme":"\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/logo.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n-----------------\n\n## Danfojs: powerful javascript data analysis toolkit \n![Node.js CI](https://github.com/opensource9ja/danfojs/workflows/Node.js%20CI/badge.svg?branch=master)\n[![](https://data.jsdelivr.com/v1/package/npm/danfojs/badge?style=rounded)](https://www.jsdelivr.com/package/npm/danfojs)\n[![Coverage Status](https://coveralls.io/repos/github/opensource9ja/danfojs/badge.svg)](https://coveralls.io/github/opensource9ja/danfojs)\n![Twitter](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Ftwitter.com%2FDanfoJs) \n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://www.patreon.com/bePatron?u=40496758\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n## What is it?\n\n**Danfo.js** is a javascript package that provides fast, flexible, and expressive data\nstructures designed to make working with \"relational\" or \"labeled\" data both\neasy and intuitive. It is heavily inspired by [Pandas](https://pandas.pydata.org/pandas-docs/stable/) library, and provides a similar API. This means that users familiar with [Pandas](https://pandas.pydata.org/pandas-docs/stable/), can easily pick up danfo.js. \n\n## Main Features\n\n  - Danfo.js is fast and supports Tensorflow.js tensors out of the box. This means you can [convert Danfo data structure](https://danfo.jsdata.org/api-reference/dataframe/dataframe.tensor) to Tensors.\n  - Easy handling of [missing-data](https://danfo.jsdata.org/getting-started#missing-data) (represented as\n    `NaN`) in floating point as well as non-floating point data\n  - Size mutability: columns can be [inserted/deleted](https://danfo.jsdata.org/api-reference/dataframe#combining-comparing-joining-merging) from DataFrame\n  - Automatic and explicit [alignment](https://danfo.jsdata.org/api-reference/dataframe#reindexing-selection-label-manipulation): objects can\n    be explicitly aligned to a set of labels, or the user can simply\n    ignore the labels and let `Series`, `DataFrame`, etc. automatically\n    align the data for you in computations\n  - Powerful, flexible [groupby](https://danfo.jsdata.org/api-reference/groupby) functionality to perform\n    split-apply-combine operations on data sets, for both aggregating\n    and transforming data\n  - Make it easy to convert Arrays, JSONs, List or Objects, Tensors and \n    differently-indexed data structures\n    into DataFrame objects\n  - Intelligent label-based [slicing](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.loc), [fancy indexing](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.iloc), and [querying](https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.query) of\n    large data sets\n  - Intuitive [merging](https://danfo.jsdata.org/api-reference/general-functions/danfo.merge) and [joining](https://danfo.jsdata.org/api-reference/general-functions/danfo.concat) data\n    sets\n  - Robust IO tools for loading data from [flat-files](https://danfo.jsdata.org/api-reference/input-output)\n    (CSV, Json, Excel).\n  - Powerful, flexible and intutive API for [plotting](https://danfo.jsdata.org/api-reference/plotting) DataFrames and Series interactively.\n  - [Timeseries](https://danfo.jsdata.org/api-reference/series#accessors)-specific functionality: date range\n    generation and date and time properties. \n  - Robust data preprocessing functions like [OneHotEncoders](https://danfo.jsdata.org/api-reference/general-functions/danfo.onehotencoder), [LabelEncoders](https://danfo.jsdata.org/api-reference/general-functions/danfo.labelencoder), and scalers like [StandardScaler](https://danfo.jsdata.org/api-reference/general-functions/danfo.standardscaler) and [MinMaxScaler](https://danfo.jsdata.org/api-reference/general-functions/danfo.minmaxscaler) are supported on DataFrame and Series\n\n\n## Installation\nThere are three ways to install and use Danfo.js in your application\n* For Nodejs applications, you can install the [__danfojs-node__]() version via package managers like yarn and/or npm:\n\n```bash\nnpm install danfojs-node\n\nor\n\nyarn add danfojs-node\n```\nFor client-side applications built with frameworks like React, Vue, Next.js, etc, you can install the [__danfojs__]() version:\n\n```bash\nnpm install danfojs\n\nor\n\nyarn add danfojs\n```\n\nFor use directly in HTML files, you can add the latest script tag from [JsDelivr](https://www.jsdelivr.com/package/npm/danfojs) to your HTML file:\n\n```html\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/danfojs@1.1.2/lib/bundle.js\"\u003e\u003c/script\u003e\n```\nSee all available versions [here](https://www.jsdelivr.com/package/npm/danfojs)\n\n### Quick Examples\n* [Danfojs with HTML and vanilla JavaScript on CodePen](https://codepen.io/risingodegua/pen/bGpwyYW)\n* [Danfojs with React on Code Sandbox](https://codesandbox.io/s/using-danfojs-in-react-dwpv54?file=/src/App.js)\n* [Danfojs on ObservableHq](https://observablehq.com/@risingodegua/using-danfojs-on-observablehq)\n* [Danfojs in Nodejs on Replit](https://replit.com/@RisingOdegua/Danfojs-in-Nodejs)\n\n### Example Usage in the Browser\n```html\n\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/danfojs@1.1.2/lib/bundle.js\"\u003e\u003c/script\u003e\n\n    \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    \u003cdiv id=\"div1\"\u003e\u003c/div\u003e\n    \u003cdiv id=\"div2\"\u003e\u003c/div\u003e\n    \u003cdiv id=\"div3\"\u003e\u003c/div\u003e\n\n    \u003cscript\u003e\n\n      dfd.readCSV(\"https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv\")\n          .then(df =\u003e {\n\n              df['AAPL.Open'].plot(\"div1\").box() //makes a box plot\n\n              df.plot(\"div2\").table() //display csv as table\n\n              new_df = df.setIndex({ column: \"Date\", drop: true }); //resets the index to Date column\n              new_df.head().print() //\n              new_df.plot(\"div3\").line({\n                  config: {\n                      columns: [\"AAPL.Open\", \"AAPL.High\"]\n                  }\n              })  //makes a timeseries plot\n\n          }).catch(err =\u003e {\n              console.log(err);\n          })\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n```\n\nOutput in Browser:\n\n![](assets/browser-out.gif)\n\n### Example usage in Nodejs\n\n```javascript\nconst dfd = require(\"danfojs-node\");\n\nconst file_url =\n  \"https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv\";\ndfd\n  .readCSV(file_url)\n  .then((df) =\u003e {\n    //prints the first five columns\n    df.head().print();\n\n    // Calculate descriptive statistics for all numerical columns\n    df.describe().print();\n\n    //prints the shape of the data\n    console.log(df.shape);\n\n    //prints all column names\n    console.log(df.columns);\n\n    // //prints the inferred dtypes of each column\n    df.ctypes.print();\n\n    //selecting a column by subsetting\n    df[\"Name\"].print();\n\n    //drop columns by names\n    let cols_2_remove = [\"Age\", \"Pclass\"];\n    let df_drop = df.drop({ columns: cols_2_remove, axis: 1 });\n    df_drop.print();\n\n    //select columns by dtypes\n    let str_cols = df_drop.selectDtypes([\"string\"]);\n    let num_cols = df_drop.selectDtypes([\"int32\", \"float32\"]);\n    str_cols.print();\n    num_cols.print();\n\n    //add new column to Dataframe\n\n    let new_vals = df[\"Fare\"].round(1);\n    df_drop.addColumn(\"fare_round\", new_vals, { inplace: true });\n    df_drop.print();\n\n    df_drop[\"fare_round\"].round(2).print(5);\n\n    //prints the number of occurence each value in the column\n    df_drop[\"Survived\"].valueCounts().print();\n\n    //print the last ten elementa of a DataFrame\n    df_drop.tail(10).print();\n\n    //prints the number of missing values in a DataFrame\n    df_drop.isNa().sum().print();\n  })\n  .catch((err) =\u003e {\n    console.log(err);\n  });\n\n```\nOutput in Node Console:\n\n![](assets/node-rec.gif)\n## Notebook support\n* VsCode nodejs notebook extension now supports Danfo.js. See guide [here](https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook)\n* ObservableHQ Notebooks. See example notebook [here](https://observablehq.com/@risingodegua/using-danfojs-on-observablehq)\n\n#### [See the Official Getting Started Guide](https://danfo.jsdata.org/getting-started)\n\n## Documentation\nThe official documentation can be found [here](https://danfo.jsdata.org)\n\n## Discussion and Development\nDevelopment discussions take place [here](https://github.com/opensource9ja/danfojs/discussions). \n\n## Contributing to Danfo\nAll contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. A detailed overview on how to contribute can be found in the [contributing guide](https://danfo.jsdata.org/contributing-guide).\n\n#### Licence [MIT](https://github.com/opensource9ja/danfojs/blob/master/LICENCE)\n","funding_links":["https://patreon.com/danfojs","https://www.patreon.com/bePatron?u=40496758"],"categories":["TypeScript","node.js/javascript"],"sub_categories":["collection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascriptdata%2Fdanfojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavascriptdata%2Fdanfojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascriptdata%2Fdanfojs/lists"}