I am at a high-beginner/low-intermediate level in Python, and one thing that drives me nuts is how poorly I am able to read the Python official documentation and grok how to use the described code.

What’s the secret? Are there any guides/videos/books that can help my understand how to approach reading it? Or, is it just one of those things that I need to just keep coming back to while coding, and eventually I will get the hang of it?

  • Daniel Quinn@lemmy.ca
    link
    fedilink
    arrow-up
    12
    arrow-down
    1
    ·
    1 year ago

    The docs are pretty great… once you’re deep into it and understand the stuff it glazes over. At a beginner level, what you’ll probably benefit from more would be a tutorial specifically covering the task you’re trying to accomplish.

    Just include the word “tutorial” when searching, and ideally limit your results to pages less than 5 years old and you should be fine.

    • funkless_eck@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      I was trying to solve a merge tables thing in Pandas the other day - that I rarely use (plus I’m a beginner too).

      and trying to compare

      Pivot a DataFrame from wide to long format, optionally leaving identifiers set. This function is useful to massage a DataFrame into a format where one or more columns are identifier variables (id_vars), while all other columns, considered measured variables (value_vars), are “unpivoted” to the row axis, leaving just two non-identifier columns, ‘variable’ and ‘value’.

      vs

      Merge DataFrame or named Series objects with a database-style join. A named Series object is treated as a DataFrame with a single named column. The join is done on columns or indexes. If joining columns on columns, the DataFrame indexes will be ignored. Otherwise if joining indexes on indexes or indexes on a column or columns, the index will be passed on. When performing a cross merge, no column specifications to merge on are allowed.

      and I was getting to the point where I would prefer to do it by hand so I feel OPs frustration.

      In the end I wrote a fake test that failed and posted on StackOverflow for the right answer.