blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f7c363052f35fdc2eba3b366458ea9ebce431ff | Python | danwaterfield/algo | /compression.py | UTF-8 | 273 | 3.296875 | 3 | [] | no_license |
import itertools
string = "aaaabbcdddeeeefffggggggg"
def compress(string):
if len(string) <= 1:
return "Too short!"
return ''.join(letter + str(len(list(group)))
for letter, group in itertools.groupby(string))
if __name__ == '__main__':
print(compress(string)) | true |
3cb478ae1b79cf58ac2456104a39b1fc44639873 | Python | EdvardPedersen/StudentGroups | /gui/gui.py | UTF-8 | 2,828 | 3.125 | 3 | [] | no_license | import tkinter as tk
import math
import argparse
class Button(tk.Button):
def __init__(self, parent, num, max_num):
super().__init__(parent)
self.parent = parent
self.num = num
self["height"] = 10
self["width"] = 10
self["text"] = str(num)
self["font"] = ("Co... | true |
c465567062beb6426861ab8fc8e58415cbbfab39 | Python | Sequd/python | /Examples/Show Graphics.py | UTF-8 | 81 | 2.828125 | 3 | [] | no_license | import matplotlib.pyplot as plot
y = range(11)
print(y)
plot.plot(y)
plot.show() | true |
051e875879bdbcea3e8e9f282bf02a4528d1d024 | Python | ritik1457/python-codes | /function123654789.py | UTF-8 | 211 | 3.09375 | 3 | [] | no_license | def SI():
p=int(input("enter value of principle"))
r=int(input("enter value of rate of intrest"))
t=int(input("enter value of time"))
si=p*r*t
return si
si=SI()
print("value of SI",si) | true |
82d6a3f961a5f845f6840097a740d842a9d4a3fa | Python | coderefinery/ci-example-python | /test/unittests.py | UTF-8 | 1,029 | 2.9375 | 3 | [] | no_license | # encoding: utf-8
import unittest
import dothemath.operations as oper
class SimpleTests(unittest.TestCase):
def setup(self):
"""
Set up test datasets
:return:
"""
def tearDown(self):
"""
Tear down test datasets
:return:
"""
def test_sum_0... | true |
4e75a8a49290ed8daf5e181b8cd04bd9d5ac6d0e | Python | TomTomW/mayaScripts | /scripts_from_school/problem3.py | UTF-8 | 6,307 | 3.25 | 3 | [] | no_license | '''Thomas Whitzer 159005085'''
from decimal import *
class ChangeJar:
def __init__(self, D = {25: 0, 10: 0, 5: 0, 1:0}):
coins = [25, 10, 5, 1]
tempDict = {}
names = {25:'quarters', 10:'dimes', 5:'nickels', 1:'pennies'}
if D == {25: 0, 10: 0, 5: 0, 1:0}:
temp... | true |
72d91678ca0968a55c5ec1162a1ef311edbf3db6 | Python | waseemchishti/Flask-with-Swagger-API-Development | /Swagger-Flask_Medium.py | UTF-8 | 6,517 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ### Import Libraries
# In[ ]:
#--Step--1
###################################################################################################
import numpy as np
import pandas as pd
# from flask import Flask, render_template
# from flask_restplus import Api, Resource
import os
... | true |
fc8dea8181c8fe95cdd0442ab010e9bddca1f841 | Python | woomir/camping | /samrak.py | UTF-8 | 8,000 | 2.953125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import time
import telegram
import random
import datetime
from telegramCustomFunc import telegramSendMessage
import platform
# 변수 설정
searchCount = 0
sendMessageCount = 0
def connectWebsite(driver):
url = 'http://www.nakdongcamping.com/r... | true |
6287d78be4a1c22e193d023aa76f262a29193b98 | Python | earsnot/ros | /src/grp6_proj/nodes/backup/cameraNode2.py | UTF-8 | 657 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import cv2
def getImage2(IP):
TopCameraAddress = IP
#SideCameraAddress = 'http://192.168.x.xxx/video.cgi'
cap0 = cv2.VideoCapture(TopCameraAddress) #VideoCapture from source 0
#cap1 = cv2.VideoCapture(0) #VideoCapture from source 1
while 1:
ret0, frame0 = cap0.read() #Read next frame
#... | true |
5538b1b458b6a8246585173e63ca9ec305692554 | Python | LitoSantos/jobAnalytics_and_search | /data_lake/stackoverflow_dev.py | UTF-8 | 1,123 | 2.6875 | 3 | [
"MIT"
] | permissive | """StackOverflow Data Transformer Module"""
import os
from pyspark.sql.functions import col
from pyspark.sql.functions import lit
from pyspark.sql.functions import lower
from pyspark.sql.functions import udf
from data_lake.data_util import DataUtil
class StackOverflowDev(DataUtil):
"""StackOverflow Data Transform... | true |
3ccd746afc3b7bcdce53f4709839317e84fb8cd0 | Python | morepath/morepath_sqlalchemy | /morepath_sqlalchemy/collection.py | UTF-8 | 1,009 | 2.75 | 3 | [] | permissive | from .model import Document
MAX_LIMIT = 20
class DocumentCollection:
def __init__(self, db_session, offset, limit):
self.db_session = db_session
self.offset = offset
self.limit = min(limit, MAX_LIMIT)
def query(self):
return self.db_session.query(Document).offset(self.offset)... | true |
2c5d3297bf62fd42587b45196ba57a886a6b0165 | Python | agengsusila/pythonfrommosh | /part 4 strings.py | UTF-8 | 817 | 3.46875 | 3 | [] | no_license | # MATERIAL LESSON
father_name = "My Father's name is Mulyadi" # 2 QUOTES WILL BE USED BECAUSE IN THE STRING THERE ARE HAS 1 QUOTES
rag_sentences = 'In my heart is "ONLY" you' # OTHERWISE 1 QUOTES WILL BE USED BECAUSE IN THE STRING THERE ARE HAS 2 QUOTES
email = '''
Hello Bening,
I hear from my friends that you b... | true |
7e7d86f15b057699adddbcf23cf7a07e91650396 | Python | LucasTranzillo/curso | /resultados/resultados.py | UTF-8 | 5,289 | 4 | 4 | [] | no_license | from random import randint
print('Digite o seu nome: ')
nome = input()
print('Informe sua idade: ')
idade = int(input())
print('Seleciona o time 1: ')
print('1. São Paulo')
print('2. Santos')
print('3. Flamengo')
print('4. Corinthians')
print('5. Palmeiras')
print('6. Confiança')
print('7. Atlético MG')
print... | true |
aed7fb1f875f91bc1e86a48fa1b5e6107656ba70 | Python | numankh/AI | /sixletterword.py | UTF-8 | 527 | 3.265625 | 3 | [] | no_license | #
# Numan Khan 9/10/15
import pickle
words = open('words.txt').read().split()
def isNeigh(word1, word2):
num1 = 0
for x in range(0,6):
if(word1[x] == word2[x]):
num1 += 1
if(num1 == 5):
return True
else:
return False
dict = {}
list = []
for x in range(len(words)):
l... | true |
a45caf313016152fbc5148ee1d6ce8c6dfec749d | Python | coder-pig/Book | /Chapter 9/9_3.py | UTF-8 | 164 | 2.8125 | 3 | [] | no_license | """
成员函数代码示例
"""
class B:
def fun_b(self):
print("Call fun_b()")
if __name__ == '__main__':
b = B()
b.fun_b()
B.fun_b(b)
| true |
d8e55b39f348f39a36b0537caece67394f41cc00 | Python | bardayilmaz/270201019 | /lab11/exercise3.py | UTF-8 | 1,367 | 3.6875 | 4 | [] | no_license | class DNA:
def __init__(self, nucleotides):
self.nucleotides = nucleotides
def count_nucleotides(self):
nucleotide_dict = dict()
nucleotide_dict.update({"A":self.nucleotides.count("A")})
nucleotide_dict.update({"C":self.nucleotides.count("C")})
nucleotide_dict.update({"G":self.nucleotides.count("G")})
n... | true |
d59d0e8e6c513357b77e3924a405376ffdf61e2b | Python | Aamsi/grandpy-bot | /tests/test_parsing.py | UTF-8 | 680 | 2.9375 | 3 | [] | no_license | import unittest
from app.parsing import ParsingMessage
class ParsingTest(unittest.TestCase):
def test_parse_address(self):
"""
Test if we correctly parsed the message with 'adresse' in message
"""
msg = "Je veux l'adresse d'OpenClassrooms"
test_parse = ParsingMessage(... | true |
33841ff4a66209c8173df7e55c462898a57e97f8 | Python | chao-shi/lclc | /467_uniq_substr_wrapped_m/main.py | UTF-8 | 751 | 3.078125 | 3 | [] | no_license | class Solution(object):
def findSubstringInWraproundString(self, p):
"""
:type p: str
:rtype: int
"""
i = 0
cnt = 0
max_seq_start = collections.defaultdict(int)
while i < len(p):
ii = i + 1
while ii < len(p) and ord(p[ii]) - ord... | true |
065caa675ad681c1458ef47b5b3701040fd5d7d3 | Python | KrystofZindulka/bml | /zdrojaky/l1-prior-mince.py | UTF-8 | 806 | 3.09375 | 3 | [] | no_license | import numpy as np
from scipy.stats import beta
import matplotlib.pylab as plt
x = np.linspace(0, 1)
unif = beta.pdf(x, 1, 1)
cent = beta.pdf(x, 2.3, 2.3)
cent2 = beta.pdf(x, 12, 12)
skewed = beta.pdf(x, 3, 1)
plt.figure(figsize=(13, 4))
plt.subplot(1, 5, 1)
plt.plot(x, unif)
plt.ylim((0, 4))
plt.title('(A)')
plt.yla... | true |
81fc07b5c43f510d62652b9812829602fd202a31 | Python | iamrajshah/python_assignments | /madam_assignments/volume_of_sphere.py | UTF-8 | 138 | 3.578125 | 4 | [] | no_license | def volumeOfSphere(radius):
return 4/3 * 3.14 * radius * radius * radius
print(volumeOfSphere(int(input('Enter radius of sphere:')))) | true |
d0e8c440e108f7b7a7dc0bbdeab760c07180b335 | Python | lizheng-1/-ML | /DecisionTree.py | UTF-8 | 2,466 | 3.484375 | 3 | [] | no_license | import numpy as np
from sklearn import tree
import matplotlib.pyplot as plt
def iris_type(s):
it = {b'Iris-setosa': 0, b'Iris-versicolor': 1, b'Iris-virginica': 2}
return it[s]
# 花萼长度、花萼宽度,花瓣长度,花瓣宽度
iris_feature = 'sepal length', 'sepal width', 'petal length', 'petalwidth'
path = u'iris.da... | true |
7d6f250180f6678606b9f1d46752736c7ca1a0ac | Python | MianMUAmer/FinTactic | /Server/api/flaskblog/ARIMA.py | UTF-8 | 807 | 2.921875 | 3 | [] | no_license | import numpy as np
import pandas as pd
# import matplotlib.pyplot as plt
from statsmodels.tsa.stattools import adfuller
closePrices = [12,34,56,78,90,133,100,86,34,56,90,90,12,56,78,89,90]
dates = ["12-04-2012","19-09-2012","18-08-2012","17-07-2012","23-08-2012","26-03-2012","30-11-2012","21-12-2012","18-04-2012","16-... | true |
54e94dd2b3ab81d0731d39fed7d02d2758d86fd6 | Python | dkuldeep11/Python-Tutorial | /Data-Structures/graphs/graph_set.py | UTF-8 | 3,522 | 3.375 | 3 | [] | no_license | class Graph:
"""This is a graph class using dictionary
"""
def __init__(self):
self.vertices = {}
def addVertex(self, item):
self.vertices[item] = {}
def removeVertex(self, item):
if item in self.vertices:
#remove vertex from vertices
del self.vertices[item]
#remove the relevant edges
for u ... | true |
60e053f5d811a8c8ac1575ab30530aad4b96361a | Python | JefferyPaul/PMShower | /PMDataManager/PMData.py | UTF-8 | 11,141 | 3.09375 | 3 | [] | no_license | from datetime import datetime
import pandas as pd
import numpy as np
'''
PMData
:pnl
pd.DataFrame(columns=['Pnl', 'Commission', 'Slippage', 'Capital', 'Returns']), index=[datetime()]
包含 多个序列信息
:returns
pd.DataFrame(columns=['Returns']), index=[datetime()]
cal_std()
对returns进行标准化 (vol=12%),
需... | true |
84a0d0a3eda19f7f6f997bbdfba0cddfd7a5e1b9 | Python | esalagea/AoC-2019 | /d7_amp.py | UTF-8 | 3,740 | 2.921875 | 3 | [] | no_license | from itertools import permutations
def decode_instruction(code):
digits = [int(d) for d in str(code)]
while len(digits) < 5:
digits = [0] + digits
code = digits[3] * 10 + digits[4]
l = 4
if code == 3 or code == 4:
l = 2
if code == 5 or code == 6:
l = 3
if code ... | true |
472a8d75e076f61bba438ddaf4a7a19a83bfcc43 | Python | romulovieira777/Programacao_em_Python_Essencial | /Seção 06 - Estruturas de Repetição em Python/Exercícios da Seção/Exercício_42.py | UTF-8 | 592 | 4.6875 | 5 | [] | no_license | """
42) Faça um programa que leia um conjunto não determinado de valores,
um de cada vez, e escreva para cada um dos valores lidos, o quadrado
o cubo e a raiz quadrada. Finalize a entrada de dados com um valor negativo ou zero.
"""
while True:
number = int(input("Enter the value: "))
print()
if number > 0... | true |
feceece211dcec4cc7c678c01ccd00eb3a42e0e0 | Python | richardsavala2/pizza_please.py | /pizzapi/console.py | UTF-8 | 4,533 | 2.96875 | 3 | [] | no_license | from pizza_please import Customer, Order, PaymentObject
from os import walk
from pathlib import Path
class ConsoleInput:
@staticmethod
def get_new_customer() -> Customer:
print('-- PERSONAL INFORMATION --')
print('To start an order you must provide the following details.\n')
print('-- ... | true |
e2d657d5a676ee31fdaff71fb808f818dd945e3c | Python | khr777/nadoPython | /theater_module.py | UTF-8 | 1,075 | 3.765625 | 4 | [] | no_license | # 모듈 (module) : 필요한 것들 끼리 부품처럼 잘 만들어진 파일이라고 보면 된다.
# 자동차 타이어 마모, 펑크 -> 타이어만 교체
# 자동차 범퍼 고장 -> 범퍼만 교체
# 코드를 부품 교체하듯 부분만 교체하면 유지보수도 쉽고 코드의 재사용성이 수월해진다.
# 파이썬에서는 함수 정의, 클래스 들의 파이썬 정의를 담고 있는 파일을 모듈이라고 한다.
# 확장자가 .py 이다.
# 영화를 볼 수 있는 극장이 있는데, 희한하게 현금만 받는다.
# 잔돈을 바꿔주지도 않는다.
# 현재 theater_module.py 파일 자체가 모듈이다.
# 일반 가격
d... | true |
2f3d3dc0cefb1d471c5468af966f87bb36316a01 | Python | flurischt/bb-hookreceiver | /hookreceiver.py | UTF-8 | 1,019 | 2.5625 | 3 | [] | no_license | """
a small webapp to receive bitbucket POST hooks.
checkout https://confluence.atlassian.com/display/BITBUCKET/POST+hook+management
see test_hookreceiver.py for an example json request
you'll need to export HOOKRECEIVER_CONFIG_FILE=path/to/config.cfg before running this
"""
import json, os
from flask import Flask, ... | true |
2881fd191d8238bec1e56fb9e83ca2c5ef89963e | Python | meetchandan/cadence-python | /cadence/tests/test_func_signal.py | UTF-8 | 2,046 | 2.671875 | 3 | [
"MIT"
] | permissive | from random import randint
from time import sleep
import pytest
from cadence.workerfactory import WorkerFactory
from cadence.workflow import workflow_method, signal_method, Workflow, WorkflowClient
TASK_LIST = "TestSignal"
DOMAIN = "sample"
class TestSignalWorkflow:
@workflow_method(task_list=TASK_LIST)
as... | true |
db800b47f6b74b0f9df6da32b9afe108f021dd0b | Python | FermiParadox/ipy_student_exercises | /attributions.py | UTF-8 | 4,130 | 3.234375 | 3 | [
"MIT"
] | permissive | """Used for attributing all third party images.
An image could have several derivatives.
In that case all its derivatives have the same attribution.
"""
ACCEPTABLE_LICENSES = {'cc0', 'public domain', 'cc by'}
IMAGES_CITED = set() # File names
FIRST_IMAGE_TO_CITATION_MAP = {}
class ImageCitation(object):
"""
... | true |
80b6bca52b866c4478c6e055b4969e604e7852b7 | Python | Fedorov59/Python_Fedorov_415 | /Лабораторная работа №5/num4.py | UTF-8 | 817 | 3.546875 | 4 | [] | no_license | '''
lab4.2 - 9.jpg (Вариант 23)
'''
import os
import math
from random import randint
def cls():
os.system(['clear','cls'][os.name == 'nt'])
cls()
matrix = [[randint(0,9) for j in range(5)] for i in range(4)]
for i in range(len(matrix)):
for j in range(len(matrix[i])):
print(matrix[i][j], end ... | true |
0460626d2cecedac6e6cc22fe5964ff28232c544 | Python | bluemooncode/algorithm | /algorithm/algousingpython/dfs.py | UTF-8 | 339 | 3.03125 | 3 | [] | no_license | import numpy as np
ar=np.zeros((4,4),dtype=int)
flg=np.zeros((4),dtype=int)
ar[0,3]=ar[3,0]=ar[2,3]=ar[3,2]=ar[1,3]=ar[3,1]=ar[1,2]=ar[2,1]=1
print ar
def dfs(i,n):
for j in range(n):
if(ar[i,j]!=0):
dfs2(j,n)
def dfs2(i,n):
for m in range(n):
if(flg[m]!=1 and ar[i,m]==1):
print m
flg[m]=1
dfs2(... | true |
d81814480056f0689a4d28466f2e85499f629360 | Python | Mihaela-beep/MihaelaCal-python_course | /shapes/paralelogram.py | UTF-8 | 70 | 3.171875 | 3 | [] | no_license |
def perimeter(a, b):
return 2*(a + b)
def area(b, h):
return b*h | true |
0cef2b13a7f3034eecc641ac7b450611d6fbba7a | Python | crslopes/Mestrado-FEI | /Bianchi/PEL_208_Topicos_Especiais_em_Aprendizagem/kmeans/kmeans.py | UTF-8 | 22,762 | 3.46875 | 3 | [] | no_license | # !/usr/bin/env python
# Importar bibliotecas
from copy import deepcopy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
## Rotina para multiplicação de 2 matrizes, com o número de colunas da matriz A igual ao número de linhas da matriz B
## Recebe 2 Matrizes (nXm) e (mX?) e retorn... | true |
efdf35f319fa1790d507e0b0a8ee81fd99269c52 | Python | gtmkr1234/learn-python39 | /hacherrank_python39/similar_char.py | UTF-8 | 128 | 2.859375 | 3 | [] | no_license | N = int(input())
st = input()
for i in range(int(input())):
node = int(input())
print(st.count(st[node-1], 0, node-1))
| true |
2b0c2fd283e2386ae310313ada6e7c73da146eff | Python | ankurt/Mixology-App | /Mixology.py | UTF-8 | 29,909 | 2.65625 | 3 | [] | no_license |
from Tkinter import *
def run():
# create the root and the canvas
root = Tk()
canvas = Canvas(root, width=500, height=500)
canvas.pack()
# Set up canvas data and call init
class Struct: pass
canvas.data = Struct()
canvas.data.width = 500
canvas.data.height = 500
init(canvas)
... | true |
516bbf74f9c32fbeb0c4daee8ca411bdedc46c88 | Python | MichelAtieno/One-Minute-Pitch | /tests/test_comment.py | UTF-8 | 1,048 | 2.640625 | 3 | [
"MIT"
] | permissive | import unittest
from app.models import Pitch, User, Comment
from flask_login import current_user
from app import db
class TestPitch(unittest.TestCase):
def setUp(self):
self.user_michel = User(username='michel',password='password',email='abc@defg.com')
self.new_pitch = Pitch(pitch_description = "T... | true |
54044c658429a02ec00cd29a2c444accd20246c9 | Python | nayaksneha/python.ws | /app.py | UTF-8 | 436 | 3.140625 | 3 | [] | no_license | from inmmry import Inmmry
while True:
print("*"*75)
print("1.add 2.view 3.update 4.delete 5.search 6.exit")
print("*"*75)
ch = int(input("enter choice"))
if ch == 1:
Inmmry.addContact()
elif ch == 2:
Inmmry.viewContact()
elif ch == 3:
Inmmry.updateContact()
eli... | true |
961c43da1344c8e5c2fcabc7aa9f6a753a3cc286 | Python | c2727c/cil_road_segmentation | /train.py | UTF-8 | 6,013 | 2.796875 | 3 | [] | no_license | import torch
from torch import nn
from torch.utils.tensorboard import SummaryWriter
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
import torch.nn.functional as F
from utils import show_val_samples
def make_one_hot(input, num_classes):
"""Convert class index tensor to one hot encoding tensor.
... | true |
8cc21e5444e64ad0cf2fb30ed32ed731e1fcae8f | Python | Sharifi-Amin/PTS | /submit.py | UTF-8 | 5,867 | 2.546875 | 3 | [] | no_license | import os
import sys
import selenium
from selenium import webdriver
from datetime import datetime
from persiantools.jdatetime import JalaliDate, JalaliDateTime
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.chrome.options import Option... | true |
db27786a1676bfa063b7622d7c08d3b3d1071c49 | Python | IanEisenberg/Prob_Context_Task | /Exp_Design/flowstim.py | UTF-8 | 8,311 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 3 16:47:07 2017
@author: ian
"""
"""
ElementArray demo.
This demo requires a graphics card that supports OpenGL2 extensions.
It shows how to manipulate an arbitrary set of elements using np arrays
and avoiding for loops in your code for optimised ... | true |
c4974eaedfac53c4372624c437cb87bef1f49e6f | Python | JackInTaiwan/hadoop_hw | /hw6/timestamp.py | UTF-8 | 545 | 3.296875 | 3 | [] | no_license | import time
class Timestamp:
def __init__(self):
self.__table = dict()
def stamp(self, name):
self.__table.setdefault(name, [])
self.__table[name].append(time.time())
if len(self.__table[name]) > 2:
raise Warning('There is one stamp name `{}` with un... | true |
01cb5d8f707ce9c0bdc3f02928d8681dd5ec1ef9 | Python | prabinlamichhane70/python-assignment | /q46.py | UTF-8 | 115 | 3.25 | 3 | [] | no_license | # Write a Python program to find the length of a tuple
myTuple = tuple("python")
print(myTuple)
print(len(myTuple)) | true |
3407df916ecd174022cc6debe0a5dcc70a66a485 | Python | chensuim/text_classification | /lib/data/mysql/mysql.py | UTF-8 | 4,485 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import logging
import time
import MySQLdb
from MySQLdb import cursors
from DBUtils.PooledDB import PooledDB
from lib.utils.singleton import *
reload(sys)
sys.setdefaultencoding('utf-8')
logger = logging.getLogger('data_access.mysql')
def execute_with_log(self, sql, data=()):
"... | true |
c62e2851ae83e374ce854d202e9a692f744f04a8 | Python | SarthakVishnoi01/ML_Assignments | /Assignments/Assignment 1/c.py | UTF-8 | 1,260 | 2.765625 | 3 | [] | no_license | import csv
import numpy as np
import pandas as pd
import sys
from sklearn import linear_model
#f= open("outa.txt","w+")
file = r'msd_train.csv'
train = pd.read_csv(file,header=None)
file2 = r'msd_test.csv'
test = pd.read_csv(file2,header=None)
#print(df)
#Getting just the values
train = train.values
... | true |
512500979ebf8896ce1ffcb2bc5eb5bdc481cb92 | Python | DominiqueDevinci/UnrealMinesweeper | /UnrealMinesweeper/Main/ProbProcessor.py | UTF-8 | 3,512 | 2.78125 | 3 | [] | no_license | from Util import choose
class ProbProcessor:
def __init__(self, boardController):
self.board=boardController
def getSurroundingUnknown(self, id):
for i in self.board.getSurroundingIndexes(id):
if(self.board.itemsState[i]==-1):
yield i #return square id ... | true |
628ed4be62a2ae30fd9f07575ebfb06cbf36315a | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2536/60624/316014.py | UTF-8 | 883 | 3.03125 | 3 | [] | no_license | import collections
def func19():
in_str = input().strip()[1:-1]
tickets = []
while True:
a = in_str.find("[")
if a == -1:
break
end_ = in_str.find("]")
temp = in_str[a+1:end_]
in_str = in_str[end_+1:]
i = temp.find("\"")
temp = temp[i+1:]
... | true |
0366fb5c61d9fff881fb3cbb6560b004f2084023 | Python | Environmental-Informatics/06-graphing-data-with-python-huan1441 | /huan1441_Assignment_06.py | UTF-8 | 2,087 | 3 | 3 | [] | no_license | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Author: Tao Huang (huan1441)
#
# Created: Feb 21, 2020
#
# Script: ABE65100 huan1441_Assignment_06.py
#
# Purpose: Script to read in a data file and generate summary figures for that file.
#
# - - - - - - - - - - - - - - - - - -... | true |
3dd218fa673ebecd513295c2ce7a32af86a14ae9 | Python | ragib06/cbir | /featureDatabase/genrand100.py | UTF-8 | 245 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
fout = open('rand100.csv','w')
for i in range(10):
for j in range(10):
n = random.randrange(100*i,100*i+99)+1
print n
fout.write(str(n)+'.jpg,')
| true |
c8eeaddfb1e74d3f93f08877152fcd997c4497c5 | Python | arnabs542/oj | /leetcode/nextPermutation.py | UTF-8 | 6,838 | 4.34375 | 4 | [] | no_license | """
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replacement must be in-place, do not allocate extra memory.
Here are som... | true |
19533da611bb43e8e907caa368db98fb5e667557 | Python | mr-wrmsr/Python | /nvdcve-xml-parser-new.py | UTF-8 | 4,816 | 2.640625 | 3 | [
"MIT"
] | permissive | __author__ = 'jkordish'
# -*- coding: utf-8 -*-
'''Experiment taking CVE data from NVDCVE and injecting it into a Riak cluster
Can't recall what this particular version of the script did - been a long time '''
from lxml import etree
import os
import riak
import time
def main():
start_time = time.time()
parse_... | true |
ce43cb159e679b9aebf98c5c0734dd9916849f12 | Python | cloudmesh/pbs | /cloudmesh_eve/plugins/cm_shell_command.py.in | UTF-8 | 1,273 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
import os
from cmd3.console import Console
from cmd3.shell import command
from {package}.command_{command} import command_{command}
class cm_shell_{command}:
def activate_cm_shell_{command}(self):
self.register_command_topic('{topic}', '{command}')
@command
... | true |
308a495fa56ba9705ea8717d51b95edf30cb3dc1 | Python | mt-empty/FHIR_application | /src/view/errorWindow.py | UTF-8 | 482 | 3.03125 | 3 | [] | no_license | import tkinter as tk
from view.general_methods import center_to_win
class ErrorWindow(tk.Toplevel):
def __init__(self, master, *args, **kwargs):
super(ErrorWindow, self).__init__(master, *args, **kwargs)
self.configure(width=250, height=100)
self.resizable(False, False)
error_msg ... | true |
6a2c35190ee79778baf48a4b4f5251031a70c1f0 | Python | RobertZetterlund/intro-to-ai | /assignment4/src/naive_bayes.py | UTF-8 | 7,248 | 2.765625 | 3 | [] | no_license | # Author: {Tobias Lindroth & Robert Zetterlund}
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import BernoulliNB
from sklearn.utils import shuffle
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
import numpy as np
import os
import re
from sklearn.metrics import p... | true |
da191f7b8526c6bb18090ca369149309f9f39575 | Python | inaeee/OCR_select_string_textfile | /select_string_textfile.py | UTF-8 | 869 | 2.703125 | 3 | [] | no_license | try:
from PIL import Image
except ImportError:
import Image
import pytesseract
file=open('C:\\Users\\inaee\\Desktop\\2020-1MAKERS\\OCR\\square_real\\real_scanned\\text\\real_text_45.txt', 'w', -1, "utf-8")
#UnicodeEncodeError: 'cp949' codec can't encode character '\xa9' in position 106: illegal multibyte sequ... | true |
919c345b65a82d0868c6138d636205ed7bd56b70 | Python | shirahanesuoh-mayuri/bot-one | /roboco/awesome/plugins/pic_search/__init__.py | UTF-8 | 3,049 | 2.59375 | 3 | [] | no_license | from nonebot import on_command,CommandSession
from nonebot import get_bot
import urllib.request
from bs4 import BeautifulSoup
import requests
import re
from time import sleep
from selenium import webdriver
import os
bot = get_bot()
@on_command("pic_search",only_to_me=False,aliases=("图片搜索"))
async def pic_s... | true |
9339829cf1affa116df0da61e177994995e6dc27 | Python | simonlovefunny/pyts | /Conditionals.py | UTF-8 | 644 | 4.4375 | 4 | [] | no_license | # conditional statement and expression
#if statement
def f(x):
print("A",end="")
if(x == 0):
print("B",end="")
print("C",end="")
print("D")
f(0)
f(1)
# if else statement
def f(x):
print("A",end="")
if(x ==0):
print("B",end="")
print("C",end="")
else:
pri... | true |
a07c23a3f829d55fb0a125c6e76d1a956fbde785 | Python | ammeitzler/plain_view | /api/server.py | UTF-8 | 1,134 | 2.71875 | 3 | [] | no_license | from flask import Flask
import phonenumbers
from flask import request
import json
app = Flask(__name__)
matches = ""
def extract_phone_numbers(bodyHTML):
match_array = []
t_array = []
for match in phonenumbers.PhoneNumberMatcher(bodyHTML, "US"):
print(phonenumbers.format_number(match.number, phonenumbers.Phon... | true |
67cfc2c9fb1b10cf360b4796005cd8d6ade91e17 | Python | gawalivaibhav/Vg-python | /03-branching/01-logical-oprator-and-conditiinal-statement.py | UTF-8 | 492 | 3.828125 | 4 | [] | no_license | print('''\
# Following are Conditional oprators:
< "less than "
> "greater than"
<= "less than equato"
>= "greater than equal to"
!= "not equal to"
== " equal to"
''')
d = 5
e = 1
f = False
g = 'python'
h = 'some'
z = not((not(e <= d ) and (g >= h)) or f ) and 1
print(5 > 6... | true |
48d851b29acf170391d8a8f58997887cf73abf97 | Python | awesaman/OmniPresent | /api/summarize.py | UTF-8 | 1,729 | 2.953125 | 3 | [] | no_license | import nltk
import spacy
nlp = spacy.load('en_core_web_sm')
def SplitSentence(sent):
doc = nlp(sent)
# c = 0
# sub_toks = [tok for tok in doc if (tok.dep_ == "nsubj")]
result = ""
for word in doc:
if word.dep_ == "nsubj":
result = result + '.'
result = result + ' ' + wo... | true |
ead6b5ba6f1f76853b6c329533de581d37a996e7 | Python | brukeg/pcg_python | /lab20-credit-card-validation.py | UTF-8 | 1,170 | 3.921875 | 4 | [] | no_license | credit_card = '4 5 5 6 7 3 7 5 8 6 8 9 9 8 5 5'
def ccv(number_string):
"""
Write a function which returns whether a string containing a credit card
number is valid as a boolean.
"""
# Convert the input string into a list of ints
string_to_list = number_string.split(' ')
check_digit = stri... | true |
fa78516fb8250b6bb33010e152a31110b975047f | Python | erjan/coding_exercises | /maximum_price_to_fill_a_bag.py | UTF-8 | 3,081 | 4.4375 | 4 | [
"Apache-2.0"
] | permissive | '''
You are given a 2D integer array items where items[i] = [pricei, weighti] denotes the price and weight of the ith item, respectively.
You are also given a positive integer capacity.
Each item can be divided into two items with ratios part1 and part2, where part1 + part2 == 1.
The weight of the first item is weig... | true |
7cc662231c8d036a89725aa1af092acc288161f9 | Python | jeromexlee/MLSholding | /suppotLineCalculator.py | UTF-8 | 2,633 | 3.078125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import time
import quandl
import math
import sys
def calculateCDP(H, L, C):
return (H + L + 2.0 * C) / 4.0
def calculatePT(H, L):
return H - L
def calculateSupports(PH,PL, H, L, C):
CDP = calculateCDP(H, L, C)
PT = calculatePT(PH, PL)
AH = CDP + PT
NH = 2 * CDP - L
AL = ... | true |
34a8f0bc46ceebce3dc957d88ec8e012c35e4267 | Python | royliu3719/spades | /python_class/py04_test.py | UTF-8 | 2,233 | 2.65625 | 3 | [] | no_license | #n, o, p = 1, 2, 3456
#print(n, o, p)
#q = 'hello'+'python'
#print(q)
#a = 1
#b = 10
#c = 100
#del a
#print(a)
#print(type(a))
#print(id(a))
#b = 4.56
#print(b)
#print(type(b))
#print(id(b))
#A = 10
#print(id(A))
#A = A + 3
#print(A)
#print(id(A))
#W = ['MON', 'TUE', 'WND']
#W[2] = ['WED']
#W+= ['THU']
#print(W)
... | true |
146f07b88b5c8144b59576f08b14d1080cf4583c | Python | kmorozkin/euler-solutions | /src/problem44.py | UTF-8 | 1,055 | 3.765625 | 4 | [] | no_license | '''
Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal.
Find the pair of pentagonal numbers, Pj and Pk, for which t... | true |
3f2f080561abfe2cf8316a5a2e3d41ca7d78f66f | Python | SciLifeLab/scilifelab | /scilifelab/io/__init__.py | UTF-8 | 273 | 3.234375 | 3 | [
"MIT"
] | permissive | """IO functions"""
# http://stackoverflow.com/questions/2170900/get-first-list-index-containing-sub-string-in-python
def index_containing_substring(the_list, substring):
for i, s in enumerate(the_list):
if substring in s:
return i
return -1
| true |
4bf07debb2374bbad901b032e721ff5dcffe0024 | Python | MichalMotylinski/PathFinding | /node.py | UTF-8 | 740 | 3.859375 | 4 | [] | no_license | # Represents a single node from grid
import pygame
class Node:
def __init__(self, obstacle, position_x, position_y):
self.obstacle = obstacle
self.visited = False
self.neighbours = []
self.parent = None
# distance from starting node
self.g_cost = float('inf')
... | true |
0a72309917cca462264a37fa5b9784f6206f5bb9 | Python | erikbille/jamf-bulk-provisioning-profile-updator | /main.py | UTF-8 | 3,890 | 2.96875 | 3 | [] | no_license | import jamf_api
import dicttoxml
from progressbar import ProgressBar
pbar = ProgressBar()
class ProvisioningProfile:
def __init__(self, profile):
self.id = profile["id"]
self.name = profile["name"]
self.display_name = profile["display_name"]
self.uuid = profile["uuid"]
class Mobi... | true |
5cac7d0be2c29ce69455b63cf7c2f86f9a49ac74 | Python | lludu/100DaysOfCode-Python | /Day 21 - Snake Game Complete/food.py | UTF-8 | 627 | 3.84375 | 4 | [] | no_license | from turtle import Turtle
from random import randint
GOLD_APPLE = 240, 230, 155
FOOD_COLOR = GOLD_APPLE
class Food(Turtle):
def __init__(self): # Initialize
super().__init__() # get inheritance from Turtle
self.shape("turtle")
self.penup()
self.shapesize(stretch_len=0.5, stretch... | true |
47ea58a08f1096ec07a952bd6f8f684b57011f73 | Python | vampy/university | /compilers/labs/lab1/util.py | UTF-8 | 1,019 | 4.09375 | 4 | [
"MIT"
] | permissive |
def convert_to_type(value, value_type, default_value=None):
"""
Try to convert 'value' to type
:param value: The value to convert
:param value_type: The type to convert to eg: int, float, bool
:param default_value: The default returned value if the conversion fails
:return:
"""
try:
... | true |
08e27ffd829500a18d5e1d6fa1c2f76bf4e03905 | Python | shane424/Grass-cutting | /menu selection.py | UTF-8 | 1,479 | 3.875 | 4 | [] | no_license | def constants(selection):
ASCII_LOWERCASE = ("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z")
ASCII_UPPERCASE = ("Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M")
DECIMAL_DIGITS = ("0,1,2,3,4,5,6,7,8,9")
if selection == 1:
x = ASCII_LOWERCASE
elif selection == 2:
x = ASCII... | true |
eb0c70293ace0f80495928ce41c4527f489d893f | Python | bsteel10/sudoku-generator | /sudoku.py | UTF-8 | 12,540 | 3.828125 | 4 | [] | no_license | #!/usr/bin/python
import array
import random
# The grid is a 9 by 9 char array.
# 0 means there is no number.
# 1 to 9 are the numbers.
# Indexing starts on the upper left.
grid = array.array('b',
[1,2,3,7,8,9,4,5,6,
4,5,6,1,2,3,7,8,9,
7,8,9,4,5,6,1,2,3,
9,1,2,6,7,8,3,4,5,
3,4,5,9,1,2,6,7,8,
6,7,8,3,4,5,9,... | true |
9453e534dcebe697a4126002372ebdd51a89fd43 | Python | Dearyyyyy/TCG | /data/3912/AC_py/501604.py | UTF-8 | 178 | 3.078125 | 3 | [] | no_license | # coding=utf-8
N=int(input())
i=2
a=0
for i in range(2,N):
if N%i==0:
print("not prime")
break
else:
a=a+1
if a!=0:
print("prime") | true |
50f42a6ff90fb3df4b50517d58276d5d94dab4e7 | Python | maymayw/pythonbasics | /decorator.py | UTF-8 | 217 | 3.375 | 3 | [] | no_license | def decorator(func):
def func_wrapper(*args, **kwargs):
for _ in range(args[0]):
func(args[1])
return func_wrapper
@decorator
def repeat_func(greet):
print(greet)
repeat_func(5, "hi") | true |
2d3afc2f5524e3fc344cde4ad832c5eb62fed444 | Python | ahmedm3/ECE351 | /HW3/generate_data.py | UTF-8 | 5,532 | 3.296875 | 3 | [] | no_license | """
Ahmed Abdulkareem
05/08/2016
ECE 351 HW3
This script is used to generate test patterns
"""
import argparse
import sys
def rotate(args):
if args.left:
rotate_generate("left")
elif args.right:
rotate_generate("right")
else:
rotate_generate("left")
rotate_generate("right"... | true |
1665cfba884b4211d4a0af13339358aeed886368 | Python | daconrilcy/testbezier | /test.py | UTF-8 | 2,669 | 2.84375 | 3 | [] | no_license | from kivy.app import App
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
from class_extend.quadri_bezier import Quadribezier
from kivy.graphics import Color, Line
from polybezier.casteljau2 import Casteljau2
import numpy as np
class Game(FloatLayout):
d... | true |
0841d821fab920435f47a6fa5dea662e5bae116a | Python | Ann-pixel/learn-python | /debug.py | UTF-8 | 264 | 2.734375 | 3 | [] | no_license | # linting
# ide/editors
# reading errors
# PDB - Python Debugger. a built-in module.
import pdb
def add(num1, num2):
pdb.set_trace() # pdb in the terminal. hit help to get a list of possible commands
t = 4 + 5
return num1 + num2
add(4, "asdhf")
| true |
a3f48f9d3c6e7c32d3aacd6398c2439c6026053c | Python | bghanchi/Hackerrank-Practice-Problem | /SheandSq.py | UTF-8 | 1,234 | 3.171875 | 3 | [] | no_license | import math
t=int(input())
for j1 in range(t):
count=0
a,b=map(int,input().split())
i=a
while i>=a and i<=b:
j=2
while j<=int(i/2):
if j*j==i:
count=count+1
j=j+1
i=i+1
print(count)
'''
for j1 in range... | true |
45e9438a1acf59a6c2e7be6af15686b1a6257ab4 | Python | cookjw/music | /DART_model/rhythm_trees.py | UTF-8 | 307 | 2.890625 | 3 | [] | no_license |
class AbstractRhythmTree:
def __init__(self, head):
self.head = head
class Node:
def __init__(self, value=None, direction=None, children=None):
self.value = value
self.direction = direction
self.children = children
| true |
28e8f8af8ba3861dceb6692f61a67f88cc8b0764 | Python | jhshanyu2008/Hello-World | /AzurLane_structure.py | UTF-8 | 1,878 | 2.890625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
iteration = 10000
target_dir = {'A': 2.0,
'B': 2.0,
'C': 2.5,
'D': 2.5,
'E': 5,
'F': 5
}
term_set = [0, 500, 50]
Finished = False
target_depart = {}
target_get = {}
analy_dir = {}
term... | true |
82c50662cc70eb4a971fd34ece2344d2b14fe217 | Python | rmotr-group-projects/wdc-django-practice-1 | /django_practice_1/django_practice_1/views.py | UTF-8 | 2,408 | 3.1875 | 3 | [] | no_license | from datetime import datetime, timedelta
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseBadRequest
# Use /hello-world URL
def hello_world(request):
"""Return a 'Hello World' string using HttpResponse"""
pass
# Use /date URL
def current_date(request):
"""
R... | true |
2e212944559db49c9971f4a0dd88a0aea2bd4eaa | Python | svetlanama/snowball | /ate-004-ate.py | UTF-8 | 2,377 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
#encoding: UTF-8
import time
import libate4 as ate
import argparse
import re
import csv
import os
import psutil
# reads plain text file
# and generate list of terms
parser = argparse.ArgumentParser()
parser.add_argument("--in_dataset", help="input TXT file")
parser.add_argument("--out_terms",... | true |
2660291807d9d2094fc5b2ff8916e41b028ed095 | Python | ookun1415/product | /product.py | UTF-8 | 1,642 | 4.1875 | 4 | [] | no_license | import os #os(operating system):作業系統模組
def read_file(filename):
product = []
with open(filename, 'r', encoding='utf-8') as f:
for line in f:
if '商品,價格' in line:
continue #continue:直接跳到下一次迴圈
name, price = line.strip().split(',')#split:切割 ()裡面:以什麼當切割的標準
product.append([name, price])#strip:刪除換行
return ... | true |
a40512d92dd3896f78ad4b7cc00b886d7982b0cc | Python | zhoupeng315/python-crash-course | /courses/ch5-if-statement/banned_users.py | UTF-8 | 277 | 2.984375 | 3 | [] | no_license | banned_users = ['andrew', 'carolina', 'david']
user = 'marie'
if user not in banned_users:
print(f"{user.title()}, you can post a response if you wish")
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
else:
price = 40
print(f"your admission cost is ${price}") | true |
d631961439cdf66bb7eeee6af7de67639d2676c2 | Python | gkarwchan/algorithms | /hackerrank.com/python/python_string_formatting.py | UTF-8 | 895 | 3.96875 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/python-string-formatting/problem
'''
simple form
'''
def print_formatted(number):
max_width = len("{0:b}".format(number))
for i in range(1, number + 1):
print('{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}'.format(i, width=max_width))
'''
to illustrate mo... | true |
38c48b2781f3275af7fac32878388b02afa0a23d | Python | BinceAlocious/python | /corepython/2basicCalc.py | UTF-8 | 803 | 4.125 | 4 | [] | no_license | class Calc:
def __init__(self,a,b):
self.a=a
self.b=b
def add(self):
return(self.a+self.b)
def sub(self):
return(self.a-self.b)
def mul(self):
return(self.a*self.b)
def div(self):
if(self.b!=0):
return(self.a/self.b)
else:
... | true |
ff67b080d1af747b3e3cd3643b14977122a51b7a | Python | rorygwozdz/coding | /finance/mp4f/one_python/random/any_given_week.py | UTF-8 | 2,181 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader as pdr
from datetime import datetime
start = datetime(2015, 2, 9)
end = datetime(2018, 5, 24)
def grab_data(ticker, start, end):
derka = pdr.DataReader(ticker, 'iex', start, end)
return der... | true |
0de89191229184331ecd1e215c0092d9a68eb393 | Python | mchitale/OCR-for-Overlapping-Text | /letters_half.py | UTF-8 | 4,734 | 3.5 | 4 | [] | no_license | '''OCR of a dataset of handwritten characters, cut into half
Author: Maitreyi Chitale
Date: 29-06-2018
Observations: Using SGD, LR = 0.05, #Epochs = 22,
Test Accuracy = 74.05%, Shuffled Data.
'''
#Import required modules:
import sys
import pandas as pd
import numpy as np
import tensorflow as tf
import keras
from ke... | true |
81fb8a15d43ef2af941b71c57fed9bdd759931d6 | Python | juanpedrovel/bomboclap | /algorithms_and_data_structures/math/Pascal Triangle.py | UTF-8 | 647 | 3.09375 | 3 | [] | no_license | class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows <= 0:
return []
pascal = [[1]]
previous = pascal[0]
for i in range(1, numRows):
pascal.append(0)
result = []
... | true |
05e5e89009b5145d6430ff7f4845c20445eb3907 | Python | NujjA/python_work | /how to think/triforce.py | UTF-8 | 1,154 | 3.46875 | 3 | [] | no_license | import turtle
def triforce(t, size, order, colorchangedepth=-1, colors = ["magenta", "blue", "green"], color = "magenta"):
changecolors = False
if (colorchangedepth == 0):
changecolors = True
if order == 0:
for i in range(0,3):
t.color(color)
t.forward(size)
... | true |
5881aeb0afa26fe5ac2b299f17954dc42cc6192a | Python | hifromkatie/DoorBellAlert | /Code/pi/mqtt-screen.py | UTF-8 | 2,266 | 2.53125 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import pygame
import pygame.freetype
def on_message(client, userdata, msg):
print(msg.payload)
if (str(msg.payload) == "b'0'"):
print("Please ring door bell ----->")
screen.fill((0,0,0))
screen.blit(message0, (400 - message0.get_width() // 2, 240 - messag... | true |
eb24b86cbc89edd6d8586b1b11107cb1f9ac7f90 | Python | DarrenLin1112/Darren | /motorcycles2.py | UTF-8 | 762 | 3.703125 | 4 | [] | no_license | message = ['honda','yamaha','suzuki']
print(message)
message[2]="darren"
print(message)
message = ['honda','yamaha','suzuki']
message.append('ducati')
print(message)
message = ['honda','yamaha','suzuki']
del message[0]
print(message)
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
p... | true |
e2ee630f97d87a8c5c5e0c21df9e8fd4bc981175 | Python | chyjuls/Computing-in-Python-IV-Objects-Algorithms-GTx-CS1301xIV-Exercises | /Final_Problem_Set/final_problem_09.py | UTF-8 | 2,862 | 3.96875 | 4 | [] | no_license | # For our last data analysis-inspired problem,
# let's go back to one of my favorite examples: Pokemon.
# Pokemon is a popular video game franchise by Nintendo which features over 800 monsters,
# called Pokemon, each with unique names, types, and statistics.
# The dataset you'll have for this problem contains every... | true |
624db40ec9e46b51da248b5e1e17899b6c129e69 | Python | Amiineh/CIFAR10-Object-Recognition | /main.py | UTF-8 | 6,151 | 3.03125 | 3 | [] | no_license | # python 2.7.10
import tensorflow as tf
import numpy as np
from PIL import Image
def unpicle(file):
import cPickle
with open(file, 'rb') as fo:
dict = cPickle.load(fo)
return dict
''' 4.1.
shows a random image from cifar10 to make sure we're reading the data correctly '''
def show_pic(rgbAr... | true |
0226393a44b7e6cc1170e83f9c49312920075cf4 | Python | italia/daf-mappa-quartiere | /src/models/core.py | UTF-8 | 30,673 | 2.671875 | 3 | [] | no_license | """Define the core classes that process the data
to get geolocalised KPI and attendance estimates"""
from time import time
import functools
import warnings
import numpy as np
import pandas as pd
from sklearn import gaussian_process
from matplotlib import pyplot as plt
import seaborn as sns
import geopy
import geopy.d... | true |
3772b8bd8b4eb2c3ad7a5f5e4de26a63ca2d0a25 | Python | kgopal1982/Analytics | /Python/ReplaceCharacter.py | UTF-8 | 294 | 4.21875 | 4 | [] | no_license | #Python Program to Replace all Occurrences of ‘a’ with $ in a String
n = int(input("enter no of elements in the list"))
li = []
for i in range(n):
li.append(str(input("enter word:=")))
print("list is:", li)
mod_li = [w.replace('a', '$') for w in li]
print("modified list is: ", mod_li)
| true |
bd5c62525ee05363531788e0bbf80a7c723d47ec | Python | technolingo/AlgoStructuresPy | /midpoint/test_.py | UTF-8 | 1,444 | 3.03125 | 3 | [
"MIT"
] | permissive | from .linkedlist import LinkedList
from .index import midpoint
class TestMidpoint():
def setup_method(self):
self.llst = LinkedList()
def test_empty(self):
assert midpoint(self.llst) is None
def test_odd(self):
self.llst.insert_last('a')
assert len(self.llst) == 1
... | true |
aa1f5af2ed7d92338314ee09a00857bcc2874203 | Python | mertterzihan/pymc | /pymc/examples/lda/CollapsedDistributedLDA.py | UTF-8 | 10,954 | 2.6875 | 3 | [
"AFL-3.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | total_partitions = 72
def data_process(data):
# Preprocess the data
docs = list()
# Given the data as a list of strings (lines), structure it in such a way that it can be used by the below model
for line in data[1]:
document_data = line.split(',')
words = document_data[1].split(' ')
... | true |
3078d00b04d16bc3bb681482dcd2270244a30007 | Python | JoshPritz/Fourier-Image-Analysis | /preprocess.py | UTF-8 | 3,249 | 3 | 3 | [] | no_license | import os
import sys
import cv2
import argparse
import numpy as np
import matplotlib.pyplot as plt
path = '/Users/joshp/OneDrive/Documents/Senior Year, 2019-2020/Physics 357/FourierOptics/'
def get_image(image, filepath=path):
image_path = os.path.join(filepath, 'images', image)
result = cv2.cv... | true |