tensor being received as int , AttributeError: 'int' object has no attribute...
I am working on coursera deep learning specialization and my code is passing all the examples but on the unit test I keep getting the answer wronghere is the question Exercise 3 - Implement the...
View ArticleHow to install Python3.12 within POP!_OS Flatpak VSCodium and change its...
Problem & TLDRHello! I recently switched from Windows to POP!_OS. I am not too familiar with Linux and Python but want to learn it.I am having trouble with changing Flatpak VSCodium's Python...
View Articlepytest assert for pyspark dataframe comparison
I have 2 pyspark dataframe as shown in file attached. expected_df and actual_dfIn my unit test I am trying to check if both are equal or not. for which my code is expected = map(lambda row:...
View ArticleRetrieving the current font definition of a tkinter.ttk.Label widget
I wish to retrieve the font object currently assigned to an arbitrary tkinter.ttk.Label widget.(To be more exact, I want to obtain the exact configuration attributes of the widget’s current...
View ArticleError message: The 'feature_names' parameter of plot_tree must be an instance...
plt.figure(figsize=(15,7.5))plot_tree(clf_dt, filled= True, `rounded=True, class_names = ["No HD","Yes HD"], feature_names=X_encoded.columns) I am new to machine learning and python. Trying to plot a...
View ArticlePython: Defining a function to predict off a model and calculate it's mean...
I am trying to define a function by first doing prediction off a model and then calculating it's mean squared error.The function takes in 1 argument, the model name.I set the name of the variable of...
View ArticleHow to generate unique sequences?
I am trying to solve 377. Combination Sum 4.Output: 7Explanation:The possible combination ways are:(1, 1, 1, 1)(1, 1, 2)(1, 2, 1)(1, 3)(2, 1, 1)(2, 2)(3, 1)Here's my solution so far:class...
View ArticleTrying to write a python function with a default sympy symbol
I am trying to write a function that has a sympy symbol with a default value, but am not getting what I expect.Here is my codeimport sympy as sydef addtwo(y = sy.symbols('y', reals = True)): return y +...
View ArticleScrapy Shell extract text only from div class element
I am trying to pull only the dates values from this site http://www.nflweather.com/I believe I have the code but I need to clean up the result a little bitresponse.xpath('//div[@class="fw-bold...
View ArticleUsing Openai's API key in Google Colab
I was working using my Openai's API key in Visual studio 2022 as setting the key as an environment variable after making a .env file and it was working perfectly. Somehow I needed to work on Google...
View ArticleEel Python Image File Saving Error After Using Pyinstaller
I've been working on a small eel package where I take an excel file and analyze the data and then create a small dashboard where it displays the result information. I have 3 plots created using seaborn...
View ArticleUsing pytest to check the input prompt
Imagine I have a Python function that goes something like this:def myFunction(argument: str) -> None: doStuff() result = input(f'{complicated_logic_involving_argument}: ') doOtherStuff()I want to...
View ArticleDataframe list to array comma delimited by value and semicolon delimited by line
I am trying to convert dataframe back to array. I started with array as follows1.0,2.0,1.0,4.0;2.0,3.0,1.0,2.0;1.0,4.0,6.0,3.0I convert to dataframe withwith open('PV.csv','r') as f: array =...
View ArticleHow to make a few queries in a telegram bot using python?
So, I have a telegram bot, that I want to have an InlineButtons control and I don't know how to make this. When I try to make just one message with InlineKeyboard it is ok, but when I try to implement...
View ArticleSQL Select Statement Parser not returning JOIN type
I want to parse through a SQL Select Statement that has all the features a normal SQL dialect like MySQL has too. I looked for parsing libraries in python but couldn't find one that is doing the job....
View Articleget the child element of from the xml
I have an XML where I want to get the child elements of the elements where my condition is satisfied.<hashTree/><ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement"...
View ArticleReplacing a value with its previous value in a column if it is greater
This is my dataframe:import pandas as pddf = pd.DataFrame( {'a': [101, 90, 11, 120, 1] })And this is the output that I want. I want to create column y: a y0 101 101.01 90 101.02 11 90.03 120 120.04 1...
View ArticlePython - Set first and last words of permutations
I'm looking to create a list of permutations but set the first and last words always the same.import itertoolslist = ['cow', 'sheep', 'rooster', 'ram', 'donkey', 'horse', 'goat', 'pig']for x in...
View ArticleUnable to download CSV file using python script
I am using the following code to get a csv file from the link "https://www.nseindia.com/api/corporates-pit?index=equities&from_date=24-09-2023&to_date=24-12-2023&csv=true"Note that...
View Articleinstalling h3 python library on AWS Redshift for usage in an UDF
I was trying to install the python library from ubers H3 as a custom library for aws redshift by using this for the installation. I followed the process and created the following function:create or...
View Article