Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Sampling data in different ways

#enumerate() function takes a collection/data (e.g. a tuple) and returns it as an enumerate object.
#This function adds a counter as the key of the enumerate object.
#In simple language enumerate will attach numbering starting from 0 to n- for the data provided.

x = ['Kushal', 'Aadarsh', 'Jay']  #[]
y = enumerate(x)  #,4

print(list(y)) #y      tuple   list
Comment

Sampling data in different ways

# Python program to illustrate 
# enumerate function in loops 
l1 = ["Johnwick","AD","Dead"] 

# printing the tuples in object directly 
for ele in enumerate(l1): 
	print (ele) 

print()

# changing index and printing separately 
for count,ele in enumerate(l1): 
	print (count,ele)
Comment

PREVIOUS NEXT
Code Example
Python :: Sending Data in Unstructured File Form 
Python :: property values 
Python :: self argument in python 
Python :: python http server onliner 
Python :: is tkinter built into python 
Python :: how to give tab space in python 
Python :: python how to tell if class is initialized 
Python :: pandas concatenation (concat) using list comprehension 
Python :: calculating expressions with sqrt signs 
Python :: twitter python 
Python :: python using recursion advanced 
Python :: python Access both key and value using items() 
Python :: how to use kite python 
Python :: hash tables in python 
Python :: spark sparsevector to list 
Python :: python print statements 
Python :: pyqt stretch image 
Python :: how to create a scoreboard for the top 5 players in python 
Python :: when was barracoon written 
Python :: numpy convolution stride tricks 
Python :: load pandas dataframe with one row per line and 1 column no delimiter 
Python :: all possibilities of 0 and 1 
Python :: custom dense layer 
Python :: Python Module Search Path 
Python :: python @property decorator 
Python :: encrypt 
Python :: python pynput hotkeys 
Python :: binning continuous values in pyspark 
Python :: django python get more commands paramaters 
Python :: python project structure 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =