I'm trying to ajust values of images in a pandas dataframe Each row of the dataframe (images) holds an image of shape (7,7,3), 7x7 pixels and 3 colours. So when I try to adjust the top left pixel of the first image like so:
All other images (rows) are affected as well.
print(images.loc[0,'image'][0][0], images.loc[1,'image'][0][0])
images.loc[0,'image'][0][0]=[1,2,3]
print(images.loc[0,'image'][0][0], images.loc[1,'image'][0][0])
[0,0,0] [0,0,0]
[1,2,3] [1,2,3]
This only happens when I adjust a single pixel. If I edit the image in its entirety, the other images/rows are not affected.
images[0,'image']=[image]
does work properly
added mvce:
import numpy as np
import pandas as pd
images = pd.DataFrame(columns=['image'])
image = np.zeros([2, 2, 2])
images.loc[0, 'image'] = image
images = pd.concat([images] * 2)
images = images.reset_index(drop=True)
print(images.loc[0, 'image'][0][0], '\n')
images.loc[0, 'image'][0][0] = [1, 1]
print(images.loc[0, 'image'][0][0], images.loc[1, 'image'][0][0])