all. I have a Pandas dataframe that is structured like this: Pandas DataFrame
I want to isolate a subset of rows, specifically those that fall into a range of coordinates, which I have stored in a list. This is what I am currently working with:
#create list of (putative?) exon coordinates
exonCoord = [(23114116, 23114327),(23117342,23117435),(23131892,23132007)]
#empty dataframe for only SNPs in coding regions
codingSNPs = pd.DataFrame(columns = ['pos','A','T','G','C','del','ins'])
for c in exonCoord:
for idx,row in SNPs.iterrows():
x = int(idx['pos'])
if c[1] < x < c[0]:
codingSNPs.append(idx,row)
On line x = int(idx['pos']) I receive the error, "'int' object is not subscriptable." What is the easiest way to convert the dataframe columns into integers? Any other feedback on how to improve this code is much appreciated.