Skip to content

Instantly share code, notes, and snippets.

View Jayasagar's full-sized avatar

Jayasagar Jagirapu Jayasagar

View GitHub Profile
precision recall f1-score support
Iris-setosa 1.00 1.00 1.00 7
Iris-versicolor 1.00 0.88 0.93 8
Iris-virginica 0.94 1.00 0.97 15
avg/total 0.97 0.97 0.97 30
Graph<ClosedShape, Consumer.Control> completionStageGraph = GraphDSL.create(source, (builder, sourceShape) -> {
// Add Broadcast
// Add Flows
// Add Sinks
builder
.from(...)
.viaFanOut(...)
.via(...)
.to(...);
from enum import Enum
class ConditionOperator(Enum):
EQ ='EQ'
LTE ='LTE'
GTE = 'GTE'
print(ConditionOperator.EQ.name) ## EQ
itemCost = {'item1': 100, 'item2': 10, 'item3': 5}
# Get value using Key
print(itemCost['item1'])
# Put value
itemCost["item4"] = 99
# Length of the dictionary
print(len(itemCost))
# Complex Nested tuple
complexNestedTuple = ("Alice", [12.4, 34], ('Male', 'Age'))
print(complexNestedTuple) ## ('Alice', [12.4, 34], ('Male', 'Age'))
# List of users
list = ['Deli','Corn', 'Alice', 'Bob']
# Length of the user list
print('List Length', len(list))
# List slice
print(list[1:3]) ## ['Corn', 'Alice'] -> include element at index 1 and exclude elememnt at index 3
# Sorting:: sort function doesn't return a value! But 'list' should have sorted.
list.sort()
# String examples
str = 'Python'
print str[0] ## P
print len(str) ## 6
print str + ' py' ## Python py
# String Slice
print str[2:4] ## th -> include index 2 and exclude index 4
print str[:] ## Python
# import modules used here. sys is a very standard module
import sys
# Entry point to stand alone program i.e. main()
def main():
print('Hello World!')
# Call the main() to begin the execution
# This module can run directly with below code! Else it can used as a import in another module!
if __name__ == '__main__':
def excludeColumnAtIndex(self, dataset, indexToExclude):
 “””Exclude the complete specific column values
 from the given dataset. “””
 # code goes her
Map<String, Optional<Integer>> highestDeviceCostCustomerPaid = consumerList
.stream()
.flatMap(consumer -> consumer.getThings()
.stream()
.map(thing -> new AbstractMap.SimpleImmutableEntry<>(consumer.getName(), thing.getCost()))
)
.collect(Collectors.groupingBy(entry -> entry.getKey(),
Collectors.mapping(entry -> entry.getValue(), Collectors.maxBy(Comparator.comparingInt(value -> value)))));
System.out.println(highestDeviceCostCustomerPaid);