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, 2020 in Python by Mohammed
• 120 points

edited Mar 11, 2020 by Gitika 8,322 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.

Hello Roshni, still dosnt work, what could be wrong? version3.6

Thanks!

Hi. @There,

Running the same issue from Python 3 in Google Colab:
I have attempted to install from source as well as !pip install -U pandas-profiling.

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
2 answers

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

Try this: data=pd.read_csv('/your file name', delim_whitespace=Tru ...READ MORE

answered Dec 10, 2020 in Python by anonymous
• 82,840 points
132,569 views
0 votes
1 answer

AttributeError: type object 'DataFrame' has no attribute 'from_items'

Hi, @Bronson, You can go through this, I ...READ MORE

answered Apr 6, 2020 in Python by Gitika
• 65,770 points
5,313 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,560 points
9,430 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() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
7,246 views
+1 vote
3 answers

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
21,591 views
0 votes
1 answer

How to rename columns in pandas (Python)?

You can use the rename function in ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by MD 2,059 views
0 votes
1 answer

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

The major difference is "size" includes NaN values, ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by Gitika 2,860 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
13,743 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,660 points
4,577 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP