读取 csv 文件时出错

读取 csv 文件时出错

我想从 .csv 文件中读取此内容,但出现错误

Items, FactorLoadings

Social Needs (Cronbach's a = 0.695) 

Smartphone allows me to stay connected with those I care about,0.758

I use smartphone to stay connected with friends and family through social networking websites (Twitter, Facebook, MySpace, etc.),0.761

It is easy for me to observe others? happening by using the smartphone,0.701

I use my smartphone to catch up with friends and relative,0.742

Smartphone allows me to transfer photo/audio or other data with whom I want to share,0.577

答案1

从 TikZ 标签来看,我假设您使用的pgfplotstable是我的水晶球。然后您需要确保列分隔符未在条目内使用,或者它们被大括号对覆盖,正如 David Carlisle 指出的那样。

这是一个例子(虽然我承认我不会按原样使用它,因为它需要一些修饰)

\documentclass{article}  
\usepackage{pgfplotstable}

\pgfplotstableread[col sep=comma]{
Items, FactorLoadings
{Social Needs (Cronbach's a = 0.695)},
{Smartphone allows me to stay connected with those I care about},0.758
{I use smartphone to stay connected with friends and family through social networking websites (Twitter, Facebook, MySpace, etc.)},0.761
{It is easy for me to observe others? happening by using the smartphone},0.701
{I use my smartphone to catch up with friends and relative},0.742
{Smartphone allows me to transfer photo/audio or other data with whom I want to share},0.577
}\mytable


\begin{document}
\pgfplotstabletypeset[
columns/Items/.style={string type,column type=p{.8\textwidth}},
]{\mytable}

在此处输入图片描述

相关内容