sassoftware / python-swat

The SAS Scripting Wrapper for Analytics Transfer (SWAT) package is the Python client to SAS Cloud Analytic Services (CAS). It allows users to execute CAS actions and process the results all from Python.
Other
147 stars 63 forks source link

Issues with the round method on SASDataFrame objects #141

Closed pestyld closed 1 year ago

pestyld commented 1 year ago

There seems to be an issue with the round method on a SASDataFrame object.

For example, i'll load the following file as a CAS Table

castbl = conn.read_csv(r'https://support.sas.com/documentation/onlinedoc/viya/exampledatasets/cars.csv', casout = {'name':'hmeq', 'caslib':'casuser', 'replace':True})

Then i'll execute the describe and round methods on the CASTable objects. The describe method returns a SASDataFrame, and the round method should round that DataFrame.

castbl.describe().round() The results show it makes all the values NaN Round Describe

I also tested this with the head method on a CASTable object. I get this error: castbl.head().round() Error

If you use traditional Pandas and create a traditional DataFrame, the round method works each time.

df = pd.read_csv(r'https://support.sas.com/documentation/onlinedoc/viya/exampledatasets/cars.csv') df.describe().round() df.head().round()

dataframeround

bkemper24 commented 1 year ago

This appears to be a problem with pandas. The problem was introduced in pandas version 1.2.0. The problem occurs when a class that subclasses pandas.DataFrame ( in this case the SASDataFrame class ) contains an original property named "name" that is included in the _metadata list.

The problem is fixed in pandas version 2.0.0 that was released last month.