How to Ask Coding Questions

How to Ask Coding Questions

Being able to ask questions in a clear and comprehensible way is a skill worth practicing because not only does it help you get better answers for your questions, others might also benefit from those answers. What we also find is that as we write out our coding questions, the process actually helps us troubleshoot and think of potential solutions.

The following resource is adapted from Darren Jones’s post on asking “GOOD” questions on realpython.com. For those looking for more specific, see How to Ask a Question on Stack Overflow) and more advanced Python help. 

  • G: ? Give context on what you are trying to do, clearly describing the problem. Include screenshots or code.

Example: I have a pandas dataframe (list_comments) with a list of comments that contains either the keywords “climate change” or “global warming.” At the step where I’m getting the error, I am trying to separate my list_comments into ones that contain “climate change” and ones that contain “global warming.” Then I get this error in the screenshot.

Screenshot:

  • O: Outline possible solutions you have already tried .

Example: I tried rerunning all the code and looking at the .info() for my dataframe, screenshot below. I googled the error and found this stack exchange and it actually looks like something that I’m doing but I don’t understand the top answer. 

  • O: Offer your best guess as to what the problem might be. This helps the person who is helping you to know not only what you are thinking, but also your initial legwork troubleshooting. 

Example: From the top answer, I think there’s an error because there’s an empty row at the bottom but I don’t know how to get rid of it or what the original error means. 

  • D: Demonstrate what is happening. Include the code, a traceback error message, and an explanation of the steps you executed that resulted in the error. This way, the person helping does not have to try to recreate the issue.

Example: Here’s a csv that contains a sample of the data and a jupyter notebook with my code thus far. You will find the error in section 4. [attaches csv and jupyter notebook to message] 

Hopefully you will be able to get a response from following these steps! A way to ask these questions in the GC community is by joining the R and Python User Groups Slacks. 

Please join the academic commons groups for the R User Group (RUG) and Python User Group (PUG) to get a Slack invite. We encourage people to join our communities on Slack to ask coding questions and get support for your coding projects. Slack can accommodate different formatting for versatile messaging, including adding code snippets and screenshots and other files. Following these tips could also help with asking questions on other coding forums like Stack Exchange. 

Skip to toolbar