Category "python"

Adding libraries in Spyder

I installed the libraries I needed by using these commands below: conda install matplotlib conda install numpy I see the '# All requested packages already insta

Sentence Pair Classification using BERT Transformers Value Error

I was doing sentence pair classification using BERT. At first, I encode the sentence pair as train_encode = tokenizer(train1, train2,padding="max_length",trunca

values keep piling append function python

i have a list li_LBF which has 287 list inside it..i want calculate the Euclidean Distance between every list..but my code not working...the list where i am try

Use RDD to map dataframe rows into custom objects pyspark

I want to convert each row of my dataframe into to a Python class object called Fruit. I have a dataframe df with the following columns: Identifier, Name, Quant

UnboundLocalError: local variable <function> referenced before assignment

I have read similar questions on this topic such as from here, here, and here, and others on scope, but I still cannot understand why answers do not explain the

UnboundLocalError: local variable <function> referenced before assignment

I have read similar questions on this topic such as from here, here, and here, and others on scope, but I still cannot understand why answers do not explain the

Use RDD to map dataframe rows into custom objects pyspark

I want to convert each row of my dataframe into to a Python class object called Fruit. I have a dataframe df with the following columns: Identifier, Name, Quant

Django form_valid method

In my form's view I wonder what if I don't add product_form.save method in the code below and what if I add that: def form_valid(self, form): product_fo

Django form_valid method

In my form's view I wonder what if I don't add product_form.save method in the code below and what if I add that: def form_valid(self, form): product_fo

Using python and suds, data not read by server side because element is not defined as an array

I am a very inexperienced programmer with no formal education. Details will be extremely helpful in any responses. I have made several basic python scripts to c

Character problem with endpoint '/{GROUP_ID}/feed' of Facebook API

The code below works without error, but the posted text is cut off in Facebook as soon as a "&" character is found. TOKEN_ID = '<Token>' GROUP_ID = '&

How can I create an automated line that cut a dendrogram based on cluster number?

I'm coding in python, trying to create an horizontal line based on decided number of clusters. In my case I used 5 number of clusters, and the distance (accordi

Investpy module

My code: import investpy print(investpy.__version__) df = investpy.get_stock_historical_data(stock='AAPL', country='Uni

How to call async function in sync code and break async/await chain (i.e. how to wrap an async function in a sync function)

All my code is written without asyncio in mind; however, I use one function that is async (written by another developer; for my purposes it's a black box). Let'

Calculate the pair-wise correlation between distinct class pairs over two feature columns and the target variable?

Most similar questions relating to calculating this involve a single correlation value for each feature column, showing how the features in a dataset correlate

Remove the initial text when using the nltk.book module in python

I'm learning about NLP and messing around with nltk but just by importing the module on my program, whenever I run the script I get the following text: *** Intr

PyCharm SSH Remote Interpreter Issue

I am trying use a remote interpreter over SSH. PyCharm can connect to the server and everything goes smoothly until last minute when I try to add the interprete

Having trouble expanding/normalizing a dataframe column of dictionary values into a dataframe/ other columns

I'm trying to expand a dataframe column of dictionaries into it's own dataframe/other columns. I have already tried using json_normalize, iteration, and list c

How to open Python files in the new Windows Terminal?

I'm trying out the Windows Terminal app and I want to start using it instead of CMD. The problem is, I cannot set the File Explorer to open Python files with it

How replace all these "if...elif...else" statements with something more concise?

Is there a way to reduce the amount of elif things in my statement? In another question I asked someone said that my code suffered from redundancy and it defini