-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Add capability to handle Path/LocalPath objects #11051
Conversation
ok, looks reasonable the |
@@ -118,6 +118,33 @@ def _expand_user(filepath_or_buffer): | |||
return filepath_or_buffer | |||
|
|||
|
|||
def _stringify_path(filepath_or_buffer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this actuallly called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, didn’t add
that line before i push
ed. it’s being called now
Docs would be great as well, in the docstring and in the |
f5de717
to
393c68c
Compare
import pandas.util.testing as tm | ||
|
||
from pandas.io import common | ||
|
||
try: | ||
import pathlib | ||
PATHLIB_INSTALLED = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make these into functions that raise nose.SkipTest
(e.g. put them in this module, but see how this is done in utils.testing
, e.g. the _skip_if......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
can you add |
@@ -23,6 +23,10 @@ Enhancements | |||
Other Enhancements | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
- :func:`~pandas.io.parsers.read_csv` and :func:`~pandas.io.parsers.read_table` now | |||
also accept :class:`python:pathlib.Path`, or :class:`py:py._path.local.LocalPath` | |||
as first argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
say for the filepath_or_buffer
argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
all done! |
@@ -19,3 +19,4 @@ pymysql=0.6.3 | |||
html5lib=1.0b2 | |||
beautiful-soup=4.2.1 | |||
statsmodels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have add py
here as well (otherwise these will skip). Note on the 2.6 build these SHOULD skip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
anaconda can’t install pathlib. wat do? |
add to |
@@ -19,3 +19,5 @@ pymysql=0.6.3 | |||
html5lib=1.0b2 | |||
beautiful-soup=4.2.1 | |||
statsmodels | |||
pathlib | |||
py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add these to requirements-2.7.pip
(instead of here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done
pls squash. otherwise lgtm. |
squashed 👍 |
@@ -23,6 +23,10 @@ Enhancements | |||
Other Enhancements | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
- :func:`~pandas.io.parsers.read_csv` and :func:`~pandas.io.parsers.read_table` now | |||
also accept :class:`python:pathlib.Path`, or :class:`py:py._path.local.LocalPath` | |||
for the ``filepath_or_buffer`` argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue number here (or the PR number IIRC this doesn't have an issue)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
|
||
try: | ||
from py.path.local import LocalPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is broken, you are skipping this test when it should work because its not imported correctly
In [1]: import py
In [2]: py.path.local.LocalPath
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-ac7907368c6c> in <module>()
----> 1 py.path.local.LocalPath
AttributeError: type object 'LocalPath' has no attribute 'LocalPath'
In [3]: py.path.local
Out[3]: py._path.local.LocalPath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, fixed. shoulda tested it 😆
|
||
|
||
try: | ||
from py.path import local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your naming import before, e.g.
from py.path import local as LocalPath
done, sorry for the holdup |
merged via 82f0033 thanks! |
🎆 yeah! |
fixes #11033