Quantcast
Browsing all 14097 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

numpy convolve with valid

I am working on convolving chunks of a signal with a moving average type smoothing operation but having issues with the padding errors which affects downstream calculations.If plotted this is the issue...

View Article


Codewars 4 kyu "Most frequently used words in a text" with Python

Write a function that, given a string of text (possibly with punctuation and line-breaks), returns an array of the top-3 most occurring words, in descending order of the number of...

View Article


How can i do to get the list of stopwords using python

How can i do to to a get the list of keywords of stopwords in french because my data is in french.stop_words=stopwords.words('french')

View Article

Image may be NSFW.
Clik here to view.

Connection Error - Query SQL database on databricks SQLwarehouse

I want to query SQL tables in databricks sqlwarehouse from local python setup.I created a new sqlwarehouse in azure databricks, used the python example inorder to query sample tables. After several...

View Article

Python struct.pack and unpack

I want to reverse the packing of the following code:struct.pack("<"+"I"*elements, *self.buf[:elements])I know "<" means little endian and "I" is unsigned int. How can I use struct.unpack to...

View Article


Why am I getting this error when loading fine-trained T5 Model?

I'm trying to load a fine-tuned T5 model that I trained myself. I have it in the correct directory, the file is a .pthI'm basically working with the exact same code, that has always worked so far, but...

View Article

torchtext and fasttext vectorization

I found example with use ready vectors for Glove (for FastText the same example) :`# set up fieldsTEXT = data.Field(lower=True, include_lengths=True, batch_first=True)LABEL =...

View Article

How do install gst-python on macOS to work with the recommended GStreamer...

I'm trying to get the following to work on macOS 14.4.1 on an M1 Pro:$ python3Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwinType "help", "copyright", "credits"...

View Article


Import "vk_api" could not be resolved, Error importing packages and libraries

I'm new to Python, and I've never programmed before, but recently I started to get involved in this topic. I'm trying to make an application for listening to and downloading music from VK, for this I...

View Article


Is datetime.strptime safe with untrusted inputs?

Pretty much the title. I want to use datetime.strptime in my flask application with dates I am getting over post requests.Can I directly feed the input to strptime and catch exceptions and that should...

View Article

Getting the default font in Tkinter

I'm running Python 3.6 and was wondering if there is a way to get the default font that Tkinter uses, more specifically the default font that the Canvas object uses when canvas.create_text is called.

View Article

"The application did not respond" when running "Purge" command with a discord...

Everytime I run my command "purge" on my Discord bot, I keep seeing "The application did not respond" after the command runs and deletes the limited messages. I'm using discord.app_commands (I believe)...

View Article

django development server, how to stop it when it run in background?

I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know how...

View Article


Generating word docs with Flask?

I'm trying to spin up a single page flask application that allows users to download a word document. I've already figured out how to make/save the document using python-docx, but now I need to make the...

View Article

Finding Cyclic Shifts Of Strings

I'm a beginner coder and I'm trying to find cyclic shifts of strings. A cyclic shift of a string is obtained by moving characters from the beginning of the string to the end of the string. For example,...

View Article


Image may be NSFW.
Clik here to view.

Python datetime object does not change date light saving automatically when...

I am in NZ and we just ended daylight saving on 7th April, when I change the day of the object back to before daylight saving ends, it does not update the timezone back to +13.from django.utils import...

View Article

How to get the highest element in absolute value in a numpy matrix?

Here is what I am currently doing, it works but it's a little cumbersome:x = np.matrix([[1, 1], [2, -3]])xmax = x.flat[abs(x).argmax()]

View Article


Need to extract the first and last letter from a word string

I've been stuck with this for a while. basically the get_text_value(text) code below is passed a string of words and it extracts the first and last letter of each word, matches it up with letter_values...

View Article

How to create a persistent view from a pyspark dataframe

I have a pyspark dataframe df, and would like to save it as a persistent view. Is that possible? I tried to do the following:df.createOrReplaceTempView("temp_view")spark.sql('CREATE VIEW my_view AS...

View Article

Oak 1 crashes on raspberry pi 4 8gb ram only on usb 3.0

Im running an inference on a oak 1 using a raspberry pi 4 8gb ram, when i run it on usb 2.0 it workes perfectly for about 10 min (then it crashes, I think because of oak 1 heatting up). The real...

View Article
Browsing all 14097 articles
Browse latest View live