AttributeError: 'DataFrame' object has no attribute 'is_impossible'

0 votes
from collections import Counter
import re
import numpy as np
import pandas as pd
from nltk.tokenize import word_tokenize
from keras.models import Model, load_model
from keras.layers import Input, Dense, GRU, Masking, Lambda, Bidirectional, Dropout, Reshape
from keras.preprocessing.sequence import pad_sequences
from keras import regularizers
from keras.optimizers import Adam
from keras.utils import multi_gpu_model
import keras.backend as K
import tensorflow as tf
import matplotlib.pyplot as plt
train_df_all = pd.read_json('C:\Users\privus\Desktop\Q & A\Question Answering System\Data\train_file.json').reset_index(drop=True)
dev_df_all=pd.read_json('C:\Users\privus\Desktop\Q & A\Question Answering System\Data\validation_data.json').reset_index(drop=True)
# Dataframes consisting only of 'possible' to answer questions.
train_df = train_df_all.loc[[train_df_all.is_impossible == False,["context", "question", "answer_text", "answer_start", "title"]]].reset_index(drop=True)
# This is the testing dataset.
dev_df = dev_df_all.loc[train_df_all.is_impossible == False,["context", "question", "answer_text", "answer_start", "title"]].reset_index(drop=True)
train_df.answer_start = train_df_all.answer_start.astype(int)
dev_df.answer_start = dev_df_all.answer_start.astype(int)
# Extracting training data
contexts, questions, answers, answer_start = (train_df.context.values, train_df.question.values, train_df.answer_text.values, train_df.answer_start.values)
# Array of answer end indeces in the context.
answer_end = np.array([answer_start[idx] + len(answers[idx]) for idx in range(len(answer_start))])
AttributeError Traceback (most recent call last) in 4 #print(train_df_all) 5 # Dataframes consisting only of 'possible' to answer questions. ----> 6 train_df = train_df_all.loc[[train_df_all.is_impossible == False,["context", "question", "answer_text", "answer_start", "title"]]].reset_index(drop=True)#.loc[train_df_all.is_impossible == False, 7 # This is the testing dataset. 8 dev_df = dev_df_all.loc[train_df_all.is_impossible == False,["context", "question", "answer_text", "answer_start", "title"]].reset_index(drop=True) #replacing is_impossibel with impossible_question #.loc[dev_df_all.is_impossible == False,

~\Anaconda3\lib\site-packages\pandas\core\generic.py in getattr(self, name) 5272 f = lambda: self._data.consolidate() 5273 cons_data = self._protect_consolidate(f) -> 5274 return self._constructor(cons_data).finalize(self) 5275 5276 @property

AttributeError: 'DataFrame' object has no attribute 'is_impossible'
Mar 10 in Python by Mohammed
• 120 points

edited Mar 11 by Gitika 166 views

Hey, @Mohammed,

In which version of python you are running? You can try to install and run. 

pip install -U pandas-profiling

I hope the issue will be solved, if not, let me know.

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

There is no attribute called “rows”. The ...READ MORE

answered Mar 28, 2019 in Python by Shri
19,544 views
0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,540 points
2,278 views
0 votes
1 answer
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() a ...READ MORE

answered Jun 19, 2019 in Python by Faiza
681 views
+1 vote
1 answer

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

answered Jun 19, 2019 in Python by Faiza
3,865 views
0 votes
1 answer

Python error "AttributeError: 'str' object has no attribute 'casefold'"

Check your python version. Casefold is possible ...READ MORE

answered Jul 4, 2019 in Python by Yesha
2,060 views
0 votes
1 answer

How to rename columns in pandas (Python)?

It is easy by just adding ".columns" ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
245 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is size includes NaN ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
895 views
0 votes
2 answers

Replacing a row in pandas data.frame

key error. I love python READ MORE

answered Feb 18, 2019 in Data Analytics by anonymous
4,215 views
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,560 points
2,499 views