-1
import csv
import pandas as pd

df_1  = pd.read_csv("result4.csv")

df_1.to_csv('dataset_1.txt', sep='\n', index=False)

This returns a text file with both columns, I only want the second column.

1 Answers1

0

This should work

import pandas as pd

pd.read_csv("test.csv").iloc[:, 1].to_csv("test1.csv", sep='\n', index=False)

You need to select only second column

Aritesh
  • 1,985
  • 1
  • 13
  • 17