Category "python"

Python-separate weekly date range from Sunday to next week Saturday

I am working on data cleaning with a data frame in Python, there is one column named datetime, I need to separate this column datetime to each week by range fro

How to get existing pivot table names and modify them using xlwings?

I am using xlwings(python3) to automate an excel report, need to find a way to get the names of all the existing pivot tables on a given sheet and then change t

3D plot not loading Python

Sorry I'm a beginner with Python and am unable to find a bug with this program because I get an infinite load. I am trying to plot 'abs(psi)' in three dimension

Download function: File does not exist - 'no file'

I implemented an upload and download button. The upload button functions properly, but when I click the download button it tells me that the file I want to down

python dictionary best practice

I am new to Python. I want to create a dictionary. Each key will have three values. Which is a better approach?: 1.One Dictionary like this: dict = {'a': [value

TensorFlow warning: Allocation of X exceeds 10% of free system memory

I just wonder what does it means the allocation number value(the X in the title of my question) in the tensorflow warning 2022-05-14 19:03:39.958223: W tensorfl

How to convert data in Polars?

I used .write_ipc from Polars to store as a feather file. It turns out that the numerical strings have been saved as integers. So I need to convert the columns

How to change the node tensor type on an entire PyTorch Geometric Dataset?

Is there a function to change the tensor type (from long to float in my case) on the node features of every graph in a pytorch geometric dataset? Iterating over

Pandas Groupby with Aggregates

I am working with pandas and I was wondering if there is a difference based on which statistical functions are applied as shown in the below examples and if the

I am confused about these python errors [duplicate]

So, I am developing this game where the graphics is made entirely of text. This prototype looks right but there are some errors in the program

Expand 2-D Numpy integer Array as binary but in parallel

I want to convert arrays of integers to 0 or 1s, padding with 0s if the other array possesses the larger value. Examples: ex1 = np.array([[0],[3]]) => array(

How to handle special characters in the string while updating a table using python

Im trying to update some rows to a table, in one of the row a string is having few special charecters. I should be updating the string as is to the db. I have t

How to pass ctx argument to own function?

It isn't exactly my code but similar example: Function body: async def fun(fun_word) ctx.send(fun_word) Then main code: @client.event async def on_message(me

Counting how many times value meets 2 times in a row in list

I need to count how many times 'Eagle' appears 2 times in a row in random generated list. In case ['Eagle', 'Eagle', 'Eagle', 'Eagle'] it should count 2, not 3

ValueError: 2307:2222: not well-formed (invalid token)

I've been working in jupyter lab with the package threeML, as of last night everything was working fine when my computer crashed with the Jupyter servers still

How to do the visualization of Optimal Classification Trees in python

I used the code in github:https://github.com/pan5431333/pyoptree. I read the raw code and did not find how to draw the tree, please give me some useful guide to

Django attribute error while creating superuser

I've created a custom user model using AbstractBaseUser. When I try to create a super user using terminal via createsuperuser command. I get in create_superuser

How to handle special characters in the string while updating a table using python

Im trying to update some rows to a table, in one of the row a string is having few special charecters. I should be updating the string as is to the db. I have t

'_ctypes' module missing when python is installed via pyenv

I am trying to set up an environment using pyenv and homebrew on Ubuntu 20.04. There are no problems with my system install of python. However, when I install a

trying to send data from one script in python to another script

I am trying to write a script so when an IP address can't be seen a message gets sent with a telegram letting me know which computer is offline I have been able