Today, I was able to finish the sorting from yesterday and commit back to my fork on GitHub.
Here's how my sorting code worked: (this was in pure Python: at this point, I hadn't utilized Pandas all that much) I made a two-dimensional list (with 3 rows) beforehand. During the iteration of the csv file (which was already happening in the sample code when it was making the requests), I added the value in the current row to two of the list's rows (so one could be sorted and the other would preserve the original place), while adding the label to the third. After the looping was done, I sorted the first row of the list. Then, I printed based on the order in the first row, but I still had the original index of the current element in the second row. I was then able to match the correct name by using the name at that original index in the third row. As an additional note: before this, I had a bit of a foundation in Git/GitHub, but this experience is really solidifying my Version Control knowledge! I used a lot of StackOverflow to guide me through the process and troubleshoot. In particular, I had cloned Mr. Navkal's original repository to my computer, and I wanted to figure out how to commit back to my fork instead of the original one. In the end, I read that I had to run git remote set-url origin (link), which worked well. After I figured this out, I thought, "Wait, how can I actually use Pandas to work with this data?" Turning my attention to the ahs_air file, I realized that the CSV file I was reading from didn't have actual data -- instead, it contained room numbers and the IDs they were using to access the API. If I wanted to store and read the actual data using Pandas, I would need to write to a different CSV file. By the time I figured out how to write each row (by replacing the print statement in the original file) to the new CSV and read in the data with Pandas, class was over. I'm so excited to continue working with the data, especially now that I can apply my knowledge from the tutorials! Comments are closed.
|
AuthorI'm a high school senior and programming enthusiast. Archives
March 2022
Categories |