Do any of you know why I get the following error code? My Code : You can ignore the Integrator Part, I just want to know why the model.predict wont work. Here is the error: Answer The problem is with the lines: Here your model is setup to receive a rank 2 tensor as input, but you are only giving
Tag: python
Mask layer is not working with MLPs, how to add a custom layer with masking?
I’m using MLPs to forecast a time series, I implement a code that contain a mask layer to let the model skip the mask values. for instance, in my data, the time series has a lot of NaN values, I fill it by a ‘value = -999’. I don’t want to remove it, but I want the Keras masking to
How to limit incorrect answers from users input?
I’m here with my code, here you can see it: Let me explain: I defined false for, if user inputs the answer 3 times and all of them for that question are false, show user the answer and continue asking Actually this code asks 10 different math questions, this is a part of my code, I’m checking if a…
Pandas apply same filtering on two dataframes
I have two pandas dataframes with the same indexes and lengths. However, they might contain nans at different places. See, example input below: I want to do some calculations where I want to remove indexes in both the dataframes even if one of them has a NaN values. So, in those case only the first row is val…
Getting the colour of a particular pixel with opencv
I’m trying to determine the colour of a single pixel in an image using Python and OpenCV. However, when I read the BGR values from that pixel and use those same values to draw a circle back on the image, the colours do not match. Where am I going wrong? Output: Note the cyan circle drawn on the yellow r…
nonetype object has no attribute text error while scraping data
when i try to scrap data from this amazon link. I got AttributeError: ‘NoneType’ object has no attribute ‘text’ My Code: I think that the laptop_rating variable store the content in string format even if we not include .text. I’m thinking that might be the reason for getting None…
How to Join Subqueries in Django ORM
I’m a beginner Django and I have been stuck on the following problem for a while. The basic thing I would like to achieve is that when client makes a GET list api request with a time period parameter (say 3 months) then the server would return an aggregation of the current 3 months data and also show an…
Is there a way to show the IDE which Type of Objects are in a List, so it colors / autocompletes properly?
I recognize from c# that you could do (int)(randomVariable + 1 + anythingElse) and the IDE would understand that the named variable/result is an integer. Now in Python I want to let my IDE know, that in the list ceDocs which I am sending as a parameter will be objects of the class Doc so I can use autocomplet…
How to access a multiple dictionary in python?
I have a following dictionary: Lets suppose I would like to print a value using print(pokus[1][“ahoj”][0][“visit”][0]). But I nedd [1][“ahoj”][0][“visit”][0] to be in an extra variable. I try this: But I get an error TypeError: list indices must be integers or s…
Cannot Locate my Module from another folder n python
I’ve the following structure in my simple python project: The tokengenerator.py module produces Token variables and I need to call it in generatedata.pymodule and I used the following code line for this purpose: but it returns the error below: Would you please advise ? Answer from this article, you can …