在八度中读取文本/数字混合CSV文件作为表格 [英] Reading text/number mixed CSV files as tables in Octave

查看:90
本文介绍了在八度中读取文本/数字混合CSV文件作为表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

八度音阶中是否有一种简单的方法可以从csv中以与R中的数据帧类似的数据结构加载数据?我尝试使用csvread dlmread,但是octave继续读取测试虚数,再加上我想将列标题作为引用.我看到网上有一些例子,它们看起来太扭曲了,怎么可能没有函数或类似于R的数据框?我说的是一个名为dataframe的程序包,但我似乎无法弄清楚它是如何工作的.有提示或建议吗?

is there an easy way in octave to load data from a csv in a data structure similar to dataframes in R? I tries csvread dlmread but octave keeps reading test a imaginary numbers, plus I'd like to have column's headers as references. I saw that there are some examples online which see way too twisted, how is it possible that there is not a function or something similar to dataframe of R? I say a package called dataframe but I can't seem to figure out how it works. Any tip or suggestion?

csvread('x') %returns 1 column imaginary numbers
dlmread('x') %returns N columns imaginary numbers

有其他可行的选择吗?

推荐答案

为什么无法使数据框包正常工作?你需要更具体.这是一个简单的示例:

Why are you unable to make the dataframe package work? You need to be more specific. Here's a simple example:

$ cat cars.csv 
Year,Make,Model
1997,Ford,E350
2000,Mercury,Cougar

$ octave
octave-cli-3.8.2:1> pkg load dataframe
octave-cli-3.8.2:2> cars = dataframe ("cars.csv")
cars = dataframe with 2 rows and 3 columns
Src: cars.csv                             
_1   Year    Make  Model                  
Nr double    char   char                  
 1   1997    Ford   E350                  
 2   2000 Mercury Cougar   

这篇关于在八度中读取文本/数字混合CSV文件作为表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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