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.
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.
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