Skip to content
Advertisement

Tag: for-loop

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) and for the first

OpenAI Gym: Walk through all possible actions in an action space

I want to build a brute-force approach that tests all actions in a Gym action space before selecting the best one. Is there any simple, straight-forward way to get all possible actions? Specifically, my action space is I know I can sample a random action with action_space.sample() and also check if an action is contained in the action space, but

Trouble when adding values for NaN in DataFrame

I have this DataFrame: And I want to fill the NaN values with keyword taken from the description. To that end I created a list with the keywords I want: Finally, I want to loop over each row in the DataFrame. Split the contents from the “description” column in each row and, if that word is also in the “keyword”

Advertisement