ARROW-3910: [Python] Set date_as_objects=True as default in to_pandas methods
This does not add a deprecation warning primarily because it's a bit difficult to do (we would need to check the data types whether it's a date -- or in the case of a table, if any field is a date--, and then warn if so). `True` is the correct option though in order to accurately roundtrip data to and from pandas. Some users might have some workarounds floating around, but this is sufficiently advanced stuff already.
With this patch, date data round trips with no special options
```
In [2]: import pyarrow as pa
In [3]: import datetime
In [4]: arr = pa.array([datetime.date(2000, 1, 1), None])
In [5]: arr
Out[5]:
<pyarrow.lib.Date32Array object at 0x0000022CCDB1BBD8>
[
10957,
null
]
In [6]: arr.to_pandas()
Out[6]: array([datetime.date(2000, 1, 1), None], dtype=object)
In [7]: pa.array(arr.to_pandas())
Out[7]:
<pyarrow.lib.Date32Array object at 0x0000022CCDC7FE58>
[
10957,
null
]
```
If others strongly feel it's worth going to the effort of raising a deprecation warning, please chime in.
Author: Wes McKinney <wesm+git@apache.org>
Closes #3272 from wesm/ARROW-3910 and squashes the following commits:
308afe56 <Wes McKinney> Add Windows makefile for Sphinx, add section about date conversions to pandas.rst
f77c2967 <Wes McKinney> Set date_as_objects=True as default in to_pandas methods
2019-01-01 13:34:25 -06:00
|
|
|
@rem Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
|
@rem or more contributor license agreements. See the NOTICE file
|
|
|
|
|
@rem distributed with this work for additional information
|
|
|
|
|
@rem regarding copyright ownership. The ASF licenses this file
|
|
|
|
|
@rem to you under the Apache License, Version 2.0 (the
|
|
|
|
|
@rem "License"); you may not use this file except in compliance
|
|
|
|
|
@rem with the License. You may obtain a copy of the License at
|
|
|
|
|
@rem
|
|
|
|
|
@rem http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
@rem
|
|
|
|
|
@rem Unless required by applicable law or agreed to in writing,
|
|
|
|
|
@rem software distributed under the License is distributed on an
|
|
|
|
|
@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
@rem KIND, either express or implied. See the License for the
|
|
|
|
|
@rem specific language governing permissions and limitations
|
|
|
|
|
@rem under the License.
|
|
|
|
|
|
|
|
|
|
@ECHO OFF
|
|
|
|
|
|
|
|
|
|
pushd %~dp0
|
|
|
|
|
|
|
|
|
|
REM Command file for Sphinx documentation
|
|
|
|
|
|
|
|
|
|
if "%SPHINXBUILD%" == "" (
|
|
|
|
|
set SPHINXBUILD=sphinx-build
|
|
|
|
|
)
|
|
|
|
|
set SOURCEDIR=source
|
|
|
|
|
set BUILDDIR=_build
|
|
|
|
|
|
|
|
|
|
if "%1" == "" goto help
|
|
|
|
|
|
|
|
|
|
%SPHINXBUILD% >NUL 2>NUL
|
|
|
|
|
if errorlevel 9009 (
|
|
|
|
|
echo.
|
|
|
|
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
|
|
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
|
|
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
|
|
|
echo.may add the Sphinx directory to PATH.
|
|
|
|
|
echo.
|
|
|
|
|
echo.If you don't have Sphinx installed, grab it from
|
|
|
|
|
echo.http://sphinx-doc.org/
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
|
|
|
goto end
|
|
|
|
|
|
|
|
|
|
:help
|
|
|
|
|
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
|
|
|
|
|
|
|
|
:end
|
|
|
|
|
popd
|