pandas head() not reading all rows - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: pandas head() not reading all rows (/thread-25667.html) |
pandas head() not reading all rows - naab - Apr-07-2020 Hi, I am reading a csv and applying the def to remove unnecessary data. If i apply for 174 rows,"dict = (dc_data['Description'].head(174).apply(process_text))" it gives below error. If i specify 100 rows it works. Requirements is to apply for all rows. Any help is appreciated. Code:-import pandas as pd from textblob import TextBlob import string import nltk from nltk.corpus import stopwords dc_data = pd.read_csv('dc.csv', encoding="ISO-8859-1", index_col=False) print(dc_data.head()) desc = dc_data['Description'] print(desc.shape) def process_text(text): #1 nopunc = [char for char in text if char not in string.punctuation] nopunc = ''.join(nopunc) #2 clean_words = [word for word in nopunc.split() if word.lower() not in stopwords.words('english')] #3 return clean_words #Show the Tokenization (a list of tokens ) dict = (dc_data['Description'].head(174).apply(process_text)) print("Dict: ", dict) |