Skip to main content

All Questions

Tagged with
-4 votes
1 answer
63 views

Python Apply function to create new rows in loop

Goal: Here is a sample of a dataset that has "ID", "PHASENAME", "CDAYS", "MULTI_FACTOR", "DAY_COUNTER", and "DAILY_LABOR_PERCENT". The goal ...
Ty Kendall's user avatar
0 votes
0 answers
28 views

Execution is very slow for GAN

I wrote a code on GAN and had previously trained in the Colab environment. I leave the Colab code below. def build_generator(latent_dim): """Build the generator model.""&...
Muhammed Gülsoy's user avatar
1 vote
3 answers
74 views

How to iterate through a dictionary to get values on the lowest level?

Please help me understand how to extract the value of each ingredient for each product and do something with it. But for starters I just want to print them all one by one. MENU = { "product_1&...
Genkuru's user avatar
  • 21
0 votes
1 answer
35 views

What is the best way to have different entry points for a list of iterative commands?

I have a list of iterative Python commands: def command_list(start_at): step1 step2 step3 # ... stepN Now I want to start_at different steps in this list of commands and then ...
Sur3's user avatar
  • 31
0 votes
0 answers
18 views

How to load multiple .mat files with different suffix once I selected a starting file?

I have the following problem which I do not know how to approach: I have a folder with four .mat files like this: LeCroy000_000_ch1.mat LeCroy000_000_ch2.mat LeCroy000_001_ch1.mat LeCroy000_001_ch2....
i33SoDA's user avatar
  • 75
0 votes
0 answers
22 views

Is there a reason that Python allows indexing the class list itself? [duplicate]

I have come across a "feature" of Python that allows one to index the list class (and all classes that implement __getitem__() AFAIK). It took me a non-trivial amount of time to uncover that ...
Epanemu's user avatar
  • 118
-1 votes
2 answers
75 views

Going back to an earlier index in list iteration

I have this loop over a list: MyList = ["test", "test2", "test3", "test4", "test5", "test6", "test7"] for item in MyList: ...
EliaOndacs's user avatar
2 votes
2 answers
285 views

Why next(iter(train_dataloader)) takes long execution time in PyTorch

I am trying to load a local dataset with images (around 225 images in total) using the following code: # Set the batch size BATCH_SIZE = 32 # Create data loaders train_dataloader, test_dataloader, ...
Jose Ramon's user avatar
  • 5,362
-2 votes
2 answers
107 views

Python: best way to iterate through lists and store which has max value for each index

In Python (3.8), I have 15 lists of the same length. Each list contains floats. Here for the example, I will pretend I have 3 lists of length 5 to demonstrate my problem: List1 = [29.561801, 29.564141,...
Tritize's user avatar
  • 39
0 votes
1 answer
73 views

iterate through a csv file using numpy

I have a CSV file with 4 columns with x, y positions for tracks. The 1st column is the ID of the track. The 2nd column is time. 3rd and 4th are X & Y co-ordinates. Now the X & Y positions ...
kamlesh bornani's user avatar
-1 votes
1 answer
73 views

Repeating an iterating function N times [closed]

I have an iterative function, f(x) = ax + b, which I want to repeat N times. My steps are as follows 1.) Define the iterative function 2.) Assign a value to each repetition 3.) Stop at the Nth ...
Colonel Armfeldt's user avatar
0 votes
2 answers
56 views

Python - Iterating through nested dictionaries to populate a list based on values - Encounter 'str' object has no attribute 'items'

I'm creating a code that should allow a user to select multiple objects from a list. Each user has an allotted amount of space, and each object has a specified size. I'm trying to populate the list ...
Moonlyte Demon's user avatar
0 votes
1 answer
40 views

Tkinter: Listbox not populating from function call, populates from list

I have a function that creates a list, and another that's supposed to populate a tkinter listbox with the items from that list. When a radio button is clicked the contents of the listbox should update....
Sabresong's user avatar
0 votes
1 answer
47 views

Unable to iterate list of blobs in python variable

I am fetching the output 'file_list' from blob_list blob_list = container_client.list_blobs() for blob in blob_listL file_list = f"Name: {blob.name}," Now when I print file_list,...
sahil malik's user avatar
0 votes
0 answers
85 views

Iterating for a specific array element in Python

I'm using in my Python something like this: for i in range(333333): array1[i,1]=numpy.where(array1[i,1]!=-1,array[i,1],function(array1[i,0],array1,array2)) Obviously, this is not really ...
Exi0022's user avatar

15 30 50 per page
1
2 3 4 5
247