A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Roche/pyreadstat/issues/69 below:

write_sav() and datetime gives wrong format · Issue #69 · Roche/pyreadstat · GitHub

According to the Readme datetime, date, time should be converted to numeric with datetime/date/time formatting.

I am converting strings to datetime64[ns] dtype with:

df[field_name] = pd.to_datetime(df[field_name], errors="coerce")

or

df[field_name] = pd.to_datetime(df[field_name], format='%H:%M', errors="coerce")

for time, respectively.

The resulting sav variable has numeric type with F8.2 format

How can I convert it to SPSS DATE or TIME format?
Is this a bug? In case I am getting something wrong, please explain how to get the right format.

Thanks
Josef

Setup Information:

i installed pyreadstat via pipenv

INSTALLED VERSIONS

commit : d9fff2792bf16178d4e450fe7384244e50635733
python : 3.7.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-42-generic
Version : #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.0
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4