Oct-03-2023, 08:55 PM
Hi,
I've got a dataframe with 100 rows and 3 columns (please see attachment).
How can I concate the 3 columns to one column?
Per example the 3 elements of the first row (255 255 255) should be 1 element (255255255) and so on.
I've got a dataframe with 100 rows and 3 columns (please see attachment).
How can I concate the 3 columns to one column?
Per example the 3 elements of the first row (255 255 255) should be 1 element (255255255) and so on.
import numpy as np import pandas as pd from PIL import Image colorImage = Image.open("p2.bmp") colorPixels = colorImage.convert('RGB') # Make into array colorArray = np.array(colorPixels.getdata()) df = pd.DataFrame(colorArray) print(df) df2 = pd.concat(df["0"], df["1"], df["2"]) print(df2)Thanks a lot for your help!!