Canonical csv parser?

polaris · · 369 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Is there a canonical csv parser in golang with a wide variety of configurable settings (similar to pandas.read_csv <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html" rel="nofollow">https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html</a>)? It seems like the encoding/csv lib covers some of variations in csv format, but there are other options that I think are pretty standard (header/footer lines for example)</p> <hr/>**评论:**<br/><br/>shovelpost: <pre><p>The standard library CSV package implements RFC 4180. For variations and other stuff not included in the spec you&#39;ll either have to do <a href="https://github.com/golang/go/issues/12755#issuecomment-150670079" rel="nofollow">some manual work</a> yourself or look for a 3rd party CSV package like <a href="https://github.com/gocarina/gocsv" rel="nofollow">this</a>.</p></pre>unimportant1234567: <pre><p>I just use this: <a href="https://play.golang.org/p/RyqIVv-0vP" rel="nofollow">https://play.golang.org/p/RyqIVv-0vP</a></p> <p>the commented out line is if you have CR+LF line endings.</p> <p>You might also want to look at <a href="https://aadrake.com/posts/2017-05-29-faster-command-line-tools-with-go.html" rel="nofollow">https://aadrake.com/posts/2017-05-29-faster-command-line-tools-with-go.html</a> if you need to parse super large files.</p></pre>clogg: <pre><p><a href="https://github.com/maxim2266/csvplus" rel="nofollow">This</a> one can handle headers.</p></pre>sbinet: <pre><p>mine can do headers too:</p> <ul> <li><a href="https://godoc.org/go-hep.org/x/hep/csvutil/csvdriver" rel="nofollow">https://godoc.org/go-hep.org/x/hep/csvutil/csvdriver</a></li> <li><a href="https://github.com/go-hep/hep/blob/master/csvutil/csvdriver/driver_test.go#L139" rel="nofollow">https://github.com/go-hep/hep/blob/master/csvutil/csvdriver/driver_test.go#L139</a></li> </ul> <p>(and you can send SQL queries against it)</p></pre>sbinet: <pre><p>and there&#39;s also the panda inspired dataframe package for Go as well:</p> <ul> <li><a href="http://godoc.org/github.com/kniren/gota/dataframe" rel="nofollow">http://godoc.org/github.com/kniren/gota/dataframe</a></li> </ul></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

369 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传