From 92ad98e555ba97e62ef124de066b4e57fd5d38c1 Mon Sep 17 00:00:00 2001 From: economy Date: Mon, 22 May 2017 09:59:29 -0700 Subject: [PATCH 1/2] updating comparison_with_sas.rst to include documentation for reading sas7bdat format --- doc/source/comparison_with_sas.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/comparison_with_sas.rst b/doc/source/comparison_with_sas.rst index 7ec91d251f15d..81e56f72d4ccc 100644 --- a/doc/source/comparison_with_sas.rst +++ b/doc/source/comparison_with_sas.rst @@ -577,9 +577,8 @@ Data Interop ~~~~~~~~~~~~ pandas provides a :func:`read_sas` method that can read SAS data saved in -the XPORT format. The ability to read SAS's binary format is planned for a -future release. - +the XPORT or SAS7BDAT binary format. + .. code-block:: none libname xportout xport 'transport-file.xpt'; @@ -591,6 +590,12 @@ future release. .. code-block:: python df = pd.read_sas('transport-file.xpt') + df = pd.read_sas('binary-file.sas7bdat') + + # specify format directly (by default, format is inferred) + + df = pd.read_sas('transport-file.xpt', format='xport') + df = pd.read_sas('binary-file.sas7bdat', format='sas7bdat') XPORT is a relatively limited format and the parsing of it is not as optimized as some of the other pandas readers. An alternative way @@ -605,3 +610,4 @@ to interop data between SAS and pandas is to serialize to csv. In [9]: %time df = pd.read_csv('big.csv') Wall time: 4.86 s + From 099af4ebb838b75661a775e8ebbff237a68ca5ec Mon Sep 17 00:00:00 2001 From: economy Date: Mon, 22 May 2017 10:22:43 -0700 Subject: [PATCH 2/2] DOC: update docs for read_sas(format='sas7bdat') #12700 Issue #12700: DOC: update comparison_with_sas docs to include new read_sas(format='sas7bdat') --- doc/source/comparison_with_sas.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/source/comparison_with_sas.rst b/doc/source/comparison_with_sas.rst index 81e56f72d4ccc..875358521173a 100644 --- a/doc/source/comparison_with_sas.rst +++ b/doc/source/comparison_with_sas.rst @@ -592,7 +592,10 @@ the XPORT or SAS7BDAT binary format. df = pd.read_sas('transport-file.xpt') df = pd.read_sas('binary-file.sas7bdat') - # specify format directly (by default, format is inferred) +You can also specify the file format directly. By default, pandas will try +to infer the file format based on its extension. + +.. code-block:: python df = pd.read_sas('transport-file.xpt', format='xport') df = pd.read_sas('binary-file.sas7bdat', format='sas7bdat')