There is 5 fundraising projects, and the purpose of this program is to substract the amount of money that each of n donators will donate from the desired sum of each project The program partially work, but sometimes python typing “TypeError: ‘NoneType’ object is not subscriptable” and the programm fall What can cause this crash? Thank you for your help!
Tag: list
Data type assigned inside nested for loop isn’t as expected
I get the error: AttributeError: ‘float’ object has no attribute ‘lower’ When trying to compile this triple nested for loop: df_row_list is a list of 18 series. I am trying to iterate through it and comb through the data. How do I assign the str data type to row_item_data so that I can use the .lower() attribute? This is kinda
how to get nth chunks of items of a list in python?
I would like to get every 4 chunks of a list of items, where the first item has the index corresponding to 4-1, so a previous step. I am only able to get every 4 chunks, but I am stuck at getting every item of the list to start at a “previous step” or 4-1. Should I loop through this
How to loop through lists to create multiple plots Python
I have the following three lists: I was wondering how I can take these 3 lists and iterate through them to get lists so the first plot would be plotting dog as title with y value as the first list in 2d list 2 and the x value would the first list in 2d list 3. This would iterate for
Check if any nested list within a 2d list both contains one value and does not contain another
I’m making a card game in python where the cards are stored in a 2D list, where the first layer of the list is each card and the second layer is the values a card has. I’m trying to make an if statement that checks if any card a player has in their hand (that is, any nested list within
How to compare items with values of list of dict in python
I have a output list of dicts: Above data contains info about the attribute i.e. Current NAV Amount Requested, its value and its status. I have a below input list of dict: I have to compare the value of Current NAV and Amount Requested from fieldValList with outList so that I get the output of how many values from outList
Is there any way we can change the index location of an element present in a list?
Example:- list1 = [ a, b, c, d, e] has index location 0, 1, 2, 3, 4 Can we make the index locations for list1 -2, -1, 0, 1, 2 Answer Lists are only indexable via positive integers (negatives have a special behavior to begin looking from the back of the list) and have a contiguous range up to the
Read, Split and Append csv to lists in python
Problem I need to build a backend function that will read the data within a csv file, split the values and append them to several lists. The program for adding/removing/displaying values form the lists is working but now I need to add file I/O. I have the file inventory.csv and have a function load_file_data() which is meant to read, split
Python – Trouble printing to CSV
My code seems to be outputting the list I want, however, when I try printing the list to CSV I do not get the same result on the .csv file for some reason. I am sure there’s something not right at the end of my code. Could anyone please shed some light? Thanks in advance. Answer I have not used
All cells getting updated in pandas df using loc
So I create an empty pandas df, where I initialize all the cell values to empty lists, except the diagonals, which are set to math.inf The indexes are the start position, and the column headers are the end position I want to get the start and end positions, and the difference between the days to get from start to end,