FAQ

IndexTagsArchivesAbout
  • Use a list of values to select rows from a Pandas dataframe

    2022-01-03

    Question Let’s say I have the following Pandas dataframe: df = DataFrame({'A' : [5,6,3,4], 'B' : [1,2,3, 5]}) df A B 0 5 1 1 6 2 2 3 3 3 4 5 I can subset based on a specific value: x = df[df['A'] == 3] x A B 2 3 3 But how can I subset based on a list of values? - something like this: list_of_values = [3,6] y = df[df[‘A’] in list_of_values] To get:…

    #python

  • Git workflow and rebase vs merge questions

    2022-01-02

    Question I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I have heard that Git is excellent for branching and merging, and so far, I just don't see it. Sure, branching is dead simple, but when I try to merge, everything goes all to hell.…

    #git

  • Pull new updates from original GitHub repository into forked GitHub repository

    2022-01-02

    Question I forked someone's repository on GitHub and would like to update my version with commits and updates made in the original repository. These were made after I forked my copy. How can I pull in the changes that were made in the origin and incorporate them into my repository? Answer You have to add the original repository (the one you forked) as a remote. From the GitHub documentation on forking a repository:…

    #git

  • Rename master branch for both local and remote Git repositories

    2022-01-02

    Question I have the branch master which tracks the remote branch origin/master. I want to rename them to master-old both locally and on the remote. Is this possible? For other users who tracked origin/master (and who always updated their local master branch via git pull), what would happen after I renamed the remote branch? Would their git pull still work or would it throw an error that it couldn't find origin/master anymore?…

    #git

  • Using the slash character in Git branch name

    2022-01-02

    Question I'm pretty sure I saw somewhere in a popular Git project the branches had a pattern like "feature/xyz". However when I try to create a branch with the slash character, I get an error: $ git branch labs/feature error: unable to resolve reference refs/heads/labs/feature: Not a directory fatal: Failed to lock ref for update: Not a directory Same problem for (my initial attempt): $ git checkout -b labs/feature How does one create a branch in Git with the slash character?…

    #git

  • Combining multiple commits before pushing in Git [duplicate]

    2022-01-01

    Question This question already has answers here: </div> How do I squash my last N commits together? (44 answers) Closed 5 years ago. I have a bunch of commits on my local repository which are thematically similar. I'd like to combine them into a single commit before pushing up to a remote. How do I do it? I think rebase does this, but I can't make sense of the docs.…

    #git

  • Detach (move) subdirectory into separate Git repository

    2022-01-01

    Question I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository. How can I do this while keeping the history of the files within the subdirectory? I guess I could make a clone and remove the unwanted parts of each clone, but I suppose this would give me the complete tree when checking out an older revision etc.…

    #git

  • «
  • 156
  • 157
  • 158
  • 159

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^