I have seven dataframes tbl1851, tbl1861, tbl1871, tbl1881, tbl1891, tbl1901, tbl1911.
Each dataframe has the same fields 'Sex', 'Age', 'Num'.
I want to select a subset from each dataframe by first creating series of boolean.
My code looks like
AM1851 = ((tbl1851.Sex=="M") & (tbl1851.Age>=15) & (tbl1851.Age<999))
AM1861 = ((tbl1861.Sex=="M") & (tbl1861.Age>=15) & (tbl1861.Age<999))
AM1871 = ((tbl1871.Sex=="M") & (tbl1871.Age>=15) & (tbl1871.Age<999))
AM1881 = ((tbl1881.Sex=="M") & (tbl1881.Age>=15) & (tbl1881.Age<999))
AM1891 = ((tbl1891.Sex=="M") & (tbl1891.Age>=15) & (tbl1891.Age<999))
AM1901 = ((tbl1901.Sex=="M") & (tbl1901.Age>=15) & (tbl1901.Age<999))
AM1911 = ((tbl1911.Sex=="M") & (tbl1911.Age>=15) & (tbl1911.Age<999))
I am wondering if there is a looping script that can achieve the same results as the codes listed above?
There are many different selection combinations, so I don't really want to copy and paste and research and replace lots of times.