Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • converting "None"(python) to "" (Stata).

    Hi ,

    manipulating a list in python I ended up with the following tuple, which I need to send to stata default frame

    ('47313362', None) where None means missing in python parlance.

    Code:
    . clear all
    . gen a=""
    . gen b=""
    . set obs 1
    Number of observations (_N) was 0, now 1.
    
    . python
    ----------------------------------------------- python (type end to exit) ----------------------------------------------------------------------------------------------------------------------------------------
    >>> from sfi import Data
    >>> Data.store(['a','b'],None,('47313362', None))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Program Files\Stata17\ado\base\py\sfi.py", line 1432, in store
        return _stp._st_storedata(vars, obss, val, svar)
    TypeError: failed to store the string value in the current Stata dataset
    r(7102);
    >>> end
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    . list
    
         +--------------+
         |        a   b |
         |--------------|
      1. | 47313362     |
         +--------------+
    So, Sfi library is not correctly converting "None"(python) to "" (Stata).

    Does anyone know how to handle it?

    thanks
Working...
X