Skip to content

Commit

Permalink
solved Roche#183
Browse files Browse the repository at this point in the history
  • Loading branch information
ofajardo committed Apr 29, 2022
1 parent 9e6c6ab commit 987745d
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 146 deletions.
5 changes: 4 additions & 1 deletion change_log.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# 1.1.5 (github, pypi and conda xxxx.xx.xx)
# 1.1.6 (github, pypi and conda xxxx.xx.xx)
* Solved #183

# 1.1.5 (github, pypi and conda 2022.04.28)
* Solved #159, #158, #163, #164, #172, #177
* Added new date formats for SAS and SPSS solves #170, #171
* Added check missing\_range type against variable type solves #180
Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '1.1.5'
release = '1.1.6'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyreadstat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
from .pyreadstat import read_file_in_chunks, read_file_multiprocessing
from ._readstat_parser import ReadstatError, metadata_container

__version__ = "1.1.5"
__version__ = "1.1.6"
292 changes: 154 additions & 138 deletions pyreadstat/_readstat_writer.c

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyreadstat/_readstat_writer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ cdef list get_pandas_column_types(object df, dict missing_user_values, dict vari
result.append((PYWRITER_DATETIME, 0,1))
else:
result.append((PYWRITER_DATETIME, 0,0))
elif col_type == object or col_type in int_mixed_types:
elif col_type == object or col_type == 'string' or col_type in int_mixed_types:
is_missing = 0
if curuser_missing:
curseries = curseries[~curseries.isin(curuser_missing)].reset_index(drop=True)
Expand Down Expand Up @@ -263,7 +263,6 @@ cdef list get_pandas_column_types(object df, dict missing_user_values, dict vari
max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name))
result.append((PYWRITER_OBJECT, max_length, 0))
continue

if curtype in int_types:
result.append((PYWRITER_INTEGER, 0, is_missing))
elif curtype in float_types:
Expand Down Expand Up @@ -389,7 +388,7 @@ cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable, pyw
check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi))
range_values += 1
elif type(hi) == str and type(lo) == str:
if vartype != PYWRITER_CHARACTER:
if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT:
msg = "character missing_ranges value given for non character variable %s" %variablename
raise PyreadstatError(msg)
if hi == lo:
Expand All @@ -413,7 +412,7 @@ cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable, pyw
check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range))
discrete_values += 1
elif type(cur_range) == str:
if vartype != PYWRITER_CHARACTER:
if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT:
msg = "character missing_ranges value given for non character variable %s" %variablename
raise PyreadstatError(msg)
if len(cur_range) > 8:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

setup(
name='pyreadstat',
version='1.1.5',
version='1.1.6',
description=short_description,
author="Otto Fajardo",
author_email="pleasecontactviagithub@notvalid.com",
Expand Down

0 comments on commit 987745d

Please sign in to comment.