I am new to python loops. I am using pandas and have created a blank data frame. I am trying to append values from 0 through 2 based on a given step size in a list. For each step size, I need to append a new column in the data frame that goes from 0 to 2.
Here is what the output looks like (with the first three step sizes as examples):
Here is what I have tried:
import numpy as np
seq = [0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625, 0.0078125, 0.00390625]
df = pd.DataFrame()
for delta_x in seq:
df[delta_x] = 0
while df[delta_x] < 0:
df[delta_x] + delta_x
However, the following error is thrown:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
What can I do to fix this?
