concrete_NLP_tutorial
concrete_NLP_tutorial copied to clipboard
ValueError:Length mismatch: Expected axis has 13 elements, new values have 3 elements
import keras import nltk import pandas as pd import numpy as np import re import codecs
input_file = codecs.open("/home/vikash/gen/social_media-disaster-tweets-DFE.csv", 'r' , encoding='utf-8', errors='replace') print input_file output_file = open("social_media_relevant_cols_clean.csv", "w")
def sanitize_characters(raw, clean): print("enter the function") for line in input_file: output_file.write(line)
sanitize_characters(input_file, output_file) questions = pd.read_csv("social_media_relevant_cols_clean.csv") questions.columns = ('text', 'choose_one', 'choose_label') questions.head() questions.tail()
The following is the error
Traceback (most recent call last):
File "/home/vikash/gen/concept.py", line 22, in
@vikash512 I hope you found an answer, but I try to describe this situation.
Here is a description what can you do with DataFrame. You can try to delete unnecessary columns, but also you can select some of them by using operation like this
questions.head()[["text", "choose_one"]]
questions[["text", "choose_one"]].describe()