Category : attributeerror

In Python 3.9.4, I have build a class ForagerAgent containing many methods. With the relevant code referring to information sharing between two different ForagerAgent objects. an example of the relevant code: class ForagerAgent: def __init__(self): heatmap = {} def receive_heatmap_knowledge(self, shared_data): received_alternative_indices = shared_data[0] received_alternative_data = shared_data[1] received_counter = 0 while received_counter < len(received_alternative_indices): # ..

Read more

Refer code for datetime python module """Concrete date/time and related types. See http://www.iana.org/time-zones/repository/tz-link.html for time zone and DST data sources. """ __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR") import time as _time import math as _math import sys def _cmp(x, y): return 0 if x == y else 1 if x > ..

Read more

I’ve been writing this code to access a google sheet named "Classmates" and two worksheets within it named, "School" and "Collage" each with file handle "ws1" and "ws2". import gspread jf=gspread.service_account("E:PyProjGsheetscreds.json") wb=jf.open("Classmates") ws1=wb.worksheet("School") ws2=wb.worksheet("Collage") inp=int(input("What data you want to gett:")) if inp==1: ws="ws1" elif inp==2: ws="ws2" else: print("Try again") data=ws.get_all_values() #line 14 with error print(data) ..

Read more

I am trying to develop a prediction model using XG Boost. My basic idea is to develop an automated prediction model which uses the top 10 important features derived from the Dataset (700+ rows and 90+columns) and use them for prediction of values. The input data is updated weekly and hence the predictions for the ..

Read more

The error says: AttributeError: ‘NoneType’ object has no attribute ‘get_text’ I was following a web scraping tutorial and everything worked fine just with this url, when I wanted to change it to this url the error that I already mentioned appeared. The crawler function: def product_crawler(): page = requests.get(url, headers=headers) soup = BeautifulSoup(page.content, ‘html.parser’) title ..

Read more

Well , hey there I am just a beginner in Coding and Python… So, hope you understand and help me. I am getting an error while running my code, which I tried to fix but it was all failure Here is the code: import wikipedia import speech_recognition as sr engine = pyttsx3.init(‘sapi5’) voices = engine.getProperty(‘voices’) ..

Read more

Trying to use np.select or np.where to run a method on a DataFrame Column. Either way I do it, I get the error saying the "object has no attribute ‘select’ (or ‘where’ if I use np.where). When I convert the column and check the specific column type, it returns as an numpy.ndarray. According to the ..

Read more

I’m currently developing a Website with flask, and whenever I try to enter my home-page, I get the following error-message: AttributeError: ‘list’ object has no attribute ‘topic1’ And apparently the error occurs in this line: found_something.topic1 = topics[x] These are the relevant parts of my app.py file: from flask import Flask, render_template, redirect, url_for, request, ..

Read more

I have been following the example record linking code from the Python Record Linkage Toolkit package and it runs fine when using the ‘jarowinkler’ string matching method. However when running with method = "qgram" or "cosine" it throws a numpy error. Any thoughts on what may be causing the error? File "C:ProgramDataAnaconda3libsite-packagesrecordlinkagecompare.py", line 153, in ..

Read more