question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DOC: Fix formatting of parameters

See original GitHub issue

In the pandas API documentation, when the parameters are defined, they should be defined as:

Parameters
----------
name : str
    Description of the name parameter

Note that in name : str there is one space before the colon, and one after. This is important, because when the html documentation is rendered, if those spaces are not found, the name of the parameter is not splitted from the type, and everything is rendered as if everything was the name.

See for example in the bins parameter of Series.hist (note that in this case there are two of them, and the second should be removed, instead of fixing the spaces).

This happens in many docstrings, and it should be fixed to ensure that the documentation is rendered correctly.

We have a script to generate the whole list or cases where this happens:

./scripts/validate_docstrings.py --errors=PR10
pandas.read_msgpack: Parameter "encoding" requires a space before the colon separating the parameter name and type
pandas.read_excel: Parameter "engine" requires a space before the colon separating the parameter name and type
pandas.ExcelWriter: Parameter ".. versionadded" requires a space before the colon separating the parameter name and type
pandas.read_json: Parameter "chunksize" requires a space before the colon separating the parameter name and type
pandas.HDFStore.append: Parameter "format" requires a space before the colon separating the parameter name and type
pandas.read_feather: Parameter "use_threads" requires a space before the colon separating the parameter name and type
pandas.read_parquet: Parameter "columns" requires a space before the colon separating the parameter name and type
pandas.Series.asfreq: Parameter "fill_value" requires a space before the colon separating the parameter name and type
pandas.Series.plot.hist: Parameter "bins" requires a space before the colon separating the parameter name and type
pandas.Series.hist: Parameter "bins" requires a space before the colon separating the parameter name and type
pandas.Series.to_string: Parameter "header" requires a space before the colon separating the parameter name and type
pandas.DataFrame.asfreq: Parameter "fill_value" requires a space before the colon separating the parameter name and type
pandas.DataFrame.from_csv: Parameter "infer_datetime_format" requires a space before the colon separating the parameter name and type
pandas.Panel.asfreq: Parameter "fill_value" requires a space before the colon separating the parameter name and type
pandas.DatetimeIndex.to_perioddelta: Parameter "freq" requires a space before the colon separating the parameter name and type
pandas.TimedeltaIndex: Parameter "unit" requires a space before the colon separating the parameter name and type
pandas.Period.to_timestamp: Parameter "how" requires a space before the colon separating the parameter name and type
pandas.Timestamp.replace: Parameter "nanosecond" requires a space before the colon separating the parameter name and type
pandas.tseries.offsets.SemiMonthEnd: Parameter "n" requires a space before the colon separating the parameter name and type
pandas.tseries.offsets.SemiMonthEnd: Parameter "day_of_month" requires a space before the colon separating the parameter name and type
pandas.tseries.offsets.SemiMonthBegin: Parameter "n" requires a space before the colon separating the parameter name and type
pandas.tseries.offsets.SemiMonthBegin: Parameter "day_of_month" requires a space before the colon separating the parameter name and type
pandas.core.groupby.DataFrameGroupBy.boxplot: Parameter "subplots " requires a space before the colon separating the parameter name and type
pandas.core.resample.Resampler.asfreq: Parameter "fill_value" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "data" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "precision" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "table_styles" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "uuid" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "caption" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler: Parameter "cell_ids" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.format: Parameter "formatter" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.format: Parameter "subset" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_precision: Parameter "precision" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_table_styles: Parameter "table_styles" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_caption: Parameter "caption" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_properties: Parameter "subset" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_properties: Parameter "kwargs" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.set_uuid: Parameter "uuid" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_max: Parameter "subset" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_max: Parameter "color" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_max: Parameter "axis" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_min: Parameter "subset" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_min: Parameter "color" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_min: Parameter "axis" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.highlight_null: Parameter "null_color" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.background_gradient: Parameter "cmap" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.background_gradient: Parameter "low, high" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.background_gradient: Parameter "axis" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.background_gradient: Parameter "subset" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.background_gradient: Parameter "text_color_threshold" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.render: Parameter "`**kwargs`" requires a space before the colon separating the parameter name and type
pandas.io.formats.style.Styler.use: Parameter "styles" requires a space before the colon separating the parameter name and type
pandas.plotting.andrews_curves: Parameter "color" requires a space before the colon separating the parameter name and type
pandas.plotting.andrews_curves: Parameter "kwds" requires a space before the colon separating the parameter name and type
pandas.plotting.lag_plot: Parameter "series" requires a space before the colon separating the parameter name and type
pandas.plotting.lag_plot: Parameter "lag" requires a space before the colon separating the parameter name and type
pandas.plotting.lag_plot: Parameter "ax" requires a space before the colon separating the parameter name and type
pandas.plotting.lag_plot: Parameter "kwds" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "frame" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "class_column" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "cols" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "ax" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "color" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "use_columns" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "xticks" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "colormap" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "axvlines" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "axvlines_kwds" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "sort_labels" requires a space before the colon separating the parameter name and type
pandas.plotting.parallel_coordinates: Parameter "kwds" requires a space before the colon separating the parameter name and type
pandas.set_option: Parameter "value " requires a space before the colon separating the parameter name and type
pandas.api.types.union_categoricals: Parameter "ignore_order" requires a space before the colon separating the parameter name and type
pandas.Series.as_matrix: Parameter "columns" requires a space before the colon separating the parameter name and type
pandas.Series.from_csv: Parameter "infer_datetime_format" requires a space before the colon separating the parameter name and type
pandas.DataFrame.as_matrix: Parameter "columns" requires a space before the colon separating the parameter name and type
pandas.Panel.as_matrix: Parameter "columns" requires a space before the colon separating the parameter name and type

Calling the same script with the parameter --format=azure can be useful, as it reports also the file and the line where the function is defined. Python introspection is used to obtain them, and it probably won’t be correct if the function is created dynamically, but it could be helpful in many cases. Using grep "encoding:" is also an option (encoding is the name of the parameter of the first detected failing case).

We should add all the missing spaces and fix all the formats. Executing the script after this has been done, should report no errors.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-ponomaroffcommented, Nov 16, 2018

I would like to work on this.

0reactions
alexander-ponomaroffcommented, Nov 16, 2018

@datapythonista Thank you, I will look into this and create some issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOC: Fix formatting errors in docstrings · Issue #27977 - GitHub
DOC : Fix formatting errors in docstrings #27977 ... 'GL08': 'The object does not have a docstring', 'PR01': 'Parameters {missing_params} not ...
Read more >
Parameters - Markup Formatting Reference - Apple Developer
Describes the markup formatting language used for creating rich playgrounds, documenting swift code, and adding developer symbols to ...
Read more >
Change the default settings for new documents
Open the template or a document based on the template whose default settings you ... On the Format menu, click Document, and then...
Read more >
Advanced Microsoft Word - Formatting Your Document
If you like this video, here's my entire playlist of Word tutorials: http://bit.ly/2FY6NVTLearn how you can format your Microsoft Word ...
Read more >
Fix common formatting issues for custom parameters
Use single or double quotes for string custom parameters. Either single or double quotes will work, but should always be consistent. Example: If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found