0

I have a text file like this example:

Name,SampleProbe
IRF2,231.14
IRF2,340.19
IRF2,139.57
PTEN,115.57
PTEN,240.4
PTEN,117.92
PRKACB,180.02
PRKACB,396.13
PRKACB,186.9

As you see every item in the first column is repeated 3 times and consequently for every item I have 3 values in the 2nd column. I am trying to make a sebset of this file (as a pandas dataframe) in which the first column is IRF2 and PTEN like expected results:

Expected results:

IRF2    231.14
IRF2    340.19
IRF2    139.57
PTEN    115.57
PTEN    240.4
PTEN    117.92

to do so I wrote the following code:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
plt.rcParams['figure.figsize'] = (20.0, 10.0)
plt.rcParams['font.family'] = "serif"
df = pd.read_csv('data.txt')
df2 = df[[df['Name' == 'PTEN' AND 'Name' == 'IRF2']['SampleProbe']]]

It does not return the expected results. Do you know how to fix it?

user10657934
  • 137
  • 10

0 Answers0