What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-25 00:40:03
reset shuffed array python
import random class Solution(object): def __init__(self, nums): self.original = [x for x in nums] self.temp = nums self.indices = [x for x in range(len(nums))] def re... Add solution -
Assembly 2022-03-22 20:55:01
printf format specifiers c
/* printf example */ #include <stdio.h> int main() { printf ("Characters: %c %c \n", 'a', 65); printf ("Decimals: %d %ld\n", 1977, 650000L); printf ("Preceding with blanks: %10d \n", 1977); printf ("Pr... Add solution -
Python 2022-03-18 09:45:04
numpy how to apply interpolation all rows
import numpy as np from scipy.interpolate import interp1d # generate some example data W = 3 H = 10 M = 5 A2 = np.arange(W * M).reshape(W, M) print(A2) # [[ 0 1 2 3 4] # [ 5 6 7 8 9] # [10 11 12 13 14]] # the initial column indices for A2 x =... Add solution -
Python 2022-03-17 07:05:09
one-hot encoder that maps a column of category indices to a column of binary vectors
# one-hot encoder that maps a column of category indices to a column of binary vectors stringIndexer = StringIndexer(inputCol="label", outputCol="indexed") model = stringIndexer.fit(stringIndDf) td = mod... Add solution -
Javascript 2022-03-16 22:30:12
javascript loop through arrya
var data = [1, 2, 3, 4, 5, 6]; // traditional for loop for(let i=0; i<=data.length; i++) { console.log(data[i]) // 1 2 3 4 5 6 } // using for...of for(let i of data) { console.log(i) // 1 2 3 4 5 6 } // using for...in for(let i in data) { con... Add solution -
Python 2022-03-05 09:35:20
tuples in python
# A tuple is a sequence of immutable Python objects. Tuples are # sequences, just like lists. The differences between tuples # and lists are, the tuples cannot be changed unlike lists and # tuples use parentheses, whereas lists use square brackets. tup1 =... Add solution -
Javascript 2022-03-02 16:25:17
agregar clase en jquery
// Agregar una clase o varias separadas por espacio $('algun_elemento').addClass('alguna-clase otra-clase'); // A partir de jquery 1.4 puedes utilizar una función $('algun_elemento').addClass(function(indice) { return "item-" + indice; }); Add solution