-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pathlib.Path in io #16292
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
Merged
Merged
BUG: pathlib.Path in io #16292
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cff750f
BUG: pathlib.Path in io
chris-b1 adf77f0
CLN: factor out pathlib roundtrip
chris-b1 ae22641
add localpath tests for other io
chris-b1 086a11b
fixup
chris-b1 3dda8bc
xfail SAS; type in parser
chris-b1 1ecbe0d
missing import
chris-b1 8a4e291
xfail for #14704
chris-b1 9293b14
fix to_csv
chris-b1 83415a7
lint
chris-b1 577796e
lint cleanup
chris-b1 f135e32
add feather (xfail)
chris-b1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -679,6 +679,18 @@ def test_file(self): | |
|
||
tm.assert_frame_equal(url_table, local_table) | ||
|
||
def test_path_pathlib(self): | ||
df = tm.makeDataFrame() | ||
result = tm.round_trip_pathlib(df.to_csv, | ||
lambda p: self.read_csv(p, index_col=0)) | ||
tm.assert_frame_equal(df, result) | ||
|
||
def test_pickle_path_localpath(self): | ||
df = tm.makeDataFrame() | ||
result = tm.round_trip_pathlib(df.to_csv, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. round_trip_localpath ? |
||
lambda p: self.read_csv(p, index_col=0)) | ||
tm.assert_frame_equal(df, result) | ||
|
||
def test_nonexistent_path(self): | ||
# gh-2428: pls no segfault | ||
# gh-14086: raise more helpful FileNotFoundError | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,26 @@ def test_from_iterator(self): | |
tm.assert_frame_equal(df, df0.iloc[2:5, :]) | ||
rdr.close() | ||
|
||
def test_path_pathlib(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like needs xfailing here |
||
tm._skip_if_no_pathlib() | ||
from pathlib import Path | ||
for j in 0, 1: | ||
df0 = self.data[j] | ||
for k in self.test_ix[j]: | ||
fname = Path(os.path.join(self.dirpath, "test%d.sas7bdat" % k)) | ||
df = pd.read_sas(fname, encoding='utf-8') | ||
tm.assert_frame_equal(df, df0) | ||
|
||
def test_path_localpath(self): | ||
tm._skip_if_no_localpath() | ||
from py.path import local as LocalPath | ||
for j in 0, 1: | ||
df0 = self.data[j] | ||
for k in self.test_ix[j]: | ||
fname = LocalPath(os.path.join(self.dirpath, "test%d.sas7bdat" % k)) | ||
df = pd.read_sas(fname, encoding='utf-8') | ||
tm.assert_frame_equal(df, df0) | ||
|
||
def test_iterator_loop(self): | ||
# github #13654 | ||
for j in 0, 1: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can you add a blank line