Pandas: Replace old string formatting syntax with f-strings

Created on 11 Nov 2019  ·  137Comments  ·  Source: pandas-dev/pandas

Since we no longer support python 3.5, we can now use the new f-strings instead of the old .format() ( and obviously the % formatting).

Notes:

  • Don't forget to link this issue in your pull request's body message , simply paste this https://github.com/pandas-dev/pandas/issues/29547 in your pull request's body message.

  • If any of your changed files are related to #29886 , please make sure to link your pull request to that issue as well, simply paste this https://github.com/pandas-dev/pandas/issues/29886 in your pull request's body message as well.

  • Please comment what you are planning to work on, so we won't do double work.

  • If a file/files that should be marked as done, is not marked, please comment letting me know.


To check what files still needs to be fixed in the pandas directory:

grep -l -R '%s'  --include=*.{py,pyx} pandas/
grep -l -R '%d' --include=*.{py,pyx} pandas/
grep -l -R '\.format(' --include=*.{py,pyx} pandas/

All of the above can also be used as a one liner:

grep -l -R -e '%s' -e '%d' -e '\.format(' --include=*.{py,pyx} pandas/
Tip:

If you want to see the line number of the occurrence, replace the -l with -n
for example:

grep -n -R '%s' --include=*.{py,pyx} pandas/

The current list is:

  • [ ] pandas/compat/pickle_compat.py

  • [ ] pandas/_config/config.py

  • [ ] pandas/core/arrays/datetimelike.py

  • [ ] pandas/core/arrays/datetimes.py

  • [ ] pandas/core/arrays/integer.py

  • [ ] pandas/core/arrays/period.py

  • [ ] pandas/core/computation/pytables.py

  • [ ] pandas/core/config_init.py

  • [ ] pandas/core/frame.py

  • [ ] pandas/core/generic.py

  • [ ] pandas/core/groupby/generic.py

  • [ ] pandas/core/groupby/groupby.py

  • [ ] pandas/core/indexes/base.py

  • [ ] pandas/core/indexes/multi.py

  • [ ] pandas/core/indexes/range.py

  • [ ] pandas/core/ops/docstrings.py

  • [ ] pandas/core/ops/__init__.py

  • [ ] pandas/core/reshape/merge.py

  • [ ] pandas/core/tools/datetimes.py

  • [ ] pandas/io/formats/css.py

  • [ ] pandas/io/formats/excel.py

  • [ ] pandas/io/formats/format.py

  • [ ] pandas/io/formats/html.py

  • [ ] pandas/io/formats/info.py

  • [ ] pandas/io/formats/latex.py

  • [ ] pandas/io/formats/printing.py

  • [ ] pandas/io/formats/style.py

  • [ ] pandas/io/parsers.py

  • [ ] pandas/io/pytables.py

  • [ ] pandas/io/sas/sas_xport.py

  • [ ] pandas/io/stata.py

  • [ ] pandas/_libs/tslibs/c_timestamp.pyx

  • [ ] pandas/_libs/tslibs/frequencies.pyx

  • [ ] pandas/_libs/tslibs/parsing.pyx

  • [ ] pandas/_libs/tslibs/period.pyx

  • [ ] pandas/_libs/tslibs/strptime.pyx

  • [ ] pandas/_libs/tslibs/timedeltas.pyx

  • [ ] pandas/plotting/_matplotlib/converter.py

  • [ ] pandas/tests/arrays/categorical/test_operators.py

  • [ ] pandas/tests/arrays/test_datetimelike.py

  • [ ] pandas/tests/dtypes/test_dtypes.py

  • [ ] pandas/tests/extension/base/setitem.py

  • [ ] pandas/tests/frame/test_constructors.py

  • [ ] pandas/tests/frame/test_missing.py

  • [ ] pandas/tests/frame/test_to_csv.py

  • [ ] pandas/tests/groupby/aggregate/test_other.py

  • [ ] pandas/tests/indexes/datetimes/test_date_range.py

  • [ ] pandas/tests/indexes/datetimes/test_datetime.py

  • [ ] pandas/tests/indexes/datetimes/test_formats.py

  • [ ] pandas/tests/indexes/datetimes/test_partial_slicing.py

  • [ ] pandas/tests/indexes/interval/test_constructors.py

  • [ ] pandas/tests/indexes/interval/test_interval.py

  • [ ] pandas/tests/indexes/multi/test_format.py

  • [ ] pandas/tests/indexes/period/test_formats.py

  • [ ] pandas/tests/indexes/test_base.py

  • [ ] pandas/tests/indexes/timedeltas/test_timedelta.py

  • [ ] pandas/tests/indexing/test_categorical.py

  • [ ] pandas/tests/indexing/test_coercion.py

  • [ ] pandas/tests/io/excel/test_openpyxl.py

  • [ ] pandas/tests/io/excel/test_writers.py

  • [ ] pandas/tests/io/formats/test_format.py

  • [ ] pandas/tests/io/formats/test_printing.py

  • [ ] pandas/tests/io/formats/test_style.py

  • [ ] pandas/tests/io/formats/test_to_csv.py

  • [ ] pandas/tests/io/formats/test_to_html.py

  • [ ] pandas/tests/io/formats/test_to_latex.py

  • [ ] pandas/tests/io/parser/test_compression.py

  • [ ] pandas/tests/io/parser/test_encoding.py

  • [ ] pandas/tests/io/parser/test_header.py

  • [ ] pandas/tests/io/parser/test_parse_dates.py

  • [ ] pandas/tests/io/parser/test_usecols.py

  • [ ] pandas/tests/io/test_html.py

  • [ ] pandas/tests/io/test_sql.py

  • [ ] pandas/tests/io/test_stata.py

  • [ ] pandas/tests/reductions/test_reductions.py

  • [ ] pandas/tests/reshape/test_concat.py

  • [ ] pandas/tests/reshape/test_melt.py

  • [ ] pandas/tests/scalar/period/test_period.py

  • [ ] pandas/tests/scalar/timedelta/test_timedelta.py

  • [ ] pandas/tests/scalar/timestamp/test_constructors.py

  • [ ] pandas/tests/series/indexing/test_numeric.py

  • [ ] pandas/tests/series/indexing/test_take.py

  • [ ] pandas/tests/series/indexing/test_where.py

  • [ ] pandas/tests/series/methods/test_rename.py

  • [ ] pandas/tests/series/test_api.py

  • [ ] pandas/tests/series/test_constructors.py

  • [ ] pandas/tests/series/test_datetime_values.py

  • [ ] pandas/tests/series/test_repr.py

  • [ ] pandas/tests/test_strings.py

  • [ ] pandas/tests/tools/test_to_datetime.py

  • [ ] pandas/tests/tseries/holiday/test_calendar.py

  • [ ] pandas/tests/tseries/holiday/test_holiday.py

  • [ ] pandas/tests/tslibs/test_parsing.py

  • [ ] pandas/tests/util/test_assert_frame_equal.py

  • [ ] pandas/tseries/frequencies.py

  • [ ] pandas/util/_decorators.py

  • [ ] pandas/util/_test_decorators.py

  • [ ] pandas/util/_validators.py

  • [ ] pandas/_version.py


NOTE:

The list may change as files are moved/renamed constantly.


Inhereted files and commands from this PR.

Style good first issue

Most helpful comment

Added my first pull request with this https://github.com/pandas-dev/pandas/pull/32007:
pandas/tests/frame/test_to_csv.py

All 137 comments

Im taking:

  • [x] pandas/_libs/groupby.pyx

  • [x] pandas/_libs/hashing.pyx

  • [x] pandas/_libs/index.pyx

  • [x] pandas/_libs/internals.pyx

  • [x] pandas/_libs/interval.pyx

  • [x] pandas/_libs/lib.pyx

  • [x] pandas/_libs/ops.pyx

  • [x] pandas/_libs/parsers.pyx

  • [x] pandas/_libs/reduction.pyx

  • [x] pandas/_libs/sparse.pyx

  • [x] pandas/_libs/testing.pyx

  • [x] pandas/_libs/tslib.pyx

  • [x] pandas/_libs/window.pyx

I'll take:

  • [x] pandas/tests/indexes/test_base.py
  • [x] pandas/tests/indexes/test_category.py
  • [x] pandas/tests/indexes/test_common.py
  • [x] pandas/tests/indexes/test_numeric.py

to start, if that's alright!

Hi @MomIsBestFriend Can you recommend any tools for this conversion? A quick look gave me these:

  1. pyupgrade
  2. fstringify
  3. flynt

I have no experience with either of them, but they could be very helpful here

Hello @SaturnFromTitan , I personally sometimes use pyupgrade but only when the file contain only a few outdated string formats in it. Then I look at the changes and fix if pyupgrade got something wrong.

When they're files with alot of occurrences I go for the "complex" ones manually (e.g '%.2f' % my_float) and let it deal with the common ones, usually it gets it right.

Also, some of the changes will make the changed file non pep8 compatible, so there's a need to fix that as well, otherwise it will not pass the tests.

Will take next:

  • [x] pandas/compat/__init__.py

  • [x] pandas/compat/numpy/function.py

  • [x] pandas/compat/numpy/__init__.py

  • [x] pandas/compat/_optional.py

I'll take:

  • [x] pandas/core/reshape/concat.py
  • [x] pandas/core/reshape/melt.py
  • [ ] pandas/core/reshape/merge.py
  • [x] pandas/core/reshape/pivot.py
  • [x] pandas/core/reshape/reshape.py
  • [ ] pandas/core/reshape/tile.py

What are everyone's thoughts on tagging this as a good first issue? It should apply to most of the files here. The changes that need to be made are usually only a few lines or so per file, and whoever is making the changes doesn't need to worry too much about affecting other parts of the code (since the end function performed is the same).

I'm picturing a setup similar to #28926.

f-string replacement placed on:

  • [x] pandas/core/groupby/generic.py
  • [x] pandas/core/groupby/groupby.py
  • [x] pandas/core/groupby/grouper.py
  • [x] pandas/core/groupby/ops.py

ref #29701

Will take next:

  • [x] pandas/_libs/tslibs/conversion.pyx

  • [x] pandas/_libs/tslibs/c_timestamp.pyx

  • [x] pandas/_libs/tslibs/fields.pyx

  • [x] pandas/_libs/tslibs/nattype.pyx

  • [x] pandas/_libs/tslibs/np_datetime.pyx

  • [x] pandas/_libs/tslibs/offsets.pyx

  • [x] pandas/_libs/tslibs/parsing.pyx

  • [x] pandas/_libs/tslibs/timestamps.pyx

  • [x] pandas/_libs/tslibs/timezones.pyx

  • [x] pandas/_libs/tslibs/tzconversion.pyx

I'll take

  • [x] pandas/plotting/_core.py
  • [x] pandas/plotting/_matplotlib/boxplot.py
  • [x] pandas/plotting/_matplotlib/converter.py
  • [x] pandas/plotting/_matplotlib/core.py
  • [x] pandas/plotting/_matplotlib/misc.py
  • [x] pandas/plotting/_matplotlib/style.py
  • [x] pandas/plotting/_matplotlib/timeseries.py
  • [x] pandas/plotting/_matplotlib/tools.py
  • [x] pandas/plotting/_misc.py

ref #29781

I'll take:

  • [x] pandas/core/reshape/concat.py
  • [x] pandas/core/reshape/melt.py
  • [ ] pandas/core/reshape/merge.py
  • [x] pandas/core/reshape/pivot.py
  • [x] pandas/core/reshape/reshape.py
  • [ ] pandas/core/reshape/tile.py

What are everyone's thoughts on tagging this as a good first issue? It should apply to most of the files here. The changes that need to be made are usually only a few lines or so per file, and whoever is making the changes doesn't need to worry too much about affecting other parts of the code (since the end function performed is the same).

I'm picturing a setup similar to #28926.

Sure ive labelled accordingly. thanks

Taking next:

  • [x] pandas/io/msgpack/_packer.pyx

  • [x] pandas/io/msgpack/_unpacker.pyx

  • [x] pandas/io/sas/sas.pyx

Sorry I just noticed that you have asked to specify which files to work on. I just have been using

grep -n -R -e '%s' -e '%d' -e '.format(' --include=*.{py,pyx} pandas/

To find any old formatting. I apologize

Sorry I just noticed that you have asked to specify which files to work on. I just have been using

@ForTimeBeing That's why I edited the post, glad you noticed:)

can you post what you worked on? just in case someone searches the comments.

Sure, I took;

  • [x] pandas/tests/resample/test_datetime_index.py
  • [x] pandas/tests/resample/test_time_grouper.py
  • [x] pandas/tests/tseries/offsets/common.py
  • [x] pandas/errors/__init__.py
  • [x] pandas/tests/arrays/interval/test_ops.py
  • [x] pandas/tests/arrays/sparse/test_array.py
  • [x] pandas/tests/arrays/sparse/test_libsparse.py
  • [x] pandas/tests/extension/arrow/arrays.py
  • [x] pandas/tests/extension/base/printing.py
  • [x] pandas/tests/extension/decimal/array.py
  • [x] pandas/tests/resample/test_datetime_index.py
  • [x] pandas/tests/resample/test_time_grouper.py
  • [x] pandas/tests/scalar/test_nat.py
  • [x] pandas/tests/tseries/offsets/common.py

and under

  • [x] pandas/tseries/frequencies.py

.format still exists and shows in the grep search, but there are no literals to change to fstring. Not sure if there is another way to do it or keep as is but all literals are swapped to fstring now in that file.

.format still exists and shows in the grep search, but there are no literals to change to fstring. Not sure if there is another way to do it or keep as is but all literals are swapped to fstring now in that file.

@ForTimeBeing
No problems:)
thank you for the PR:)

I took

  • [x] pandas/core/window/common.py
  • [x] pandas/core/window/ewm.py
  • [x] pandas/core/window/expanding.py
  • [x] pandas/core/window/rolling.py

ref #29952

I'll take:

  • [x] ci/print_skipped.py

  • [x] doc/make.py

  • [x] doc/sphinxext/announce.py

  • [x] doc/sphinxext/contributors.py

Working on: 'pandas/core/dtypes/dtypes.py'

Took:

  • [x] pandas/core/arrays/base.py
  • [x] pandas/core/arrays/datetimelike.py
  • [x] pandas/core/arrays/datetimes.py
  • [x] pandas/core/arrays/string_.py
  • [x] pandas/core/arrays/timedeltas.py
  • [x] pandas/core/common.py
  • [x] pandas/core/computation/align.py
  • [x] pandas/core/computation/engines.py
  • [x] pandas/core/computation/eval.py
  • [x] pandas/core/computation/expressions.py
  • [x] pandas/core/computation/expr.py
  • [x] pandas/core/computation/ops.py
  • [x] pandas/core/computation/pytables.py
  • [x] pandas/core/computation/scope.py
  • [x] pandas/core/frame.py
  • [x] pandas/core/generic.py
  • [x] pandas/core/strings.py

ref: #30116, #30135, #30363

I'll take:

  • [x] pandas/_libs/tslibs/frequencies.pyx
  • [x] pandas/_libs/tslibs/period.pyx
  • [x] pandas/_libs/tslibs/strptime.pyx

I have problem with predefined strings. I found the solution but I'm not sure if it's the right one.
Imagine the situation where you have predefined string like:
THE_MESSAGE = "Message with arguments. Arg1: {arg1}, Arg2: {arg2}."
Which is called with .format() like:
THE_MESSAGE.format(arg1_str, arg2_str).

Could I rewrite this by using lambda function in a way described below?
THE_MESSAGE = lambda arg1, arg2: f"Message with arguments. Arg1: {arg1}, Arg2: {arg2}."

and call it by
THE_MESSAGE(arg1_str, arg2_str)?

I know that would work I'm not sure if it's the best way to approach this problem :)

I have problem with predefined strings.

I completely understand, As pep 498 explains:

Regular strings are concatenated at compile time, and f-strings are concatenated at run time.

We need to think of a way to remove the use of .format() and use something else a string template.

The only thing I can think of at the moment is string.Template from stdlib, but I really don't know.

@jbrockmendel Can you help us out?

@MomIsBestFriend do you thing that lambda function is an overkill for this?

@MomIsBestFriend i think this may be a case where living with a few .formats is the way to go

@MomIsBestFriend do you thing that lambda function is an overkill for this?

I'm no way near an expert, please ask one of the developers.

took

  • [x] pandas/core/accessor.py
  • [x] pandas/core/algorithms.py

ref #30120

took

  • [x] pandas/core/arrays/sparse/accessor.py
  • [x] pandas/core/arrays/sparse/array.py
  • [x] pandas/core/arrays/sparse/dtype.py
  • [x] pandas/core/arrays/sparse/scipy_sparse.py

ref #30121

took

  • [x] pandas/core/arrays/_ranges.py
  • [x] pandas/core/arrays/integer.py
  • [x] pandas/core/arrays/interval.py
  • [x] pandas/core/arrays/numpy_.py
  • [x] pandas/core/arrays/period.py

ref #30124

I'll take

  • [x] pandas/io/formats/css.py
  • [x] pandas/io/formats/excel.py
  • [x] pandas/io/formats/style.py

Edit:
Taking:

  • [x] pandas/util/_decorators.py
  • [x] pandas/util/_depr_module.py

  • [x] pandas/util/_doctools.py

  • [x] pandas/util/_print_versions.py

  • [x] pandas/util/_test_decorators.py

  • [x] pandas/util/_tester.py

  • [x] pandas/util/testing.py

  • [x] pandas/util/_validators.py

I'll take

  • [ ] pandas/core/config_init.py
  • [x] pandas/core/construction.py
  • [x] pandas/core/dtypes/base.py
  • [x] pandas/core/dtypes/cast.py

thanks!

I'll take:

pandas/tests/plotting/test_converter.py

pandas/tests/plotting/test_datetimelike.py

pandas/tests/plotting/test_series.py

I'll take

  • [x] pandas/core/indexes/accessors.py
  • [x] pandas/core/indexes/category.py
  • [x] pandas/core/indexes/datetimelike.py
  • [x] pandas/core/indexes/datetimes.py
  • [x] pandas/core/indexes/frozen.py
  • [x] pandas/core/indexes/interval.py
  • [x] pandas/core/indexes/multi.py
  • [x] pandas/core/indexes/numeric.py
  • [x] pandas/core/indexes/period.py
  • [x] pandas/core/indexes/range.py
  • [x] pandas/core/indexes/timedeltas.py

30273

Hello, @MomIsBestFriend

pandas/tests/plotting/test_converter.py

pandas/tests/plotting/test_datetimelike.py

pandas/tests/plotting/test_series.py

Have been completed. Thank you.

Hello
I can take

  • [ ] pandas/core/dtypes/dtypes.py
  • [ ] pandas/core/dtypes/common.py

Thanks

Hello, I'll take

  • [x] setup.py
  • [x] pandas/_config/config.py
  • [x] pandas/_config/localization.py

Thanks!

I took:

  • pandas/core/missing.py
  • pandas/core/nanops.py
  • pandas/tests/indexes/datetimes/test_partial_slicing.py

Link to my pr: https://github.com/pandas-dev/pandas/pull/30278

I'll work on:

  • [ ] pandas/core/arrays/base.py

Here because of the tag "good first issue"

I'll take:

  • [ ] pandas/io/sql.py

  • [ ] pandas/io/stata.py

Thanks!

I'll do:

  • [x] pandas/core/resample.py
  • [x] pandas/core/indexing.py
  • [x] pandas/core/internals/construction.py
  • [x] pandas/core/internals/managers.py
  • [x] pandas/core/internals/blocks.py

i would like to take
i just now did a pull request on it

  • [x] pandas/core/indexers.pyz

Great, always wanted to chip in on Pandas. Will update when I know what I can fulfill in the next few weeks...

I can take
pandas/_version.py

Jumping on:

  • [ ] pandas/core/arrays/datetimelike.py
  • [x] pandas/io/formats/printing.py
  • [x] pandas/tests/extension/list/array.py
  • [x] pandas/tests/indexes/datetimes/test_ops.py
  • [x] pandas/tests/indexes/multi/test_analytics.py

I'll take pandas/io/formats/csvs.py

I'm taking:

  • [x] pandas/core/series.py (no old-fashioned string methods in code, only the documentation)
  • [x] pandas/core/tools/datetimes.py (changed code, will test and make pullrequest before dec 25th)

Question: Is there an answer on whether old-school string formatting should remain in the API reference?

For example, in series.map():

 It also accepts a function:

        >>> s.map('I am a {}'.format)
        0       I am a cat
        1       I am a dog
        2       I am a nan
        3    I am a rabbit
        dtype: object

Replacing this with an f-string example forces something like:

      >>> s.map(lambda x: f'I am a {x}')
        0       I am a cat
        1       I am a dog
        2       I am a nan
        3    I am a rabbit
        dtype: object

Which is not an exact replacement (f-string is not a function, I'm using the lambda to make it a function that replicates the net effect of 'I am a '.format() ), and raises some thorny issues about putting some not-best-practices in documentation.

For now, I am considering changing the documentation as out-of-scope, pending community decision on how to handle cases like this.

Already done (not sure by whom):
pandas/tests/arrays/interval/test_ops.py

I'll also take

  • [x] pandas/tests/scalar/interval/test_ops.py
  • [x] pandas/tests/computation/test_eval.py
  • [x] pandas/tests/dtypes/*
  • [x] pandas/tests/dtypes/cast/test_infer_dtype.py
  • [x] pandas/tests/dtypes/test_dtypes.py
  • [x] pandas/tests/dtypes/test_inference.py

Question: Is there an answer on whether old-school string formatting should remain in the API reference?

cc @WillAyd @jreback

I don't know what you consider the "old-school string format" to be but .format will have some use cases that f-strings don't cover (namely delayed parametrization) so sure that will still be around. I don't think we should have Py27 string format syntax anywhere though

I'lll take:

  • [x] pandas/tests/io/formats/test_css.py
  • [x] pandas/tests/io/formats/test_format.py
  • [x] pandas/tests/io/formats/test_printing.py
  • [x] pandas/tests/io/formats/test_style.py
  • [x] pandas/tests/io/formats/test_to_csv.py
  • [x] pandas/tests/io/formats/test_to_excel.py

I'll take

  • [x] pandas/compat/pickle_compat.py
  • [x] pandas/_config/config.py
  • [x] pandas/core/arrays/boolean.py

In #30601, I've taken on

  • [x] pandas/io/excel/_base.py
  • [x] pandas/io/excel/_odfreader.py
  • [x] pandas/io/excel/_openpyxl.py
  • [x] pandas/io/excel/_util.py
  • [x] pandas/io/excel/_xlwt.py
  • [x] pandas/tests/generic/test_frame.py
  • [x] pandas/tests/generic/test_generic.py
  • [x] pandas/tests/generic/test_series.py

I can take the two files below to start off with if that's fine!

  • [x] pandas/tests/base/test_conversion.py
  • [x] pandas/tests/base/test_ops.py

These changes have been done in #30604

Taking on:

  • [ ] pandas/core/ops/array_ops.py
  • [ ] pandas/core/ops/dispatch.py
  • [ ] pandas/core/ops/docstrings.py
  • [ ] pandas/core/ops/invalid.py
  • [ ] pandas/core/ops/methods.py
  • [ ] pandas/core/ops/roperator.py

Is there a preferred way to note old intended uses of .format that are left as is, in PRs? In the case of (incorrectly) assuming something is a good use case and it's overlooked in the PR

Working on

  • [x] pandas/tests/groupby/aggregate/test_other.py
  • [x] pandas/tests/groupby/test_apply.py
  • [x] pandas/tests/groupby/test_bin_groupby.py
  • [x] pandas/tests/groupby/test_categorical.py
  • [x] pandas/tests/groupby/test_counting.py
  • [x] pandas/tests/groupby/test_value_counts.py
  • [x] pandas/tests/groupby/test_function.py
  • [x] pandas/tests/groupby/test_groupby.py
  • [x] pandas/tests/groupby/test_transform.py
  • [x] pandas/tests/groupby/test_whitelist.py

I'll take

  • [X] scripts/validate_docstrings.py
  • [X]  scripts/tests/test_validate_docstrings.py
  • [X]  scripts/generate_pip_deps_from_conda.py
  • [X]  scripts/download_wheels.py
  • [X] pandas/tseries/holiday.py
  • [X] pandas/tests/window/test_window.py
  • [X] pandas/tests/util/test_validate_kwargs.py
  • [X]  pandas/tests/util/test_validate_args.py

I would like to try and take:

  • [x] pandas/tests/util/test_assert_almost_equal.py
  • [x] pandas/tests/util/test_assert_categorical_equal.py
  • [x] pandas/tests/util/test_assert_extension_array_equal.py
  • [x] pandas/tests/util/test_assert_frame_equal.py
  • [x] pandas/tests/util/test_assert_index_equal.py
  • [x] pandas/tests/util/test_assert_numpy_array_equal.py
  • [x] pandas/tests/util/test_validate_args_and_kwargs.py

I would like to take:

  • [x] pandas/core/arrays/period.py
  • [x] pandas/core/dtypes/common.py
  • [x] pandas/core/dtypes/dtypes.py
  • [x] pandas/core/frame.py

Thanks @HH-MWB

I will take:

  • [ ] pandas/core/arrays/timedeltas.py

I found a lot of code in @Appender() are using % to format string. Those code are using _shared_docs as a template, which is mostly defined in /pandas/core/generic.py and been used crossing multiple files.

I would like to replace all _shared_docs relevant formatting. This change will need to modified a lot of files, but I won't be able to check all other string formatting syntax in those files.

Does that sound good? Should I do it? @datapythonista @MomIsBestFriend

I found a lot of code in @Appender() are using % to format string. Those code are using _shared_docs as a template, which is mostly defined in /pandas/core/generic.py and been used crossing multiple files.

I would like to replace all _shared_docs relevant formatting. This change will need to modified a lot of files, but I won't be able to check all other string formatting syntax in those files.

Does that sound good? Should I do it? @datapythonista @MomIsBestFriend

@HH-MWB I don't really have a say on this, I think jreback and WillAyd and datapythonista (Not tagging because I don't want to bother them), can help you out more than I can :)

What are you trying to replace with Appender? I don’t think can be f-strings

Would be ok with .format replacing the Py27 syntax but probably worth opening a separate issue to discuss

What are you trying to replace with Appender? I don’t think can be f-strings

Would be ok with .format replacing the Py27 syntax but probably worth opening a separate issue to discuss

@WillAyd I do think that string.Template from stdlib, is the right method to this.
Any thoughts?

Hi @WillAyd, sorry I didn't make it clear. Yes, my original idea was replacing % by .format, and also replacing code like %(XXX)s to be {XXX} in the _shared_docs template. Like @MomIsBestFriend said, string.Template would be another choice.

I opened a separate issue for more discussion. Thanks!

Taking on:

  • [x] pandas/tests/reshape/test_reshape.py
  • [x] pandas/tests/scalar/period/test_period.py

ref #31412

@MomIsBestFriend Hello! First time open-source contributor here! I am very excited for my first PR! I will try working on the following files:
versioneer.py
web/pandas_web.py
Thanks!!

@drewseibert versioneer.py is vendored, so we dont want to edit it @MomIsBestFriend can you remove this from the list to avoid this confusion

@jbrockmendel Thanks for the heads up. Along with that, it appears the other file I mentioned "web/pandas_web.py" has been worked on already as well. Both can be removed from the work list.

Also, I am getting 403 permissions error when I try to push a commit. I added an SSH key and tried setting the remote URL. Not working for me whether I clone with SSH or HTTPS. Any help is appreciated! Thanks!

@MomIsBestFriend Hello! First time open-source contributor here! I am very excited for my first PR! I will try working on the following files:
versioneer.py
web/pandas_web.py
Thanks!!

Good luck @drewseibert

I'll take:

pandas/core/reshape/concat.py
pandas/core/reshape/melt.py
pandas/core/reshape/merge.py
pandas/core/reshape/pivot.py
pandas/core/reshape/reshape.py

Working on this one now:

pandas/tests/io/test_pickle.py

Hi
I'll take

pandas/util/_print_versions.py

pandas/util/_test_decorators.py

https://github.com/pandas-dev/pandas/pull/31628 should be okay :)

I'll take pandas/tests/frame/test_repr_info.py

ref: https://github.com/pandas-dev/pandas/pull/31639

Hey, I'll take

  • [ ] pandas/core/arrays/integer.py

The following files can be checked off on the list...
web/pandas_web.py
pandas/tests/io/test_pickle.py

Thanks!

Another one to check off.. no f-strings needed in the file:
pandas/tests/series/indexing/test_boolean.py

I will work on this one now...

pandas/tests/series/indexing/test_indexing.py

Thank you @drewseibert

Is there still work remaining here? I want to contribute

@3vts Yes, of course :)

I think you can take

pandas/tests/util/test_assert_extension_array_equal.py


LMK if you want more.

Something I can help with! It will be my first open source contribution, so I may need some help. I have read some how to contribute articles, but still.

Which ones would you like me to handle?

@MomIsBestFriend seems like pandas/tests/util/test_assert_extension_array_equal.py was fixed on PR #30816, also, I already have the environment set up. Can you give me some load to work with?

@3vts @GrizzledLabs - feel free to take any of the files that haven’t been done yet in the list above (and check no one else is working on it) - then comment on here what you are working on! Thanks !

pandas/core/arrays/boolean.py appears to already be done. I saw one f'string and no .format(), unless I missed it.

pandas/core/dtypes/common.py appears to be done already as well. f'strings but no .format()

Are some of these fixes spanning multiple files? A few don't contain a single .format(), and I am wondering if there are functions called between files? Would a single fix require changing multiple files?

Hi, First time contributer here! Excited to get going!
Initially I wanted to take these:

pandas/compat/pickle_compat.py
pandas/_config/config.py

but then I saw it's been done and merged, @MomIsBestFriend can you please update the list at the top to tick them as done?

I will take these:

  • [ ] pandas/tests/io/parser/test_usecols.py

  • [ ] pandas/tests/io/pytables/conftest.py

  • [ ] pandas/tests/io/pytables/test_store.py

  • [ ] pandas/tests/io/pytables/test_timezones.py

@MomIsBestFriend reviewing the thread I found there is an exception for the predefined strings. Does this still apply? Or we have now. a workaround?

I have problem with predefined strings.

I completely understand, As pep 498 explains:

Regular strings are concatenated at compile time, and f-strings are concatenated at run time.

We need to think of a way to remove the use of .format() and use something else a string template.

The only thing I can think of at the moment is string.Template from stdlib, but I really don't know.

@jbrockmendel Can you help us out?

Hi there, first-time contributor 👋 . I'll take:

  • [ X ] pandas/tests/tseries/frequencies/test_inference.py
  • [ X ] pandas/tests/series/methods/test_argsort.py
  • [ X ] pandas/tests/series/test_constructors.py
  • [ X ] pandas/tests/indexing/common.py
  • [ X ] pandas/tests/indexing/test_coercion.py
  • [ X ] pandas/tests/indexing/test_iloc.py
  • [ X ] pandas/tests/indexing/test_indexing.py
  • [ X ] pandas/tests/indexing/test_loc.py
  • [ X ] pandas/tests/indexes/common.py
  • [ X ] pandas/tests/indexes/datetimelike.py

@monicaw218, I'd start with just one file, and once your pull request is merged you can continue with the rest. The first contribution is usually trickier than expected, and for us (reviewers) it usually helps too if pull requests are small. Specially for new contributors, where more feedback may be needed.

These two files can be checked off the list:
👍
pandas/io/parsers.py
pandas/io/pytables.py

These are also good to go:

pandas/tests/groupby/test_apply.py
pandas/tests/groupby/test_bin_groupby.py

These are ready on #31914
"pandas/tests/extension/decimal/test_decimal.py"
"pandas/tests/frame/indexing/test_categorical.py"
"pandas/tests/frame/methods/test_describe.py"
"pandas/tests/frame/methods/test_duplicated.py"
"pandas/tests/frame/methods/test_to_dict.py"
"pandas/tests/frame/test_alter_axes.py"
"pandas/tests/frame/test_api.py"
"pandas/tests/frame/test_constructors.py"
"pandas/tests/frame/test_dtypes.py"
"pandas/tests/frame/test_join.py"

I'll take "pandas/io/sas/sas_xport.py".

These are ready on #31933

"pandas/tests/frame/test_operators.py"
"pandas/tests/frame/test_reshape.py"
"pandas/tests/frame/test_timeseries.py"
"pandas/tests/indexes/datetimes/test_scalar_compat.py"
"pandas/tests/indexes/datetimes/test_tools.py"
"pandas/tests/indexes/interval/test_indexing.py"
"pandas/tests/indexes/interval/test_interval.py"

These are included in #31945

"pandas/tests/indexes/interval/test_setops.py"
"pandas/tests/indexes/multi/test_compat.py"
"pandas/tests/indexes/period/test_constructors.py"
"pandas/tests/indexes/timedeltas/test_constructors.py"
"pandas/tests/indexing/test_floats.py"

These are included in #31963

"pandas/tests/internals/test_internals.py"
"pandas/tests/io/excel/test_readers.py"
"pandas/tests/io/excel/test_style.py"
"pandas/tests/io/excel/test_writers.py"
"pandas/tests/io/excel/test_xlrd.py"
"pandas/tests/io/formats/test_console.py"
"pandas/tests/io/formats/test_to_html.py"
"pandas/tests/io/formats/test_to_latex.py"
"pandas/tests/io/generate_legacy_storage_files.py"

These are included in #31967

"pandas/tests/io/parser/test_c_parser_only.py"
"pandas/tests/io/parser/test_common.py"
"pandas/tests/io/parser/test_compression.py"
"pandas/tests/io/parser/test_encoding.py"
"pandas/tests/io/parser/test_multi_thread.py"
"pandas/tests/io/parser/test_na_values.py"
"pandas/tests/io/parser/test_parse_dates.py"
"pandas/tests/io/parser/test_read_fwf.py"
"pandas/tests/io/pytables/conftest.py"
"pandas/tests/io/pytables/test_store.py"

These are included in #31980

"pandas/tests/io/pytables/test_timezones.py"
"pandas/tests/io/test_html.py"
"pandas/tests/io/test_stata.py"
"pandas/tests/resample/test_period_index.py"
"pandas/tests/reshape/merge/test_join.py"
"pandas/tests/reshape/merge/test_merge.py"
"pandas/tests/reshape/merge/test_merge_asof.py"
"pandas/tests/reshape/test_melt.py"
"pandas/tests/reshape/test_pivot.py"
"pandas/tests/scalar/timedelta/test_constructors.py"

These are included in #31986

"pandas/tests/scalar/timestamp/test_constructors.py"
"pandas/tests/scalar/timestamp/test_rendering.py"
"pandas/tests/scalar/timestamp/test_unary_ops.py"
"pandas/tests/series/methods/test_nlargest.py"
"pandas/tests/series/test_analytics.py"
"pandas/tests/series/test_api.py"
"pandas/tests/series/test_dtypes.py"
"pandas/tests/series/test_ufunc.py"

Added my first pull request with this https://github.com/pandas-dev/pandas/pull/32007:
pandas/tests/frame/test_to_csv.py

These are included in #32032

"pandas/tests/test_downstream.py"
"pandas/tests/test_multilevel.py"
"pandas/tests/tools/test_numeric.py"
"pandas/tests/tseries/frequencies/test_inference.py"
"pandas/tests/tslibs/test_parse_iso8601.py"
"pandas/tests/window/moments/test_moments_rolling.py"

This file is included in #32029:

  • pandas/tests/arrays/categorical/test_analytics.py

File included in https://github.com/pandas-dev/pandas/pull/32044

  • scripts/find_commits_touching_func.py

These are included in #32034

"pandas/core/arrays/interval.py"
"pandas/core/util/hashing.py"
"pandas/io/formats/format.py"
"pandas/io/formats/html.py"
"pandas/io/formats/latex.py"
"pandas/io/formats/printing.py"
"pandas/io/parsers.py"
"pandas/tests/arrays/categorical/test_dtypes.py"
"pandas/tests/arrays/categorical/test_operators.py"

These ones are done...

pandas/core/ops/invalid.py
pandas/core/ops/methods.py
pandas/core/ops/roperator.py

Files included in #32063:

  • pandas/tests/tseries/frequencies/test_inference.py
  • pandas/tests/tslibs/test_parse_iso8601.py

Hi, I want to take scripts/validate_docstrings.py

File included in the pull request #32189

  • pandas/tests/indexes/datetimes/test_to_period.py

Is this issue resolved? I have been looking at files unmarked on the list at the top of this thread, it seems like the .format() strings have been converted

pandas//util/_decorators.py is done (the line that fails is a comment)

pandas//core/indexes/base.py should be marked off (failure is from a comment again)

Hi, I started looking at pandas/core/generic.py and quickly realised that changing the string templates from a string interpolated with % to a string.Template will require changes in many places where Substitute+Appender decorators are used.

Do you aim to remove all usage of % string interpolation, in which case this work will be necessary, or are you ok with some use of % interpolation?

@smartvinnetou When it comes to the Appender and Substitute we are now trying to replace those with the doc decorator. see https://github.com/pandas-dev/pandas/issues/31942

@smartvinnetou When it comes to the Appender and Substitute we are now trying to replace those with the doc decorator. see #31942

@MomIsBestFriend do you prefer to skip the upgrade of pandas/core/generic.py in this ticket and do it under #31942 ? Or should I replace Appender and Subtitute decorators in generic.py with your new doc decorator under this ticket to remove the old % interpolation?

@smartvinnetou When it comes to the Appender and Substitute we are now trying to replace those with the doc decorator. see #31942

@MomIsBestFriend do you prefer to skip the upgrade of pandas/core/generic.py in this ticket and do it under #31942 ? Or should I replace Appender and Subtitute decorators in generic.py with your new doc decorator under this ticket to remove the old % interpolation?

@smartvinnetou Under #31942 in the case of pandas/core/generic.py (If I understood correctly)

Hi, found quite a lot of files that were either done or needed no changes, but were marked as not done. Just wanted to ask if this issue was solved and been accidentally not marked or you guys are still working on it. If it's not solved, I would like to contribute as well. These were some of the files that were done but not marked

  • pandas/core/generic.py
  • pandas/core/arrays/datetimes.py
  • pandas/core/arrays/integer.py
  • pandas/core/arrays/period.py
  • pandas/core/arrays/timedeltas.py
  • pandas/core/config_init.py
  • pandas/core/dtypes/dtypes.py
  • pandas/core/frame.py

@sachinh35 I have updated the list :)

It got hard to keep track

Thanks for updating the list! @MomIsBestFriend

I would like to contribute with #32939 for files under pandas/core/ops/. How should one handle the docstrings as for example https://github.com/pandas-dev/pandas/blob/master/pandas/core/ops/docstrings.py#L564 which are sometimes imported in other files as well? Wrapping in functions?

I changed

  • pandas/core/sorting.py
  • pandas/tests/indexes/datetimes/test_date_range.py
  • pandas/tests/indexes/interval/test_interval.py
  • pandas/tests/indexing/test_coercion.py
  • pandas/tests/reshape/test_concat.py
  • pandas/util/_decorators.py

The two files were modified:
pandas/_libs/tslibs/timedeltas.pyx
pandas/_libs/tslibs/timestamps.pyx

Note that there was no issues in the following ones. You can mark as done too:
pandas/_libs/tslibs/c_timestamp.pyx
pandas/_libs/tslibs/frequencies.pyx
pandas/_libs/tslibs/parsing.pyx
pandas/_libs/tslibs/period.pyx
pandas/_libs/tslibs/strptime.pyx

note: this is my first PR ever. Let me know if something need to be improved.

I've went through the topic to update the list + check some files.

Files marked as done without any commit

(no need to change anything):

  • [x] pandas/_config/config.py
  • [x] pandas/_version.py
  • [x] pandas/compat/pickle_compat.py
  • [x] pandas/core/computation/pytables.py
  • [x] pandas/core/indexes/base.py
  • [x] pandas/core/indexes/multi.py
  • [x] pandas/core/indexes/range.py
  • [x] pandas/core/ops/__init__.py
  • [x] pandas/core/ops/docstrings.py
  • [x] pandas/core/reshape/merge.py
  • [x] pandas/core/tools/datetimes.py
  • [x] pandas/io/formats/css.py
  • [x] pandas/io/formats/excel.py
  • [x] pandas/io/formats/format.py
  • [x] pandas/io/formats/html.py
  • [x] pandas/io/formats/info.py
  • [x] pandas/io/formats/latex.py
  • [x] pandas/io/formats/printing.py
  • [x] pandas/io/formats/style.py
  • [x] pandas/io/parsers.py
  • [x] pandas/io/pytables.py
  • [x] pandas/io/sas/sas_xport.py
  • [x] pandas/io/stata.py
  • [x] pandas/tests/arrays/categorical/test_operators.py
  • [x] pandas/tests/arrays/test_datetimelike.py
  • [x] pandas/tests/dtypes/test_dtypes.py
  • [x] pandas/tests/extension/base/setitem.py
  • [x] pandas/tests/frame/test_constructors.py
  • [x] pandas/tests/frame/test_missing.py
  • [x] pandas/tests/frame/test_to_csv.py
  • [x] pandas/tests/groupby/aggregate/test_other.py
  • [x] pandas/tests/indexes/datetimes/test_datetime.py
  • [x] pandas/tests/indexes/datetimes/test_formats.py
  • [x] pandas/tests/indexes/datetimes/test_partial_slicing.py
  • [x] pandas/tests/indexes/interval/test_constructors.py
  • [x] pandas/tests/indexes/multi/test_format.py
  • [x] pandas/tests/indexes/period/test_formats.py
  • [x] pandas/tests/indexes/timedeltas/test_timedelta.py
  • [x] pandas/tests/indexing/test_categorical.py
  • [x] pandas/tests/io/excel/test_openpyxl.py
  • [x] pandas/tests/io/excel/test_writers.py
  • [x] pandas/tests/io/formats/test_format.py
  • [x] pandas/tests/io/formats/test_printing.py
  • [x] pandas/tests/io/formats/test_style.py
  • [x] pandas/tests/io/formats/test_to_csv.py
  • [x] pandas/tests/io/formats/test_to_html.py
  • [x] pandas/tests/io/formats/test_to_latex.py

Remaining files to check:

  • [ ] pandas/core/arrays/datetimelike.py
  • [ ] pandas/tests/io/parser/test_compression.py
  • [ ] pandas/tests/io/parser/test_encoding.py
  • [ ] pandas/tests/io/parser/test_header.py
  • [ ] pandas/tests/io/parser/test_parse_dates.py
  • [ ] pandas/tests/io/parser/test_usecols.py
  • [ ] pandas/tests/io/test_html.py
  • [ ] pandas/tests/io/test_sql.py
  • [ ] pandas/tests/io/test_stata.py
  • [ ] pandas/tests/reductions/test_reductions.py
  • [ ] pandas/tests/reshape/test_melt.py
  • [ ] pandas/tests/scalar/period/test_period.py
  • [ ] pandas/tests/scalar/timedelta/test_timedelta.py
  • [ ] pandas/tests/scalar/timestamp/test_constructors.py
  • [ ] pandas/tests/series/indexing/test_numeric.py
  • [ ] pandas/tests/series/indexing/test_take.py
  • [ ] pandas/tests/series/indexing/test_where.py
  • [ ] pandas/tests/series/methods/test_rename.py
  • [ ] pandas/tests/series/test_api.py
  • [ ] pandas/tests/series/test_constructors.py
  • [ ] pandas/tests/series/test_datetime_values.py
  • [ ] pandas/tests/series/test_repr.py
  • [ ] pandas/tests/test_strings.py
  • [ ] pandas/tests/tools/test_to_datetime.py
  • [ ] pandas/tests/tseries/holiday/test_calendar.py
  • [ ] pandas/tests/tseries/holiday/test_holiday.py
  • [ ] pandas/tests/tslibs/test_parsing.py
  • [ ] pandas/tests/util/test_assert_frame_equal.py
  • [ ] pandas/tseries/frequencies.py
  • [ ] pandas/util/_test_decorators.py
  • [ ] pandas/util/_validators.py

I took care of pandas/util/_validators.py. Many of these other files already seem ok to me too.

  • [x] pandas/util/_test_decorators.py
  • [x] pandas/tseries/frequencies.py
  • [x] pandas/tests/util/test_assert_frame_equal.py
  • [x] pandas/tests/tslibs/test_parsing.py
  • [x] pandas/tests/tseries/holiday/test_holiday.py
  • [x] pandas/tests/tseries/holiday/test_calendar.py
  • [x] pandas/tests/tools/test_to_datetime.py
  • [x] pandas/tests/test_strings.py
  • [x] pandas/tests/series/test_repr.py
  • [x] pandas/tests/series/test_datetime_values.py
  • [x] pandas/tests/series/test_constructors.py
  • [x] pandas/tests/series/test_api.py

Hi Matteo,
I'm interested in helping with this effort, but am new to git and
contributing to pandas. Would you possibly be able to walk me through the
steps ? Perhaps I can setup a screen share this week?

Thanks,
Andrew

On Tue, May 26, 2020, 3:12 PM Matteo Santamaria notifications@github.com
wrote:

I took care of pandas/util/_validators.py. Many of these other files
already seem ok to me too.

  • pandas/util/_test_decorators.py
  • pandas/tseries/frequencies.py
  • pandas/tests/util/test_assert_frame_equal.py
  • pandas/tests/tslibs/test_parsing.py
  • pandas/tests/tseries/holiday/test_holiday.py
  • pandas/tests/tseries/holiday/test_calendar.py
  • pandas/tests/tools/test_to_datetime.py
  • pandas/tests/test_strings.py
  • pandas/tests/series/test_repr.py
  • pandas/tests/series/test_datetime_values.py
  • pandas/tests/series/test_constructors.py
  • pandas/tests/series/test_api.py


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pandas-dev/pandas/issues/29547#issuecomment-634307953,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/APG73XKAUDLFVVQXUS2SJETRTQ5DDANCNFSM4JLZCU5Q
.

Hey @warden706, I'm actually pretty new here too, so I wouldn't have much to show you. I've found this resource very helpful as I've stumbled around, you should check it out.

Hi,
pretty new to contributing also here. I'm taking care of

  • [x] pandas/tests/io/parser/test_header.py
  • [x] pandas/tests/io/test_sql.py
  • [x] pandas/tests/io/test_html.py
  • [x] pandas/tests/reductions/test_reductions.py
  • [x] pandas/tests/reshape/test_melt.py
  • [x] pandas/tests/scalar/timedelta/test_timedelta.py

I checked these other files and seem ok to me

  • [X] pandas/tests/io/parser/test_compression.py
  • [X] pandas/tests/io/parser/test_encoding.py
  • [X] pandas/tests/io/parser/test_parse_dates.py
  • [X] pandas/tests/io/parser/test_usecols.py
  • [X] pandas/tests/io/test_stata.py
  • [X] pandas/tests/scalar/period/test_period.py
  • [X] pandas/tests/scalar/timestamp/test_constructors.py

i'm also new here.
i'll take

  • [ ] pandas/tests/series/indexing/test_numeric.py
  • [ ] pandas/tests/series/indexing/test_take.py
  • [ ] pandas/tests/series/indexing/test_where.py

i have a question regarding the code change.
for instance, in pandas/tests/series/indexing/test_take.py, snippet of the code:

 msg = "index {} is out of bounds for( axis 0 with)? size 5"
 with pytest.raises(IndexError, match=msg.format(10)):
     ser.take([1, 10])

so my suggestion is to replace it to:

msg = lambda x: f"index {x} is out of bounds for( axis 0 with)? size 5"
with pytest.raises(IndexError, match=msg(10)):
    ser.take([1, 10])

is that good enough?

Hi,
I'd like to make a PR, so I'm running the test, but I'm having a couple of fails. So I tried to run tests also on master.
Is it normal that running pytest pandas on unedited forked master returns a couple of fails?

Master should generally pass the tests. Make sure you've pulled the latest commits. Which tests are failing?

@matteosantama I pulled last commits, re-installed the environment an re-run the tests with pytest pandas. These are the results

================= short test summary info =================
FAILED pandas/tests/io/test_parquet.py::TestParquetFastParquet::test_s3_roundtrip - ValueError: Invalid timestamp "Ven, 29 Mag 2020 07:59:19 GMT": Unknown string format: Ven, 29 Mag 2020 07:59:19 GMT
FAILED pandas/tests/plotting/test_datetimelike.py::TestTSPlot::test_ts_plot_with_tz['UTC'] - AttributeError: 'numpy.datetime64' object has no attribute 'hour'
================= 2 failed, 87804 passed, 1185 skipped, 1005 xfailed, 5637 warnings in 2437.06s (0:40:37) =================

I noticed that if I run tests only on the single directory (for example with pytest pandas/tests/io), there are no fails:

 7273 passed, 344 skipped, 53 xfailed, 5584 warnings in 351.76s (0:05:51) 

Since the @OlivierLuG comment, it seems like almost all of the files have been corrected or were already ok without any modification. I'll try to update the list about the "still open" files.

Corrected

  • [X] pandas/util/_validators.py
  • [X] pandas/tests/io/parser/test_header.py
  • [X] pandas/tests/io/test_sql.py
  • [X] pandas/tests/reductions/test_reductions.py

No need to modification

  • [X] pandas/util/_test_decorators.py
  • [X] pandas/tseries/frequencies.py
  • [X] pandas/tests/util/test_assert_frame_equal.py
  • [X] pandas/tests/tslibs/test_parsing.py
  • [X] pandas/tests/tseries/holiday/test_holiday.py
  • [X] pandas/tests/tseries/holiday/test_calendar.py
  • [X] pandas/tests/tools/test_to_datetime.py
  • [X] pandas/tests/test_strings.py
  • [X] pandas/tests/series/test_repr.py
  • [X] pandas/tests/series/test_datetime_values.py
  • [X] pandas/tests/series/test_constructors.py
  • [X] pandas/tests/series/test_api.py
  • [X] pandas/tests/io/parser/test_compression.py
  • [X] pandas/tests/io/parser/test_encoding.py
  • [X] pandas/tests/io/parser/test_parse_dates.py
  • [X] pandas/tests/io/parser/test_usecols.py
  • [X] pandas/tests/io/test_stata.py
  • [X] pandas/tests/scalar/period/test_period.py
  • [X] pandas/tests/scalar/timestamp/test_constructors.py
  • [X] pandas/tests/io/test_html.py
  • [X] pandas/tests/reshape/test_melt.py
  • [X] pandas/tests/scalar/timedelta/test_timedelta.py

Moreover, I think that also this is already ok

  • [X] pandas/core/arrays/datetimelike.py
  • [X] pandas/tests/series/methods/test_rename.py

Still to check/correct

  • [x] pandas/tests/series/indexing/test_numeric.py
  • [x] pandas/tests/series/indexing/test_take.py
  • [x] pandas/tests/series/indexing/test_where.py

@DanBasson do you have any update?

i keep getting errors which i don't know what they mean.
any help will be appreciated

Have you tried to fetch the latest modifications on master? Maybe it will fix some of the failed tests.

it didn't help.
if someone else wants to take it, you can

I have a doubt: when we have a situation like in pandas/tests/reshape/test_melt.py:

msg = "The following '{Var}' are not present in the DataFrame: {Col}"
...
with pytest.raises(KeyError, match=msg.format(Var="value_vars", Col="\\['C'\\]")):
...
with pytest.raises(KeyError, match=msg.format(Var="id_vars", Col="\\['A'\\]")):
...

and so on, should we transform msg to a function and call it with different values of "Col"? Or is it better to leave it as it is?

@MatteoFelici thanks for that updated list. I checked the last few remaining modules you called out and this looks OK, so I think we can close this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scls19fr picture scls19fr  ·  3Comments

Abrosimov-a-a picture Abrosimov-a-a  ·  3Comments

MatzeB picture MatzeB  ·  3Comments

amelio-vazquez-reina picture amelio-vazquez-reina  ·  3Comments

matthiasroder picture matthiasroder  ·  3Comments