Skip to content

For loops to iterate through columns of a csv

I’m very new to python and programming in general (This is my first programming language, I started about a month ago). I have a CSV file with data ordered like this (CSV file data at the bottom). There are 31 columns of data. The first column (wavelength) must be read in as the independent variable (x)…

Python edhesive 10.4

I’ve tried posting this question onto other websites and I have received, lightly to say, little to no feedback that helps. This is the question at hand: Image Here The code is asking to divide the numbers in a 2d array by 3, and if they’re not divisible by 3, then return them to a 0 in the array.…

Why is my class object not working as intended?

I have two issues that need resolving. I have created a class object LoanInstance. The object should create a list of numbers (int or float) that show different aspects of a personal loan repayment balance. There are 2 main parts to the object. Part 1: Read in data from a data frame (I’ve created an exa…

MongoDB update object rather than insert a new one

Using collection.insert_one(json_dict)inserts a new collection Can I do collection.insert_one() on an already existing object so it then updates. My object will look something like: Then under “Age” I want to add “Location”: “New York’, how’d I do that using PyMongo A…