DOC/PY3: Python 3 docs example compat for range, StringIO and datetime #6230
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.
related is #6212
Fixes examples in documentation to be compatible with Python 3. Also tested it locally under Python 2.
(x)range()torange()for iteration and tolist(range())for list concat.datetime(2013, 01, 27).StringIOandcStringIOimports in examples (uses suppressed pandas.compat imports) and added a note on py2/3 library reorganization.StringIOfor binary data to the more explicitBytesIO.NameErrorfor missingpd.inpd.Series.numpy.uniqueexample, see also DOC/PY3: np.unique errors on pd.Series with mixed string/float in python3 #6229.I am not sure about the
BytesIOthough. Maybe good to put a note saying this is Python 3 way to do it and users on 2.x should use the oldStringIOinstead. In general, should we favor Python 3 doc versions in such cases and add notes for Python 2.x users? What do you think?