I have a pandas data frame with 16,777,216 rows. This is every possible combination of three columns (Red, Green and Blue) between 0 and 255 inclusive.
I would like to add a column to this data frame which is the hex code of the three values of the row. I thought something like the below would have been the best solution:
df["Hex"] = "#{0:02x}{1:02x}{2:02x}".format(df["Red"],df["Green"],df["Blue"])
However, it appears you can't pass a series into the string format method.
Is there a way of getting around this problem? Furthermore, would that be the most efficient way of doing it, given the data frame is fairly large?