So I am working on data processing and I want to make changes to a column called "temp_coil" based on the condition in other columns.
This is the one I made and it is giving me error.
df.temp_coil[df.outdoor_temperature < 20 & df.cooling_state == 1 & df.temp_coil == 0] = 4500
I want the answer to be 4500 if outdoor_temperature column is less than 20, cooling_state column is 1 and temp_coil column itself is 0. All the conditions need to be met.
The error it is giving me is type and value error when I run it. If this is already answered please let me know, I couldn't find an example that matched my problem.
You must use parentheses so that the truth table is unambiguous. For your example, the correct code would be:
df.temp_coil[(df.outdoor_temperature < 20) & (df.cooling_state == 1) & (df.temp_coil == 0)] = 4500
Or:
df.temp_coil[df.outdoor_temperature.lt(20) & df.cooling_state.eq(1) & df.temp_coil.eq(0)] = 4500
How to prevent a token created with OAuth 2.0 from expiring?
I searched for my problem in the API Reference, but I didn't find anything
I am trying to solve this problem:
I want to compute the difference between every element in a Python list of equally long lists and put it into a Numpy array
I have some frames (dimensions: 8192x2160) that are generated from concatenating two 4096x2160 frames side by sideWhen writing these frames to a video file using OpenCV VideoWriter, I get this error: dimensions too large for MPEG-4