sas7bdat: Check if the SAS file has zero variables by AbdealiLoKo · Pull Request #18184 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation15 Commits1 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
If the given SAS file has 0 rows, throw an error for the EmptyData file.
When reading, check that the column information is available. If not,
throw an error.
- closes #xxxx
- tests added / passed
- passes
git diff upstream/master -u -- "*.py" | flake8 --diff
- whatsnew entry
Hello @AbdealiJK! Thanks for updating the PR.
Cheers ! There are no PEP8 issues in this Pull Request. 🍻
Comment last updated on November 10, 2017 at 03:11 Hours UTC
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a whatsnew note for 0.22 (can be in bug fixes). what did this do before with an empty file?
@@ -174,3 +176,9 @@ def test_date_time(): |
---|
df0 = pd.read_csv(fname, parse_dates=['Date1', 'Date2', 'DateTime', |
'DateTimeHi', 'Taiw']) |
tm.assert_frame_equal(df, df0) |
def test_zero_variables(): |
dirpath = tm.get_data_path() |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the issue number (if no issue, then this PR number) as a comment
def test_zero_variables(): |
---|
dirpath = tm.get_data_path() |
fname = os.path.join(dirpath, "zero_variables.sas7bdat") |
with pytest.raises(EmptyDataError): |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you test with the zero observations file as well (is it the same result)? you can parametrize if that'st the case
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The zero observations file gives a None
value while reading an empty the csv file gives an empty dataframe. I think this is a bug but have not fixed it right now
dirpath = tm.get_data_path() |
---|
fname = os.path.join(dirpath, "zero_variables.sas7bdat") |
with pytest.raises(EmptyDataError): |
df = pd.read_sas(fname) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need the df = here
@jreback - Thanks for the comments. Updated.
can you add a whatsnew note for 0.22 (can be in bug fixes). what did this do before with an empty file?
Can you help me with which file I should be updating for this ?
doc/source/whatsnew/v0.22.0.txt
@@ -90,6 +90,7 @@ Bug Fixes |
---|
- Bug in ``pd.read_msgpack()`` with a non existent file is passed in Python 2 (:issue:`15296`) |
- Bug in ``DataFrame.groupby`` where key as tuple in a ``MultiIndex`` were interpreted as a list of keys (:issue:`17979`) |
- Bug in :func:`pd.read_csv` where a ``MultiIndex`` with duplicate columns was not being mangled appropriately (:issue:`18062`) |
- Bug in :func:`pd.read_sas` where a file with 0 variables gives an invalid error. Now it gives and ``EmptyDataError`` |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the previous error? can you re-word this a bit.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
If the given SAS file has 0 rows, throw an error for the EmptyData file. When reading, check that the column information is available. If not, throw an error.
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request