且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

相当于JavaScript中的Python Pandas

更新时间:2022-05-03 10:01:52

所有答案都很好.希望我的回答很全面(即尝试列出所有所有选项).我希望以任何标准返回并修改此答案,以帮助做出选择.

All answers are good. Hoping my answer is comprehensive (i.e. tries to list all options). I hope to return and revise this answer with any criteria to help make a choice.

我希望任何来这里的人都熟悉d3. d3是用于处理Javascript数据的非常有用的瑞士军刀",例如pandas对Python很有帮助.您可能会看到d3pandas一样经常使用,即使d3不是完全替代DataFrame/Pandas (即d3没有相同的API; d3也没有没有Series/DataFrame的行为类似于pandas)

I hope anyone coming here is familiar with d3. d3 is very useful "swiss army knife" for handling data in Javascript, like pandas is helpful for Python. You may see d3 used frequently like pandas, even if d3 is not exactly a DataFrame/Pandas replacement (i.e. d3 doesn't have the same API; d3 doesn't have Series / DataFrame which behave like in pandas)

Ahmed的答案说明了如何使用d3 来实现某些DataFrame功能,并且下面的某些库受到了启发像 LearnJsData 一样,它使用d3lodash.

Ahmed's answer explains how d3 can be used to achieve some DataFrame functionality, and some of the libraries below were inspired by things like LearnJsData which uses d3 and lodash.

关于DataFrame-focused-features,我对帮助的JS库不知所措.以下是您可能遇到的一些选项的快速列表.我尚未详细检查其中的任何一项(大多数是在Google + NPM搜索中找到的).

As for DataFrame-focused-features , I was overwhelmed with JS libraries which help. Here's a quick list of some of the options you might've encountered. I haven't checked any of them in detail yet (Most I found in combination Google + NPM search).

请谨慎使用可以使用的多种工具;有些是Node.js(又名服务器端Javascript),有些是与浏览器兼容的又名客户端Javascript.有些是打字稿.

Be careful you use a variety that you can work with; some are Node.js aka Server-side Javascript, some are browser-compatible aka client-side Javascript. Some are Typescript.

  • pandas-js
    • 来自菲拉斯的答案
    • "pandas.js是模仿Python pandas库的开源(实验)库.它依赖Immutable.js作为NumPy逻辑等效项.pandas.js中的主要数据对象与Python pandas一样,是Series和DataFrame."
    • pandas-js
      • From STEEL and Feras' answers
      • "pandas.js is an open source (experimental) library mimicking the Python pandas library. It relies on Immutable.js as the NumPy logical equivalent. The main data objects in pandas.js are, like in Python pandas, the Series and the DataFrame."
      • "DataFrame-js为JavaScript和数据科学提供了一个不变的数据结构,即DataFrame,它允许使用sql和受函数编程启发的api处理行和列."
      • Seen in Ashley Davis' answer
      • "JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ."
      • Note the old data-forge JS repository is no longer maintained; now a new repository uses Typescript
      • "Jsdataframe是一个JavaScript数据整理库,受到R和Python Pandas中数据框功能的启发."
      • 通过分组和归约来探索数据."

      然后在遇到这个问题之后,在这里检查其他答案并进行更多搜索后,我发现了类似的选项:

      Then after coming to this question, checking other answers here and doing more searching, I found options like:

      • JS中的Apache Arrow
        • 感谢用户Back2Basics的建议:
        • "Apache Arrow是用于对平面和嵌套数据的矢量和表状容器进行编码的列式内存布局规范.ApacheArrow是大型内存列式数据(Spark, Pandas ,钻孔,图形学,...)"
        • Apache Arrow in JS
          • Thanks to user Back2Basics suggestion:
          • "Apache Arrow is a columnar memory layout specification for encoding vectors and table-like containers of flat and nested data. Apache Arrow is the emerging standard for large in-memory columnar data (Spark, Pandas, Drill, Graphistry, ...)"
          • 乍一看,它似乎是IPython/Jupyter的JS替代品笔记本"
          • Observable的页面承诺:"Web平台"上的反应性编程",社区"
          • 请参见5分钟简介此处
          • At first glance, seems like a JS alternative to the IPython/Jupyter "notebooks"
          • Observable's page promises: "Reactive programming", a "Community", on a "Web Platform"
          • See 5 minute intro here
          • 我期望强调DataFrame的API,Pandas本身试图从R保留 更多示例
          • ...或强调其 MVC架构;包括后端内容(即数据库连接)
          • 我可能太苛刻了;毕竟,熊猫的优点之一就是它如何轻松地创建可视化效果.盒子外面.
          • I expected an emphasis on DataFrame's API, which Pandas itself tries to preserve from R document its replacement/improvement/correspondence to every R function.
          • Instead I find an emphasis recline's example emphasizes the jQuery way of getting data into the DOM its (awesome) Multiview (the UI), which doesn't require jQuery but does require a browser! More examples
          • ...or an emphasis on its MVC-ish architecture; including back-end stuff (i.e. database connections)
          • I am probably being too harsh; after all, one of the nice things about pandas is how it can create visualizations easily; out-of-the-box.
          • 更多的是 ORM !大多数其模块对应于不同的数据存储问题(js-data-mongodbjs-data-redisjs-data-cloud-datastore),排序,过滤等
          • 从正面来看,Node.js确实可以优先处理; 在Node.js和浏览器中工作."
          • Really more of an ORM! Most of its modules correspond to different data storage questions (js-data-mongodb, js-data-redis, js-data-cloud-datastore), sorting, filtering, etc.
          • On plus-side does work on Node.js as a first-priority; "Works in Node.js and in the Browser."

          我希望这篇文章可以成为社区Wiki,并根据不同的标准进行评估(即比较上面的不同选项):

          I hope this post can become a community wiki, and evaluate (i.e. compare the different options above) against different criteria like:

          • Panda在其 R比较 中的标准
            • 性能
            • 功能/灵活性
            • 易用性
            • Panda's criterias in its R comparison
              • Performance
              • Functionality/flexibility
              • Ease-of-use
              • 与Pandas/Dataframe API的相似性
              • 专门针对其主要功能
              • 数据科学重点> UI重点
              • 展示了与其他工具(如Jupyter)结合使用的集成 (交互式笔记本)等
              • Similarity to Pandas / Dataframe API's
              • Specifically hits on their main features
              • Data-science emphasis > UI emphasis
              • Demonstrated integration in combination with other tools like Jupyter (interactive notebooks), etc

              JS库可能永远都做不到(但是可以吗?)

              Some things a JS library may never do (but could it?)

              • 使用的是一流的Javascript数字/数学库的基础框架吗? (即等效于 NumPy )
              • 使用任何可能导致更快代码编写的优化/编译器(即,相当于Pandas使用 Cython )
                • Use an underlying framework that is best-in-class Javascript numbers/math library? (i.e. an equivalent of a NumPy)
                • Use any optimizing/compilers that might result in faster code (i.e. an equivalent of Pandas' use of Cython)
                  • On the relation between above NumPy and Cython and here and here