Random snippets of all sorts of code, mixed with a selection of help and advice.
The Error in this python file cannot be fixed with binary search [closed]
25 February 2026 @ 11:26 pm
def clean(X):
for col in \[x for x in X.columns if 'date' in x.lower()\]:
X\[col\] = pd.to_datetime(X\[col\]).astype('int64')//10\*\*9
for col in X.columns:
if X\[col\].dtype != 'object': X\[col\] = X\[col\].fillna(X\[col\].mean())
return X
X_train2 = pd.read_csv('data/Train.csv')
for col in X_train2.columns:
if X_train2\[col\].dtype == 'object' and col != 'ID':
X_train2\[col\] = X_train2\[col\].astype('category')
mp = {}
for c in X_train.columns:
mp\[c\] = X_train2\[c\].dtype
def clean2(X):
for col in X.columns:
X\[col\] = X\[col\].astype(mp\[col\])
return X
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder, StandardScaler, FunctionTransformer
from sklearn.compose import ColumnTransformer
from sklearn.ensemble import BaggingRegressor, Vot
Adding elements together as if im just placing them next to eachother?
25 February 2026 @ 11:25 pm
I'm not really sure how to explain this question, but I hope its ok enough.
Im writing a project for school, and one of the requirements is to add elements from a substring together and determine if they're a prime, but the way my class wants me to do so is to add them as if I was timzing one of the numbers by 10 and adding them together that way.
For example; if a substring contains {1, 2, 3}, the results of adding each element up shouldn't equal 3, 4, 5 etc; they should equal 12, 23, 31. I'm not entirely sure how to do this? I tried looking it up but I couldn't phrase it in a way that made sense.
Please help, and thank you.
Trying to use IMPORTXML to grab a thumbnail on a youtube playlist for google sheets [duplicate]
25 February 2026 @ 11:22 pm
Im trying to set up a formula that allows me to input a link to a youtube playlist and grab the thumbnail it shows under the playlist preview. Currently the formula i'm using is:
=IMPORTXML("https://www.youtube.com/playlist?list=PLhzzxN1u5y392mx3k9PnQvLjkf2vJCkIv","/html/body/ytd-app/div[1]/ytd-page-manager/ytd-browse/div[4]/ytd-tabbed-page-header/div/div/yt-page-header-renderer/yt-page-header-view-model/div[1]/cinematic-container-view-model/img/@src")
When I input this formula into google sheets it tells me the imported content is empty.
Most Efficient Clean Ways to Fill with Mean or Median
25 February 2026 @ 10:57 pm
import pandas as pd
train = pd.read_csv('Train.csv')
test = pd.read_csv('Test.csv')
train = train.drop('ID', axis='columns')
test = test.drop('ID', axis='columns')
TARGET_FEATURE = train.columns.difference(test.columns) #'Yield'
import xgboost
import lightgbm
import numpy as np
import catboost
from sklearn.pipeline import *
from sklearn.compose import TransformedTargetRegressor
from sklearn.model_selection import KFold, cross_validate
from datetime import *
def clean(df, training=1):
harv = pd.to_datetime(df['Harv_date'], errors='coerce')
seed = pd.to_datetime(df['SeedingSowingTransplanting'], errors='coerce')
df['TotalCropDuration'] = (harv - seed).dt.days.fillna(-1).astype(float)
df['Irrigation_Density'] = df['TransplantingIrrigationHours'] / (df['Acre'] + 1e-5)
df['Cultivation_Intensity'] = df['CropCultLand'] / (df['CultLand'] + 1e-5)
df['Irrigation_Density'] = df['TransplantingIrrigationHours'] / (df['Acre'] + 1e-5)
df['Cost_Per_Acre'] =
How to make a racing game
25 February 2026 @ 10:53 pm
I'd like to make a racing game with Unreal, but I don't have any details and I don't have the drift function I want, so I'm inquiring.
The driving function itself is not difficult, but I'd rather make a drift that appears in Project D than a realistic drift. What should I do?
So i am making a party chat with Skript [in minecraft] put i ran into a problem
25 February 2026 @ 10:53 pm
The problem is that for some reason it executes into the if isnt set and still haven't found a way to fix it, here is my code, helping would be appreciated :D
command /party <text>:
aliases: /p
usage: /party Create /party Chat
trigger:
if arg-1 is "Create":
set {partylist::%player's uuid%} to random integer between 0 and 999999999999 #note this one isnt finished so you dont have to touch it
send "&eYour party was created!"
set {_plrparty} to true
if arg-1 is "Chat":
if {_plrparty} is not set:
set {_plrparty} to false
send "&4You are not in a party"
else if {_plrparty} = true:
send "&7You are now in party chat"
else:
send "&4You are not in a party"
send "else"
Deploying valid AI models to Azure foundry just stopped working with an unhelpful error message
25 February 2026 @ 10:36 pm
I have some Bicep code that deploys AI models to Azure Foundry. They were deploying one day and then, with no code changes to the Bicep, they stopped working with this error:
"code":"715-123420","message":"An error occurred. Please reach out to support for additional assistance."
I have tried:
Other models
Removing my custom guardrails and using Microsoft.DefaultV2
but I cannot get the error message to change or go away.
Any help would be great.
Note: it seems others having been hitting this error from around mid February but I cant see anyone with a solution.
Here is my Bicep code:
// Model deployment for gpt-4o-mini
resource gpt4oMiniDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = {
parent: azureFoundry
name: 'gpt-4o-mini'
sku: {
name: 'GlobalSta
How to adjust CSS to orientation during printing?
25 February 2026 @ 1:26 pm
I was trying to add a page break after an element when the page is in landscape orientation with a media query:
@media print and (orientation: landscape) {
.item2 {
break-after: page;
}
}
This works fine when the orientation is chosen in the print dialog.
However, when the page size is suggested via css the page break does not appear:
@page {
size: a4 landscape;
}
Example:
body {
print-color-adjust: exact;
}
.item1,
.item2,
.item3 {
width: 100%;
height: 200px;
}
.item1, .item3 {
background-color: gray;
}
.item2 {
background-color: red;
}
@page {
/* remove th
Backup GIT Repository Azure DevOps
25 February 2026 @ 9:12 am
For disaster recovery, my company needs backups of our ADO Git repos. My predecessor set up a backup by cloning the repos with --no-checkout option:
git clone --no-checkout {ReposURL} {DestinationFolder}
My questions are:
Would it be better to back up the repos using --mirror instead of --no-checkout?
How would I recover the files using my predecessors backup if the ADO Service ever shuts down or can't be accessed?
Could I recover all files using the following command, even without access to the cloud service?
git reset --hard HEAD
SQL Server 2016 patch Error while patching to version v6475.1
24 February 2026 @ 8:26 pm
Image of Error
I am trying to patch SQL Server 2016 on Windows, but while patching, I get this error:
SQL Server Setup failure
SQL Server Setup has encountered the following error:
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Error code 0x84610001.
Can someone tell me any suggestions to fix this error?