Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question I’d like to get the digits of the Nth number by using the given num…
Tag: python
Calculate activity interval for a pandas DataFrame with datetime rows
Given the following DataFrame of pandas in Python: Displays the switching on and off of 3 light bulbs at different times using date and time objects. I want to add a new column, called cost_days. This column will include only for rows where the variable using_time is different from NaT. Information on how man…
How do I make sure GridSearchCV first does the cross split and then the imputing?
I have a GridSearchCV, with a pipeline that looks something like this: my GridSearchCV looks like this: with Cross Validation = 5 So, how do I ensure that I split the data first, and then impute in the most frequent? Answer GridSearchCV will run roughly like this: You can be sure that SimpleImputer and Standa…
python_ hh:mm:ss.000 in excel converts to dataframe by xlwings has problem
When I build exe file because of DRM i can’t use pd.read_excel or pd.ExcelFile for open excel files. So I try to use xlwings for open the DRM excel file. But time data converts to something strange data…by xlwings. I don’t know what’s it and how to fix. -here is time data- result : Ans…
Ursina – Colorize custom model using MTL file
I’m using python 3.8, Windows 10, Ursina. I have a custom 3D model, created with this tool. When exporting, it includes an MTL file (which I’m guessing it uses to store the shape colors). When I go to load it in Ursina, it gives me the following error: Where <path> is my (correct) folder pat…
How to check a text editor (file) for the presence of a certain word that the user entered
There is a variable email = String Var() that transmits the entered login, I want to check through the open file whether the entered login is already in the text editor Users.txt ,but the compiler writes that it cannot read with the StringVar() data type, the question is that how can I convert the email varia…
Pint: How do I define my own units in the Pint Python library?
I am working with Pint to do unit conversions in a Python project. The project involves temperature gradients, which are not defined in Pint. My units are typically “deg.C/km” so I’d like to be able to declare a Quantity as “55 deg.C/km”. I’d then like to use Pint to painle…
I want to add date range where value is True in pandas
Dt 1/2/21 2/2/21 3/2/21 4/2/21 5/2/21 6/2/21 7/2/21 Attendance(Expected output in python) san TRUE TRUE TRUE TRUE TRUE TRUE TRUE 1/2/21 – 7/2/21 don TRUE TRUE FALSE TRUE TRUE TRUE TRUE 1/2/21 -2/2/21,4/2/21-7/2/21 sam FALSE TRUE TRUE FALSE TRUE TRUE TRUE 2/2/21 – 3/2/21,5/2/21-7/2/21 den FALSE FAL…
FastAPI FileResponse cannot find file in TempDirectory
I’m trying to write an endpoint that just accepts an image and attempts to convert it into another format, by running a command on the system. Then I return the converted file. It’s slow and oh-so-simple, and I don’t have to store files anywhere, except temporarily. I’d like all the fi…
How to get this result when multiplying 1d-array by 2d-array?
I am struggling to figure out, how the output is calculated can you please explain? I have this multiplied by this array : c = np.array([3267. , 3375.9, 3484.8, 3630., 3740.]) the output is: array([1050885., 1068309., 1085733., 1103157., 1120581.]) Answer Grasping at straws because it feels like there’s…