<commit_before># STRING FORMAT
#--------------------------------
# more: https://mkaz.tech/code/python-string-format-cookbook/
print 'this score is {}'.format(1.1234)
'this score is 1.1234'
print 'this score is {:.2f}'.format(1.1234) # 2 decimal format
'this score is 1.12'


# LOOPS
#--------------------------------
# enumerate
a = [10,123,1231,232143434,234235]
for num, i in enumerate(a):
    print num, i

0 10
1 123
2 1231
3 232143434
4 234235

# can change the start number
for num, i in enumerate(a, 1):
    print num, i

1 10
2 123
3 1231
4 232143434
5 234235

# LIST SLICING
#--------------------------------
list1[-1] # get last in the list
list1[::20] # get every 20th feature

# append
x = [1, 2, 3]
x.append([4, 5])
print (x)
>>>[1, 2, 3, [4, 5]]

# extend
x = [1, 2, 3]
x.extend([4, 5])
print (x)
>>>[1, 2, 3, 4, 5]


# DICTIONARY
#--------------------------------
dictname.items()
# dict_items([('97', 63), ('129', 1), ('134', 2)])
dictname.keys()
# dict_keys(['97', '129', '134'])
dictname.values()
# dict_values([63, 1, 2])


# SORTING<commit_msg>added removing keys in dictionary<commit_after># STRING FORMAT
#--------------------------------
# more: https://mkaz.tech/code/python-string-format-cookbook/
print 'this score is {}'.format(1.1234)
'this score is 1.1234'
print 'this score is {:.2f}'.format(1.1234) # 2 decimal format
'this score is 1.12'


# LOOPS
#--------------------------------
# enumerate
a = [10,123,1231,232143434,234235]
for num, i in enumerate(a):
    print num, i

0 10
1 123
2 1231
3 232143434
4 234235

# can change the start number
for num, i in enumerate(a, 1):
    print num, i

1 10
2 123
3 1231
4 232143434
5 234235

# LIST SLICING
#--------------------------------
list1[-1] # get last in the list
list1[::20] # get every 20th feature

# append
x = [1, 2, 3]
x.append([4, 5])
print (x)
>>>[1, 2, 3, [4, 5]]

# extend
x = [1, 2, 3]
x.extend([4, 5])
print (x)
>>>[1, 2, 3, 4, 5]


# DICTIONARY
#--------------------------------
dictname.items()
# dict_items([('97', 63), ('129', 1), ('134', 2)])
dictname.keys()
# dict_keys(['97', '129', '134'])
dictname.values()
# dict_values([63, 1, 2])

# remove key
dictname.pop('keyName')


# SORTING
{'fraction_non_alphanumeric': 0.28153564899451555, 'fraction_numerical': 0.14076782449725778, 'mean_word_length': 2.3522205206738134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7624141', 'n_tokens_mistral': 1059, 'n_tokens_neox': 874, 'n_words': 266}