What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-24 23:05:02
python convert array to linked list
# credit to the Stack Overflow user in the source link linked_list = {'a':'b', 'b': 'c', 'c': 'd', 'd': None} def next_ll(state=['a']): value = state[0] if value is not None: state[0] = linked_list[value] return value [x for x in iter(next_l... Add solution -
Python 2022-03-05 16:40:15
numpy count occurrences in interval array
# credit to Stack Overflow user in source link # a is a numpy array # Note: the following syntax allows you to count the number of elements x # of the array such that 25 < x < 100 ((a > 25) & (a < 100)).sum() Add solution -
Python 2022-03-02 20:00:07
pandas join two series on index
# credit to Stack Overflow user in the source link s1 = pd.Series([1, 2], index=['A', 'B'], name='s1') s2 = pd.Series([3, 4], index=['A', 'B'], name='s2') pd.concat([s1, s2], axis=1) Out: s1 s2 A 1 3 B 2 4 pd.concat([s1, s2], axis=1).reset_... Add solution -
Python 2022-02-21 00:35:02
affinity propagation cosine similarity python
# credit to Stack Overflow user in the source link import numpy as np from sklearn.metrics.pairwise import cosine_distances # some dummy data word_vectors = np.random.random((77, 300)) word_cosine = cosine_distances(word_vectors) affprop = AffinityPropa... Add solution -
Python 2022-02-16 01:05:03
colab erase recycle bin drive
# credit to Stack Overflow user in the source link from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials auth.authenticate_user() gauth = GoogleAuth() ga... Add solution -
Other 2022-02-13 23:45:18
add font to phpstorm
#COPIED FROM STACK OVERFLOW https://stackoverflow.com/a/43407710 There is no need to add fonts to the IntelliJ IDE directly. You should install the font to your OS. For Ubuntu: Download the font (e.g. .otf), Unzip it, and then install by double-clickin... Add solution -
Python 2022-02-12 21:05:21
how to convert linked list to list in python
# credit to the Stack Overflow user in the source link linked_list = {'a':'b', 'b': 'c', 'c': 'd', 'd': None} def next_ll(state=['a']): value = state[0] if value is not None: state[0] = linked_list[value] return value [x for x in iter(next_l... Add solution -
Python 2022-02-02 00:51:17
create pickle file python
import pickle #credits to stack overflow user= blender a = {'hello': 'world'} with open('filename.pkl', 'wb') as handle: pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL) with open('filename.pkl', 'rb') as handle: b = pickle.load(handle)... Add solution -
Javascript 2022-02-01 17:12:09
browse file get full path javascript
const onChange = (event) => { const value = event.target.value; // this will return C:\fakepath\somefile.ext console.log(value); const files = event.target.files; //this will return an ARRAY of File object console.log(files); } return (... Add solution