ValueError importing data
Issue #70
new
Hi Albert,
I am trying to import data using the package and I am getting a ValueError
. Specifically, when I do
with spss.SavReaderNp(spssfile) as reader:
records = reader.all()
I get
with spss.SavReaderNp(spssfile) as reader:
records = reader.all()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-26-0d4142371156> in <module>()
1 with spss.SavReaderNp(spssfile) as reader:
----> 2 records = reader.all()
3
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/savReaderNp.py in all(self, filename)
539 --------
540 savReaderWriter.SavReaderNp.to_structured_array"""
--> 541 return self.to_structured_array(filename)
542
543 @convert_missings
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/savReaderNp.py in _convert_datetimes(self, *args)
120 def _convert_datetimes(self, *args):
121 #print("@convert_datetimes called by: %s" % func.__name__)
--> 122 array = func(self, *args)
123 if (self.rawMode or not self.datetimevars or not \
124 self.do_convert_datetimes):
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/savReaderNp.py in _convert_missings(self, *args)
146 @wraps(func)
147 def _convert_missings(self, *args):
--> 148 array = func(self, *args)
149 cutoff = -sys.float_info.max
150 sysmis = self.recodeSysmisTo
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/savReaderNp.py in to_structured_array(self, filename)
529 array = self._uncompressed_to_array(as_ndarray=False)
530 else:
--> 531 array = np.fromiter(self, self.trunc_dtype, self.nrows)
532 self.do_convert_datetimes = True
533 return array
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/helpers.py in fget_memoized(self)
15 def fget_memoized(self):
16 if not hasattr(self, attr_name):
---> 17 setattr(self, attr_name, fget(self))
18 return getattr(self, attr_name)
19 return property(fget_memoized)
~/Anaconda3/envs/GeoPython3env/lib/python3.5/site-packages/savReaderWriter/savReaderNp.py in trunc_dtype(self)
374 i, v in enumerate(self.uvarNames)]
375 obj = dict(names=self.uvarNames, formats=formats, titles=self._titles)
--> 376 return np.dtype(obj)
377
378 @memoized_property
ValueError: title already used as a name or title.
If instead I do
python
records = []
with spss.SavReader(spssfile, ioLocale='en_US.UTF-8') as reader:
print(spssfile)
for line in reader:
records.append(line)
I get no errors. Any idea why?