如何在.bson文件中导入数据 [英] How to Import Data in .bson File

查看:512
本文介绍了如何在.bson文件中导入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想导入此处的数据: https://thecodebarbarian.wordpress.com/2014/02/14/crunching-30-years-of-nba-data-with-mongodb-aggregation/ (你可以在结论部分下载数据到底部。

I would like to import the data found here: https://thecodebarbarian.wordpress.com/2014/02/14/crunching-30-years-of-nba-data-with-mongodb-aggregation/ (you can download the data towards the bottom in the Conclusion section).

数据有两个文件。首先,名为 games.metadata.json 的文件。完整的内容如下:

The data comes in two files. First, a file called games.metadata.json. The complete contents is here:

{ "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "nba.games", "name" : "_id_" } ] }

另一个文件名为 games.bson

此档案的样本是:

@_idRÚüë›ΩuT
∫mÆboxd0´
players»    0‡ast   blkdrbfgfg3fg3_pctfg3afg_pct.533fgaftft_pct.750ftamp41:00orbpfplayerJeff Rulandptsstltovtrb1„astblkdrbfg    fg3fg3_pctfg3afg_pct.643fgaftft_pct.667ftamp36:00orbpfplayerCliff Robinsonptsstltovtrb2Êastblkdrbfgfg3fg3_pct.000fg3afg_pct.571fgaftft_pct1.000ftamp30:00orbpfplayer
Gus Williamsptsstltovtrb3‡astblkdrbfgfg3fg3_pctfg3afg_pct.533fgaftft_pct.667ftamp30:00orbpfplayerJeff Maloneptsstltovtrb4„astblkdrbfgfg3fg3_pctfg3afg_pct.250fgaftft_pct1.000ftamp25:00orbpfplayerCharles Jonesptsstltovtrb5„astblkdrbfgfg3fg3_pctfg3afg_pct.000fgaftft_pct.500ftamp26:00orbpfplayerDan Roundfieldptsstltovtrb6‡astblkdrbfgfg3fg3_pctfg3afg_pct.750fgaftft_pct1.000ftamp20:00orbpf

有关如何将其纳入Stata的任何提示?

Any tips of how to get this into Stata?

推荐答案

我害怕你必须按照几个步骤

i am afraid you have to follow several steps


  1. 将您的数据从bson转换为csv

  2. 导出csv

  3. 在Stata中加载csv

  4. 做你的东西

  1. convert your data from bson to csv
  2. export the csv
  3. load the csv in Stata
  4. do your stuff

根据我的经验 insheetjson (Dimitri的好建议)对于中型数据集来说非常慢。

In my experience insheetjson (Dimitri's nice suggestion) is awfulfy slow for mid sized datasets.

这篇关于如何在.bson文件中导入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆