-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: pd.read_table #21954
DEPR: pd.read_table #21954
Conversation
Initial comments:
|
529c70f
to
4f41cd0
Compare
Hello @dahlbaek! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on August 02, 2018 at 10:48 Hours UTC |
Added a whatsnew note. I'm not sure what to do about tests. I changed the warning message so that it will reflect whether or not the user is supplying a value to In [1]: import pandas as pd
In [2]: df = pd.DataFrame({"a": [1], "b": [2]})
...: df.to_csv("test.csv", sep="\t")
In [3]: pd.read_table("test.csv", index_col=0)
/home/dahlbaek/virtualenvs/pandas-dev/bin/ipython:1: FutureWarning: read_table is deprecated, use read_csv with sep='\t' instead.
#!/home/dahlbaek/virtualenvs/pandas-dev/bin/python
Out[3]:
a b
0 1 2
In [4]: pd.read_table("test.csv", "\t", index_col=0)
/home/dahlbaek/virtualenvs/pandas-dev/bin/ipython:1: FutureWarning: read_table is deprecated, use read_csv instead.
#!/home/dahlbaek/virtualenvs/pandas-dev/bin/python
Out[4]:
a b
0 1 2
In [5]: pd.read_table("test.csv", sep="\t", index_col=0)
/home/dahlbaek/virtualenvs/pandas-dev/bin/ipython:1: FutureWarning: read_table is deprecated, use read_csv instead.
#!/home/dahlbaek/virtualenvs/pandas-dev/bin/python
Out[5]:
a b
0 1 2
In [6]: pd.read_table("test.csv", delimiter="\t", index_col=0)
/home/dahlbaek/virtualenvs/pandas-dev/bin/ipython:1: FutureWarning: read_table is deprecated, use read_csv instead.
#!/home/dahlbaek/virtualenvs/pandas-dev/bin/python
Out[6]:
a b
0 1 2
In [7]: pd.read_csv("test.csv", "\t", index_col=0)
Out[7]:
a b
0 1 2
In [8]: pd.read_csv("test.csv", sep="\t", index_col=0)
Out[8]:
a b
0 1 2
In [9]: pd.read_csv("test.csv", delimiter="\t", index_col=0)
Out[9]:
a b
0 1 2 |
3e229e0
to
01b3b0f
Compare
We definitely have tests for |
2a659b6
to
15dfae8
Compare
@gfyoung I modified the tests, but am unsure how to proceed with the $ cat test_warn.py
import pandas as pd
pd.read_table("test.csv", index_col=0)
$ python test_warn.py
test_warn.py:3: FutureWarning: read_table is deprecated, use read_csv with sep='\t' instead.
pd.read_table("test.csv", index_col=0) This is exactly the behaviour I would want as a user. Nevertheless, Please Advise. |
15dfae8
to
9eb7631
Compare
@dahlbaek : Pass in |
Perfect, that's what I figured. |
9eb7631
to
23d53a1
Compare
"instead.", | ||
FutureWarning, stacklevel=2) | ||
if sep is False: | ||
sep = default_sep |
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.
Why do we need this if
condition here?
(yes, I see the other changes that you made for passing in default_sep
. This question is more asking why the overall change was needed for this deprecation).
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.
If the user is setting sep
or delimiter
, I want to suggest using read_csv
, but if neither is set, I also want to suggest passing sep='\t'
. This was the simplest solution I could come up with which handles the case correctly where the user is passing sep=','
to read_table
.
More generally, the if
clause is needed because the definition of read_table
is entangled with the definition of read_csv
. The cleaner solution would be to just have two separate definitions, but that solution was deemed not worth the effort.
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.
Hmm...I see. Okay, fair enough.
c75f12a
to
2149356
Compare
I'm not seeing any
Not sure exactly what is happening here… |
@dahlbaek : That's an odd test failure. Seems to be fine on Travis though. Also, the test logs don't seem to have any deprecation warnings related to |
@dahlbaek we don't usually run from the test dir itself, rather from the base dir e.t. |
@jorisvandenbossche @TomAugspurger any objections? |
ea4a798
to
5431629
Compare
5431629
to
aceaa23
Compare
@dahlbaek see my comments above. The tests are not designed to be run from subdirs, nor are they on our CI. pytest can't find things. |
@jreback I think I am now running the test the way proposed in the docs, right? I still get the failure (even on master). In any case, this seems unrelated to the current PR. I suppose it is a local phenomenon that I will have to figure out myself…
|
@dahlbaek hmm that looks like a real error |
aceaa23
to
c24446a
Compare
@jreback I'll try to look into it when I have time and make a separate issue. |
@jreback I re-cloned the repo and installed a fresh python3.7 environment. I don't know what was causing the problem, but now it is gone. |
@TomAugspurger if you have any issues here |
@dahlbaek : This looks good to me, though if you could fix the merge conflicts, that would be good. |
- pd.read_table is deprecated and replaced by pd.read_csv. - add whatsnew note - change tests to test for warning messages - change DataFrame.from_csv to use pandas.read_csv instead of pandas.read_table - Change pandas.read_clipboard to use pandas.read_csv instead of pandas.read_table
c24446a
to
f417c92
Compare
@gfyoung Done. |
Pushed a doc formatting fix. Thanks @dahlbaek! |
* DEPR: pd.read_table - pd.read_table is deprecated and replaced by pd.read_csv. - add whatsnew note - change tests to test for warning messages - change DataFrame.from_csv to use pandas.read_csv instead of pandas.read_table - Change pandas.read_clipboard to use pandas.read_csv instead of pandas.read_table * Add sep note to whatsnew
* master: (47 commits) Run tests in conda build [ci skip] (pandas-dev#22190) TST: Check DatetimeIndex.drop on DST boundary (pandas-dev#22165) CI: Fix Travis failures due to lint.sh on pandas/core/strings.py (pandas-dev#22184) Documentation: typo fixes in MultiIndex / Advanced Indexing (pandas-dev#22179) DOC: added .join to 'see also' in Series.str.cat (pandas-dev#22175) DOC: updated Series.str.contains see also section (pandas-dev#22176) 0.23.4 whatsnew (pandas-dev#22177) fix: scalar timestamp assignment (pandas-dev#19843) (pandas-dev#19973) BUG: Fix get dummies unicode error (pandas-dev#22131) Fixed py36-only syntax [ci skip] (pandas-dev#22167) DEPR: pd.read_table (pandas-dev#21954) DEPR: Removing previously deprecated datetools module (pandas-dev#6581) (pandas-dev#19119) BUG: Matplotlib scatter datetime (pandas-dev#22039) CLN: Use public method to capture UTC offsets (pandas-dev#22164) implement tslibs/src to make tslibs self-contained (pandas-dev#22152) Fix categorical from codes nan 21767 (pandas-dev#21775) BUG: Better handling of invalid na_option argument for groupby.rank(pandas-dev#22124) (pandas-dev#22125) use memoryviews instead of ndarrays (pandas-dev#22147) Remove depr. warning in SeriesGroupBy.count (pandas-dev#22155) API: Default to_* methods to compression='infer' (pandas-dev#22011) ...
* DEPR: pd.read_table - pd.read_table is deprecated and replaced by pd.read_csv. - add whatsnew note - change tests to test for warning messages - change DataFrame.from_csv to use pandas.read_csv instead of pandas.read_table - Change pandas.read_clipboard to use pandas.read_csv instead of pandas.read_table * Add sep note to whatsnew
pd.read_table
is deprecated and replaced bypd.read_csv
.git diff upstream/master -u -- "*.py" | flake8 --diff