I couldn't find an answer to this in the existing SettingWithCopy
warning questions, because the common .loc
solution doesn't seem to apply. I'm loading a table into pandas then trying to create some mask columns based on values in the other columns. For some reason, this returns a SettingWithCopy
warning even when I'm wrapping the test in a pd.Series
constructor.
Here's the relevant code. The output at the end seems to be right, but does anyone know what would be causing this?
all_invs = pd.read_table('all_quads.inv.bed', index_col=False,
header=None, names=clustered_names)
invs = all_invs[all_invs['uniqueIDs'].str.contains('p1')]
samples = [line.strip() for line in open('success_samples.list')]
for sample in samples:
invs[sample] = invs['uniqueIDs'].str.contains(sample)
It happens with another boolean test as well.
invs["%s_private_denovo" % proband] = pd.Series(
invs[proband] & ~invs[father] & ~invs[mother] &
invs["%s_private" % proband])
Thanks!