Couldnt come up with a better title, so here we are. I am running the following code: As far as I understand, I first make a copy of ‘df’ and then I change the copy. What makes me confused is that when I run the second line, the ‘date’ column, becomes the index even in the ‘df…
Tag: python
fields_view_get does not exist in Odoo 16
I was testing the modules of Odoo 15 that I developed in Odoo 16, I was using a lot of the method fields_views_get to have some behaviors to inject domain and context, before to render the component, but currently I can not find this method. Someone here knows what will be the alternative to achieve some beha…
Pandas .transform() results in NaN values after update to newer version
I have some code that used to function ~3-4 years ago. I’ve upgraded to newer versions of pandas, numpy, python since then and it has broken. I’ve isolated what I believe is the issue, but don’t quite understand why it occurs. Problem: the last line “dc” is a pandas.Series with o…
How can I change what a user already inputted and change a specific part of the input based on the parameters?
this is what my effort. The goal is to take in two inputs (n,m), with n being the rows of seats and m being the number of columns. then I have to take in n more inputs with each one being whether a seat in that row is taken, for example, if 2 3 was inputted for n m then,
Performance impact in having a single import per line
does anybody know if there is a performance difference between having all imports from one module in a single line vs one per line. For example, having: instead of: I’m trying to convince my team to use reorder-python-imports in our pre-commit hooks and this doubt is the only obstacle that prevents me f…
discord.py some commands simply dont run
after adding these commands my code has stopped working removing some help however adding them back adds makes it not process any commands i try don’t run besides the deleted message one i have tried using the await client.commands.process and it also dosent work. it dosent give an error it just sits th…
Docker run does not produce any endpoint
I am trying to dockerize this repo. After building it like so: I try to run it like so: It downloads the necessary libraries and packages: And then nothing… No errors, no endpoints generated, just radio silence. What’s wrong? And how do I fix it? Answer You appear to be expecting your application …
Testing for None on a non Optional input parameter
Let’s say I have a python module with the following function: For that function, I have the unit test that follows: Given the type hints in the function, the input parameter should always be a defined string. But type hints are… hints. Nothing prevents the user from passing whatever it wants, and …
How to make dotted line in a binary array
how to create the dotted line in the below NumPy array bh=make_figure(b,’gh’) requirement: how to convert element 1 into 0 with the step of two expected outputs is like I tried with a brute force algorithm, but I am not able to find the solution output array looks like for visual representation li…
Possible combination of a list to key value pairs keeping 1 element as key and rest as a value
Hi can someone help me with the below requirement ? Please note the list length can be any number , for example i have just put 4. I need the output as list of dictionaries with 1 value as key and rest of the values clubbed as list of all possible combination. Thanks in advance. Input: Output: Answer Try: Pri…