Import multiple CSV files into pandas and concatenate into one DataFrame
2023-01-11
Question I would like to read several CSV files from a directory into pandas and concatenate them into one big DataFrame. I have not been able to figure it out though. Here is what I have so far: import glob import pandas as pd Get data file names path = r’C:\DRO\DCL_rawdata_files’ filenames = glob.glob(path + “/*.csv”) dfs = [] for filename in filenames: dfs.append(pd.read_csv(filename)) Concatenate all data into one DataFrame big_frame = pd.…
Create a tag in a GitHub repository
2023-01-10
Question I have a repository in GitHub and I need to tag it. I tagged in a shell, but on GitHub, it is not showing up. Do I have to do anything else? The command I used in the shell is: git tag 2.0 And now when I type git tag it shows: 2.0 So it seems like tags are present, correct? The repository is: https://github.com/keevitaja/myseo-pyrocms. How do I make this tag show up on GitHub?…
Find a commit on GitHub given the commit hash
2023-01-10
Question I am fairly new to Github and have come across an amateur-ish problem. I have been asked to do a code review and have been provided with a commit hash, however I have tried looking in Git if I can search using commit hashes but couldn't find anything. Is there a way I can find the changed code just by using the commit hash? Answer A URL of the form https://github.…
How do I work with a git repository within another repository?
2023-01-10
Question I have a Git media repository where I'm keeping all of my JavaScript and CSS master files and scripts that I'll use on various projects. If I create a new project that's in its own Git repository, how do I use JavaScript files from my media repository in my new project in a way that makes it so I don't have to update both copies of the script when I make changes?…
What goes into your .gitignore if you're using CocoaPods?
2023-01-10
Question I've been doing iOS development for a couple of months now and just learned of the promising CocoaPods library for dependency management. I tried it out on a personal project: added a dependency to Kiwi to my Podfile, ran pod install CocoaPodsTest.xcodeproj, and voila, it worked great. The only thing I'm left wondering is: what do I check in, and what do I ignore for version control? It seems obvious that I want to check in the Podfile itself, and probably the .…
How do I revert a merge commit that has already been pushed to remote?
2023-01-08
Question git revert <commit_hash> alone won't work. Apparently, -m must be specified. Answer In git revert -m, the -m option specifies the parent number. This is needed because a merge commit has more than one parent, and Git does not know automatically which parent was the mainline, and which parent was the branch you want to un-merge. When you view a merge commit in the output of git log, you will see its parents listed on the line that begins with Merge:…
Constructing pandas DataFrame from values in variables gives "ValueError: If using all scalar values, you must pass an index"
2023-01-07
Question This may be a simple question, but I can not figure out how to do this. Lets say that I have two variables as follows. a = 2 b = 3 I want to construct a DataFrame from this: df2 = pd.DataFrame({'A':a,'B':b}) This generates an error: ValueError: If using all scalar values, you must pass an index I tried this also: df2 = (pd.DataFrame({'a':a,'b':b})).reset_index() This gives the same error message.…