Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to create a subset of a dataframe in python

RAM = [f"RUT1_Azi_{i}" for i in range(10)]
RDP = [f"RUT1_Dtctn_Probb_{i}" for i in range(10)]
RDI = [f"RUT1_Dtctn_ID_{i}" for i in range(10)]
REM = [f"RUT1_Elev_{i}" for i in range(10)]

# made up example with the columns above
cols = RAM + RDP + RDI + REM
nrows = 10
df = pd.DataFrame(np.arange(nrows * len(cols)).reshape(nrows, -1), columns=cols)
subsets = [df[list(subcols)] for subcols in zip(RAM, RDP, RDI, REM)]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #subset #dataframe #python
ADD COMMENT
Topic
Name
2+7 =