lists - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: lists (/thread-33155.html) Pages:
1
2
|
RE: lists - jefsummers - Apr-06-2021 I'd use Pandas, largely as it is simple to select data according to your preference. import pandas as pd sky = [[20,20,150,200,230],[21,20,0,0,0],[22,20,100,110,90],[23,20,200,220,220],[24,20,210,210,210]] colnames = ['x','y','red','green','blue'] df = pd.DataFrame(sky,columns=colnames) df.head() This sets up the dataframe with columns for x and y coordinates and columns for the RGB readings of the pixels. Selecting bright ones is then simple asdfbright = df[df.red+df.green+df.blue > 600] dfbright.head()
|