Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sd2df() drops missing rows of data frames with a single character column #640

Open
ryanzomorrodi opened this issue Mar 21, 2025 · 2 comments

Comments

@ryanzomorrodi
Copy link

Describe the bug
When using sd2df() to transfer a single character column with missing values, all non-missing rows are dropped.

To Reproduce
Steps to reproduce the behavior:

  1. Submit the following code
import saspy
import pandas as pd
print(saspy)
#> <module 'saspy' from '/home/user/.virtualenvs/r-saspy/lib/python3.12/site-packages/saspy/__init__.py'>
print(saspy.SAScfg)
#> /home/user/.virtualenvs/r-saspy/lib/python3.12/site-packages/saspy/sascfg_personal.py
print(saspy.list_configs())
#> ['/home/user/.virtualenvs/r-saspy/lib/python3.12/site-packages/saspy/sascfg_personal.py']
sas = saspy.SASsession()
#> Using SAS Config named: oda
#> SAS Connection established. Subprocess id is 52082
#> 
print(sas)
#> Access Method         = IOM
#> SAS Config name       = oda
#> SAS Config file       = /home/user/.virtualenvs/r-saspy/lib/python3.12/site-packages/saspy/sascfg_personal.py
#> WORK Path             = /saswork/SAS_work65D200002B81_odaws02-usw2-2.oda.sas.com/SAS_work830300002B81_odaws02-usw2-2.oda.sas.com/
#> SAS Version           = 9.04.01M7P08062020
#> SASPy Version         = 5.102.1
#> Teach me SAS          = False
#> Batch                 = False
#> Results               = Pandas
#> SAS Session Encoding  = utf-8
#> Python Encoding value = utf-8
#> SAS process Pid value = 11137
#> SASsession started    = Fri Mar 21 17:38:09 2025
#> 
#> 
example = pd.DataFrame({'A': ["hello", None, "hi"]})
sas.df2sd(example, "example", "work")
#> Libref  = work
#> Table   = example
#> Dsopts  = {}
#> Results = Pandas
sas.submitLST("PROC PRINT DATA = example; RUN;", results = "TEXT")
#> 
#>                                                            The SAS System                     Friday, March 21, 2025 10:38:00 PM   8
#> 
#>                                                             Obs    A
#> 
#>                                                              1     hello
#>                                                              2          
#>                                                              3     hi   
#> 
#> 
sas.sd2df("example", "work")
#> A
#> 0	hello
#> 1	hi
  1. See that when using sd2df() missing rows are dropped instead of being retained as a None value.
@tomweber-sas
Copy link
Collaborator

Hey @ryanzomorrodi , I'm out for the next day or two, but I will look into this as soon as I get back.
Tom

@ryanzomorrodi
Copy link
Author

All good, I was just writing tests for an R wrapper sasquatch and discovered this and thought I'd let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants