Category "python"

Reducing number of levels of indentation for plural stemming code in python

My code works fine and it exactly does what it is suppose to do. However, it has too many levels of indentation. I wonder if anyone here has anyway to reduce nu

Scraping in <dt> and <dd> tags with bs4 ant python

How should i extract info i only need from <dt> and <dd> tags ? P.S and there is a lot of pages like that - hundreds Here is link for main page: ht

How can I convert radians to degrees with Python?

In the math module, I could only find math.cos(x), with cos/sin/tan/acos/asin/atan. This returns the answer in radians. How can I get the answer in degrees? He

Cannot Automate Dropping of Tables via Jupyter with Postgres

So I am trying to automate the dropping of TABLES in my Postgresql table I ensure the connections are working, I have done multiple queries previously, Now I wa

Login dialog PyQt

I nearly finished my application, when the customer asked if I could implement some kind of login form on application startup. So far I have designed the UI, a

how to scrap phobos website using open url

I'm trying to scrap phobos website using bs4 and getting 418 teapot error Here is my code ....I am getting error when i am using build_opener.open from url

How to generate a map with clusters in Python

I have this dataframe below and I would like to know how I can make a graph similar to the one I inserted in the attachment. Can you help with some material or

Hide Plotly Dash Sunburst Hover label

I am unable to hide the label, division and parent from hover tooltips path=[pune,division,taluka,village] value = df['Project Count'].tolist() fig_sunburst = p

Merge partial pickle files to get back my original pickled model

I have pickled a RF model on my machine and its size is of 360Mb, Now I want to upload it to GitHub but I cannot do it by file upload nor by the terminal, I tri

Drop duplicate IDs keeping if value = certain value , otherwise keep first duplicate

>>> df = pd.DataFrame({'id': ['1', '1', '2', '2', '3', '4', '4', '5', '5'], ... 'value': ['keep', 'y', 'x', 'keep', 'x', 'Keep', 'x'

Word2Vec + LSTM Good Training and Validation but Poor on Test

currently I'am training my Word2Vec + LSTM for Twitter sentiment analysis. I use the pre-trained GoogleNewsVectorNegative300 word embedding. The reason I used t

My python code in my if statement will run even when false [duplicate]

My code yes = input("my input: ") if yes == "yes" or "yEs" or "yeS" or "Yes" or "YEs" or "YES" or "yES" or "YeS" or "Y" or "y": print("cor

Highlighting specific data points for parallel coordinates plot

I'm looking for help to highlight/color particular data points on the parallel coordinates plot. I can't seem to find a way that work. Essentially, I want to pl

python requests-html Chromium process leaking

My program cannot run thought the entire loop because a leak crashes it before it gets to the end. I have the following script: from requests_html import HTMLSe

Background disappearing when changing stylesheet after qthread

After making a few interfaces using the PySide6 library I keep having this issue where the custom background that I initialize turns black when calling a setSty

I can't send file to django server through angular and error says: The submitted data was not a file. Check the encoding type on the form

my code is like this and I send data through httpClient and it returns error on upload my angular version is 13 and django version is 4 and I'm using django res

How to merge/layer two audio files using Python AudioSegment without it breaking the wav header

I am more or less following the code below to merge two audio files. It mostly works, where audio segment can export both the original files and the combined fi

Question - What is the pearson correlation between average dew point and average temperature? my code:

This is my Code * corr_matrix = np.corrcoef(data['Average dewpoint (°F)']data['Average temperature(°F)']) corr = "corr = " + str(round(corr_matrix[1][0]

How to make python read multiple sheets on an excel file one by one

Stackoverflow Hi python noob here. I been learning python for couple of weeks so I don’t know if this is possible or even super easy. I have an excel file

Imperatively map both entity and value object inside that entity to one table

Let's say I have an entity which is mapped to a postgresql table in sqlalchemy. @dataclass class User: id: int email: str password: str country: