FAQ

IndexTagsArchivesAbout
  • How do I get the row count of a Pandas DataFrame?

    2023-04-07

    Question How do I get the number of rows of a pandas dataframe df? Answer For a dataframe df, one can use any of the following: len(df.index) df.shape[0] df[df.columns[0]].count() (== number of non-NaN values in first column) Code to reproduce the plot: import numpy as np import pandas as pd import perfplot perfplot.save( “out.png”, setup=lambda n: pd.DataFrame(np.arange(n * 3).reshape(n, 3)), n_range=[2**k for k in range(25)], kernels=[ lambda df: len(df.index), lambda df: df.…

    #python

  • How do I squash my last N commits together?

    2023-04-07

    Question How do I squash my last N commits together into one commit? Answer You can do this fairly easily without git rebase or git merge --squash. In this example, we'll squash the last 3 commits. If you want to write the new commit message from scratch, this suffices: git reset --soft HEAD~3 && git commit If you want to start editing the new commit message with a concatenation of the existing commit messages (i.…

    #git

  • Download single files from GitHub

    2023-04-06

    Question What are some tips on downloading a single file from a GitHub repo? I don't want the URL for displaying the raw file; in the case of binaries, there's nothing. http://support.github.com/discussions/feature-requests/41-download-single-file Is it even possible to use GitHub as a "download server"? If we decide to switch to Google Code, is the mentioned functionality presented there? Or is there any free-of-charge hosting and VCS for open-source projects? Answer Go to the file you want to download.…

    #git

  • master branch and 'origin/master' have diverged, how to 'undiverge' branches'?

    2023-04-06

    Question Somehow my master and my origin/master branch have diverged. I actually don't want them to diverge. How can I view these differences and merge them? Answer You can review the differences with a: git log HEAD..origin/main old repositories git log HEAD..origin/master before pulling it (fetch + merge) (see also "How do you get git to always pull from a specific branch?") Note: since Git 2.28 (Q3 2020), the default branch is configurable, and now (2021+) set to main, no longer master.…

    #git

  • How do I update or sync a forked repository on GitHub?

    2023-04-04

    Question I forked a project, made changes, and created a pull request which was accepted. New commits were later added to the repository. How do I get those commits into my fork? Answer In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version.…

    #git

  • How to see the changes between two commits without commits in-between?

    2023-04-04

    Question How do you make git diff only show the difference between two commits, excluding the other commits in-between? Answer you can simply pass the 2 commits to git diff like : -> git diff 0da94be 59ff30c > my.patch -> git apply my.patch

    #git

  • Should I use SVN or Git? [closed]

    2023-04-02

    Question As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. </div> Closed 11 years ago. I am starting a new distributed project. Should I use SVN or Git, and why?…

    #git

  • «
  • 26
  • 27
  • 28
  • 29
  • 30
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^