You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/vikash/gen/concept.py", line 22, in
questions.columns = ('text', 'choose_one', 'choose_label')
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/generic.py", line 4385, in setattr
return object.setattr(self, name, value)
File "pandas/_libs/properties.pyx", line 69, in pandas._libs.properties.AxisProperty.set
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/generic.py", line 645, in _set_axis
self._data.set_axis(axis, labels)
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/internals.py", line 3323, in set_axis
'values have {new} elements'.format(old=old_len, new=new_len))
ValueError: Length mismatch: Expected axis has 13 elements, new values have 3 elements
The text was updated successfully, but these errors were encountered:
@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()
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
questions.columns = ('text', 'choose_one', 'choose_label')
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/generic.py", line 4385, in setattr
return object.setattr(self, name, value)
File "pandas/_libs/properties.pyx", line 69, in pandas._libs.properties.AxisProperty.set
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/generic.py", line 645, in _set_axis
self._data.set_axis(axis, labels)
File "/home/vikash/.local/lib/python2.7/site-packages/pandas/core/internals.py", line 3323, in set_axis
'values have {new} elements'.format(old=old_len, new=new_len))
ValueError: Length mismatch: Expected axis has 13 elements, new values have 3 elements
The text was updated successfully, but these errors were encountered: