Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
79 views
in Technique[技术] by (71.8m points)

python - Pandas Dataframe IF condition

I would very thankful if there is somebody who could help me.

I′m working with a dataframe. I have variables called 'coordinates_x' and 'end_coordinates_x' and 'result'

From beginning if the cell 'result' has the value INCOMPLETE the cell end_coordinates_x is blank. If not, it has a value.

In this case, I would like to take the value of the 'coordinates_x' of the next line if the value of the cell 'result' is INCOMPLETE.

I′m trying:

df['result'] = INCOMPLETE, df['end_coordinates_x'] = df['coordinates_x'].shift(-1)

but i get the error: ValueError: too many values to unpack (expected 2)

Is the line wrong? Do I miss something? I know my knowledge is not that much.

Thanks in advance

question from:https://stackoverflow.com/questions/65870684/pandas-dataframe-if-condition

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...