我正在读一个SPSS文件(.sav)。我下面的代码可以读取.sav文件。但是,我遇到了一个非常奇怪的错误。当我试图读取另一个.sav文件时,它会给出以下错误Traceback (most recent call last):
File "C:\Users\fatihshen\Documents\Merjek
Project\Predictive_Analytics\sav_reader.py", line 28, in
read_spss_file(file_path)
File "C:\Users\fatihshen\Documents\Merjek
Project\Predictive_Analytics\sav_reader.py", line 10, in read_spss_file
records = reader.all()
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\savReaderNp.py", line 541, in all
return self.to_structured_array(filename)
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\savReaderNp.py", line 122, in _convert_datetimes
array = func(self, *args)
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\savReaderNp.py", line 148, in _convert_missings
array = func(self, *args)
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\savReaderNp.py", line 531, in to_structured_array
array = np.fromiter(self, self.trunc_dtype, self.nrows)
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\helpers.py", line 17, in fget_memoized
setattr(self, attr_name, fget(self))
File "C:\Users\fatihshen\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\savReaderWriter\savReaderNp.py", line 376, in trunc_dtype
return np.dtype(obj)
ValueError: title already used as a name or title.
这是我的代码:
^{pr2}$
.sav文件在SPSS上运行正常。但是,在使用这些Python代码时,有些.sav文件不起作用(此代码适用于大多数其他.sav文件)。在
你知道这是怎么回事吗?谢谢你的帮助。在
python读取sav文件_在Python中读取SPSS(.sav)文件时 获取“title already used as a name or title”错误...