Created
July 28, 2015 17:50
-
-
Save beauvais/6a7e2683cacc2dd3c4c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
from sys import argv | |
import pandas as pd | |
script, filename, output_file = argv | |
pd.set_option('display.max_colwidth', 1000) | |
df = pd.read_csv(filename, header=0) | |
text = df['text']#.to_string() | |
print text[0:1] | |
with open(output_file, 'w') as text_file: | |
text_file.write(str(text)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It writes fine, but I get this weird addition of blank spaces to the left of each entry in the 'text' column (which don't exist in the csv file):
0 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam accumsan, turpis ac consequat tincidunt, tellus ligula varius diam metus.
1 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin malesuada, nibh non hendrerit cras amet.
2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin malesuada, nibh non hendrerit l.
3