I have 100s of text files that have a header row and then a series of numbers in each column (example below):

Textfile 1

| x | y |
| --- | --- |
| 0.001 | 5.45 |
| 0.23 | 6.83 |
| 0.03 | 4.86 |

Textfile 2

| x | y |
| --- | --- |
| 0.003 | 7.34 |
| 0.89 | 3.89 |
| 0.45 | 5.66 |

I would like to create a new pandas data frame (example below) that contains the values in column 2 of each file as a new column that has the name of the text file.

| Textfile 1 | Textfile 2 |
| --- | --- |
| 5.45 | 7.34 |
| 6.83 | 3.89 |
| 4.86 | 5.66 |

I was thinking along the lines of a for loop that loops through all the text files in the folder and at each iteration adds a column to the new data frame (something like the code below)

```
all_files=glob.glob(os.path.join(path,"*.txt"))

df_ppm = []

for file in all_files:
    file_name = os.path.split(file)[1]
    df_ppm.append(pd.read_csv(file_name))

```