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 docstring of read_csv and related methods

See original GitHub issue

The next Excel related functions contain many errors as reported by scripts/validate_docstrings.py:

  • pandas.read_table
  • pandas.read_csv
  • pandas.read_fwf

We should fix them, following our standards: https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html

The validation script should not report errors after they are fixed.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
datapythonistacommented, Nov 5, 2018

For 1, I think there is a missing blank line between the name/type line, and the directive. Not sure if that’s the cause. But I guess it’s related to the .. deprecated:: directive. You can also do a grep of that directive, see if docstrings containing it for a parameter have the same validation error, and if you think it’s a problem in the validation script, ignore the error and create an issue (mention #20298 and myself in the issue, so I add it to the list).

For 2, you can add a couple of prints in the property double_blank_lines for debugging (don’t commit that).One that prints every line, and one that prints when the two blank lines are found. That should give you a better idea of what’s the exact problem.

Let me know if you need help.

0reactions
datapythonistacommented, Nov 5, 2018

This one is a bit tricky. We validate that the signature and the documented parameters match. So:

def foo(arg1, **kwargs):
    """
    Parameters
    -----------
    arg1 : str
    arg2 : str
    """

Will generate an error that arg2 is unknown, and kwargs is not documented. Which makes sense.

What happen is that read_fwf was implemented, so most of the parameters are not explicit in the signature, but kwargs is used instead.

Personally, I think the right solution is to change the signature, and add all them. But that’s trickier than just changing the docstrings. Shouldn’t break anything, but it’s more risky than just touching docs.

@jreback any reason why we should not add these parameters to the signature?

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas docstring guide — pandas 1.5.2 documentation
About docstrings and standards#. A Python docstring is a string used to document a Python module, class, function or method, so programmers can...
Read more >
Complete Guide to Python Docstring - eduCBA
Class Docstrings are the documentation for the class and its relevant methods. The purpose of the class docstring is to provide a clear...
Read more >
Documenting Python Code: A Complete Guide
Module docstrings are similar to class docstrings. Instead of classes and class methods being documented, it's now the module and any functions found...
Read more >
Insert docstring attributes in a python file - Stack Overflow
Get the existing docstring using ast. · Create a new ast node with amended content · If the existing dostring is None ,...
Read more >
Python Docstrings (With Examples) - Programiz
Python __doc__ attribute. Whenever string literals are present just after the definition of a function, module, class or method, they are associated with...
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