blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
313e930d7893d93d0315d453173ab7f8abfc18f7 | Python | DomikIAm/codewars_challenges | /Python/5 kyu/Factorial Decomposition/factorialdecomposition_03.py | UTF-8 | 611 | 3.078125 | 3 | [
"MIT"
] | permissive | def decomp(n):
def is_prime(num):
if num < 2:
return False
for i in range(1, num):
if i == 1:
continue
if num % i == 0:
return False
return True
def sub(num, comps):
for i in comps.keys():
while num ... | true |
a9974b6a15d199d9cfb1083b3efdcf67eea6024e | Python | jlyons6100/Wallbreakers | /Week_4/reverse_nodes_in_k_group.py | UTF-8 | 1,530 | 3.359375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def count_remaining(self, cur):
accum = 0
while(cur != None):
cur = cur.next
accum += 1
return accum
def reverseK... | true |
04dd891084a173ce9744524a8376dfae2e27b92b | Python | kys061/InflearnParallelComputing | /step12_sharing_state_2.py | UTF-8 | 1,298 | 3.109375 | 3 | [] | no_license | from multiprocessing import Process, current_process, Value, Array
import os
# 프로세스 메모리 공유 예제(공유o)
# 실행함수
# 강의 예제에서는 메모리 공유까지만 구현.
# 동기화까지 완료한 코드
def generate_update_number(v: int):
with v.get_lock():
for _ in range(5000):
v.value += 1
print(current_process().name, 'data', v.value)
def m... | true |
b6fab359604749abc60a0b5ac20dafb130595176 | Python | udovisdevoh/superzebre | /Date.py | UTF-8 | 1,792 | 3.265625 | 3 | [] | no_license | #-*- coding: iso-8859-1 -*-
from Tkinter import *
from datetime import timedelta
import time
import datetime
import os
class Date:
def __init__(self,root,side):
self.date = datetime.date.today()
self.frame = Frame(root)
self.buttonWeekBack = Button(self.frame, text = "<<", bd =... | true |
5b16b10e064809fa050f605fc83d011efe5e3b93 | Python | MehrinAzan/Scientific_Project | /test.py | UTF-8 | 2,952 | 3.03125 | 3 | [] | no_license | import numpy as np
import cv2
import matplotlib as plt
# Skin thickness
# automized ROI cropping
# mask lines on border
pic1 = imread('pic2_cropped.jpg');
pic1_gray = rgb2gray(pic1) #Convert to grayscale
[height, width] = size(pic1_gray) #Number of rows and columns
% loop to define height of ROI depending on hei... | true |
0d6b83a559bb6e59843b7513ab0bdc9229884c46 | Python | raulsenaferreira/hackathonRioHeatMap | /twitterCrawler/transformTwitter.py | UTF-8 | 2,709 | 2.921875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pickle
import nltk
def readLocality(locality_path = "../dataset/localidades.csv" ):
file = open(locality_path, "r")
localitys = file.readlines()
localitys = [locality.replace("\n","").strip() for locality in localitys]
return localitys
def stemmingArray(words):
stem... | true |
635b19824e4caaa6fc2d71c6ede4e14da1586cd2 | Python | Dochi3/GubSikChae | /CodeBlock.py | UTF-8 | 2,097 | 2.84375 | 3 | [] | no_license | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtWidgets import QGridLayout
from PyQt5.QtWidgets import QTextEdit, QLabel
from PyQt5.QtGui import QFontMetrics
import time
class CodeBlock(QWidget):
def __init__(self, parent=None, code=str()):
super().__init__()
... | true |
417f1134df2cd2f9c03567d5cf93776ce82c9bc9 | Python | pravsp/problem_solving | /Python/LinkedList/solution/deletenode.py | UTF-8 | 868 | 3.609375 | 4 | [] | no_license | """Delete node solution except tail."""
import __init__
from singlyLinkedList import SinglyLinkedList
from utils.ll_util import LinkedListUtil
class Solution:
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead
"""
... | true |
73e15c7513d45432fd89572680fcdb068c5a3d1a | Python | QiuBALL/user_reliability-crowdsourcing- | /Experimentation/cal.py | UTF-8 | 210 | 3.3125 | 3 | [] | no_license | # while True:
# a = float(input())
# b = float(input())
# c = float(input())
#
# print((a+b+c)/ 3)
recall = 0.867
precision = 0.746
f1 = 2 * recall * precision / (precision + recall)
print (f1) | true |
2f8a3a51311f06490ee109df1bf57160f7b81527 | Python | mmilkin/challanges | /ema_supercomputer/ema_tests.py | UTF-8 | 511 | 2.59375 | 3 | [] | no_license | from run import two_pluses
def helper_test(suffix):
with open('test_input/%s.txt' % suffix, 'r') as f:
lines = f.readlines()
n, m = lines[0].strip().split(' ')
grid = [
list(line.strip()) for line in lines[1:]
]
out = two_pluses(grid)
with open('test_inp... | true |
13538ed23a08463ea6e81362da3deebbe2f7647f | Python | xzlmark/python-basic | /数据库操作/MongoDB连接Python.py | UTF-8 | 623 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | from pymongo import MongoClient
from bson.objectid import ObjectId #用于id查询
#连接服务器
conn=MongoClient("localhost",27017)
# 连接数据库
db = conn.mydb
# 获取集合
collection = db.student
# 添加文档,插入一条
collection.insert({'name:abc,'age:30''})
# 添加文档,插入多条
collection.insert([{'name:abc,'age:30''},{'name:xzl,'age:31''}])
conn.close()... | true |
bc520af768fec66100fdc828b9b91ea2b62173a0 | Python | ozzi7/Hackerrank-Solutions | /Python/Sets/py-the-captains-room.py | UTF-8 | 325 | 2.765625 | 3 | [] | no_license | if __name__ == '__main__':
k = int(input())
l = list(input().split())
s = set()
potentialcaps = set()
for i in range(0,len(l),1):
if l[i] not in s:
s.add(l[i])
potentialcaps.add(l[i])
else:
potentialcaps.discard(l[i])
print(potentialcaps.p... | true |
20a52071efb9992be7bb9413b08fcbefa5f1a8d0 | Python | hsztan/idat-reto-7 | /models/Salon.py | UTF-8 | 1,459 | 2.984375 | 3 | [] | no_license | from config.connection import Connection
class Salon:
def __init__(self, nombre, aescolar):
self.nombre = nombre
self.aescolar = aescolar
@classmethod
def all_salon(cls, data=[]):
try:
conn = Connection('colegio')
records = list(conn.get_all('salon', {}, {
... | true |
fb62aa4b0a0f60d5869d36c8ee11bcb2430aa21b | Python | hevi9/etc-python | /gtk3/learngtk/contextmenu.py | UTF-8 | 854 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
from gi.repository import Gtk
def display_menu(widget, event):
if event.button == 3:
menu.popup(None, None, None, None, event.button, event.time)
menu.show_all()
def display_text(widget):
print("Item clicked was %s" % widget.get_child().get_text())
window = Gtk.Window()... | true |
82c118ce6382395df253c19de3ee884101d484ab | Python | mcharnay/cursoPython3 | /string.py | UTF-8 | 9,857 | 4.34375 | 4 | [] | no_license | # comentarios.
#type(variable)
#muestra el tipo de la variable
#\ para salto de línea
#\t salto tab
#si se pone una r ante de las "" o '', toma el texto completo x si hay una \c o \t dentro del texto.
#print(""" sirve para hacer salto de lineas
# sin tener que poner lo de arriba""")
###############################... | true |
6f64649007afafb791bf113e1e80c30a72ccace3 | Python | zewuchen/data-analysis | /Grafico (Barras)/Barras Normal 01.py | UTF-8 | 738 | 3.53125 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
opiniao = ("Ruim/Pessimo", "Regular", "Otima/Boa", "Sem Opinião") #Rótulos do eixo X
x_pos = np.arange(len(opiniao)) #Define o tamanho do eixo X com a quantidade dos rótulos
valores = [82, 14, 3, 1] ... | true |
2cccf320942462ac052a4777879b3d3783845bfd | Python | SyrianSpock/anima-initiative-roller | /roll.py | UTF-8 | 2,961 | 3.296875 | 3 | [] | no_license | import argparse
from collections import namedtuple
from collections.abc import Iterable
import logging
import operator
import random
import yaml
import re
Player = namedtuple('Player', ['name', 'initiative', 'fail'])
def parse_arguments():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argu... | true |
b256cf2c68e90a6347a5ff44dcaeaf821e5e23c7 | Python | brianbirir/harvest-data-validator | /src/helpers/extractor.py | UTF-8 | 2,653 | 2.9375 | 3 | [] | no_license | import os
import json
from src.helpers import logger as app_logger
FILE_TYPES_EXTENSIONS = (".jpg", ".png", ".json")
def fetch_files(folder_path: str) -> list:
""" Returns files from a folder
Parameters
----------
folder_path
path to the folder
Returns
-------
list of found... | true |
9c6e5c931b1c4737235ad48fcda1fca90e5e707a | Python | isensen/PythonBasic | /Tutorials/05_迭代.py | UTF-8 | 1,169 | 4.28125 | 4 | [] | no_license | #coding=utf-8
'''
迭代
'''
__author__ = "i3342th"
#如果给定一个list 或 tuple 我们可以通过 for 循环遍历,这种遍历我们称为迭代 (iteration)
#python 中 迭代 是通过 for ... in 来完成的
#for ... in 不只可用于 list , tuple,还可用于其他可迭代对象上,例如:dict
d = {'a': 1, 'b': 2, 'c': 3}
for key in d:
print key
#dict 存储不是按顺序来的,所以打印出来顺序是不一定的
#默认dict 用for 迭代的是 key
#如果迭代value,可... | true |
94876e55ab6892c79bac4d0793a854a0352ec704 | Python | andrezzadede/Curso_Guanabara_Python_Mundo_3 | /Mundo 3 - Exercícios/93Exercicio - Dicionario.py | UTF-8 | 912 | 4.28125 | 4 | [
"MIT"
] | permissive | # Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogdor e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionario, incluindo o total de gols feitos durante o campeonato.
jogador = d... | true |
78f18c20baae26dadfd2eadda4576df1885e2a22 | Python | Camiloasc1/AlgorithmsUNAL | /DomJudge/practica14/Monedas.py | UTF-8 | 692 | 2.765625 | 3 | [
"MIT"
] | permissive | import sys
coins = [1, 5, 10, 25, 50]
def Calc(Res, i):
if i in Res:
return Res
if i in coins:
Res[i] = 1
else:
Res[i] = 0
# for c in coins[::-1]:
# for c in coins:
for c in xrange(i / 2):
if i - c > 0:
Res[i] += Calc(Res, c)[c] * Calc(Res, i - c)[... | true |
3b533714296fb094300fe0b48f05036e7d98b981 | Python | PatrycjaPytka/Django2 | /biblioteka/models.py | UTF-8 | 1,559 | 2.59375 | 3 | [] | no_license | from django.db import models
from django.core.validators import MaxValueValidator
from .validators import validate_rok
class Autor(models.Model):
imie = models.CharField(max_length=20, blank=False)
nazwisko = models.CharField(max_length=20, blank=False)
data_urodzenia = models.DateField(null=True, blank=Tr... | true |
f98ea65feb57472ef09315ed0917dc8c8af75445 | Python | daman-cyngh/Voice-Cloning | /synthesizer/models/modules.py | UTF-8 | 15,675 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
class HighwayNet:
def __init__(self, units, name=None):
self.units = units
self.scope = "HighwayNet" if name is None else name
self.H_layer = tf.layers.Dense(units=self.units, activation=tf.nn.relu, name="H")
self.T_layer = tf.layers.Dense(units=sel... | true |
3af02bde1800a22c622f6e375c842b265f197043 | Python | Yogendrasingh-Rathore/PythonTraining | /Dataclasses.py | UTF-8 | 575 | 3.734375 | 4 | [] | no_license | from dataclasses import dataclass
# Simple DataClass
@dataclass
class Person:
name: str
age: int
p = Person('yuvi', 24)
print(p)
# Default Values DataClass
@dataclass
class Person2:
name: str = 'unknown'
age: int = 0
p = Person2('yuvi', 24)
print(p)
p2 = Person2()
print(p2)
p.occupation = 'soft en... | true |
7b1ff0d0dd6941bd67b5ca8b7970456f207f4e36 | Python | adabbott/Research_Notes | /ml_testbed/1_keras_opt/model_api/trial4_naive/test.py | UTF-8 | 1,538 | 2.78125 | 3 | [] | no_license |
#import tensorflow as tf
##vector = tf.Variable([7., 7.], 'vector')
#vector = tf.constant([[1.0], [2.0], [3.0]])
#
## Make vector norm as small as possible.
#loss = tf.reduce_sum(tf.square(vector))
#optimizer = tf.contrib.opt.ScipyOptimizerInterface(loss, options={'maxiter': 100})
#with tf.Session() as session:
# ... | true |
44b7c2679df072ca1b1a70650b4594cdb11a9c5b | Python | bancheng/Stock-market | /测试代码/theano/binbin/jiangnan_lstm/lstm.py | UTF-8 | 4,179 | 2.53125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import theano
import theano.tensor as T
class LSTM:
def __init__(self, n_input, n_hidden):
self.n_input = n_input
self.n_hidden = n_hidden
self.f = T.nnet.hard_sigmoid
# forget gate parameters.
initial_Wf = np.asarray(
... | true |
ebb13a6a02a5916395ddec62bc0b93ce9b4885a9 | Python | romeolandry/iris-Klassifikation_ML | /utils.py | UTF-8 | 178 | 2.671875 | 3 | [] | no_license | def match_predicion (prediction, match_class):
list_prediction = []
for val in prediction:
list_prediction.append(match_class.get(val))
return list_prediction | true |
284703b697976ae0d2b956e5a1165a6b4ac9c597 | Python | apottr/nexrad-process | /app.py | UTF-8 | 2,840 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import sys
from pathlib import Path
from metpy.io import Level2File
from metpy.plots import add_timestamp
IN_PREFIX="RADAR/{}"
OUT_PREFIX="OUT/{}_sweep-{}.png"
CORE=sys.argv[1]
def save_as_image(d,nexrad):
LAYER1=b"REF"
LAYER2=b"VEL"
f = Level2File(str(nexr... | true |
f2681a6ec9f2d30489100049a9f0ac9ac849e1cb | Python | eobi/State-of-the-art-CNN-code-template-for-2D-images-with-and-without-transfer-learning | /non inherited weights/app.py | UTF-8 | 3,075 | 3.140625 | 3 | [] | no_license | """
Created on Fri Jan 17 19:32:57 2020
@author: Obi Ebuka David
NOTE: This code learns from the provided dataset. Enjoy
ensure you check the difference btw fit and fit_generator
"""
# Importing the Keras libraries and packages
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers im... | true |
208e3c8abdfaed1e65de1e1557faf7a1f7ea7be7 | Python | vrii14/ppl_assignments-1 | /ass1/2.py | UTF-8 | 246 | 3.03125 | 3 | [] | no_license | import random
while 1 :
a = int(input("If you want to roll the dice press 1 if not the 0\n"))
if a == 1:
print(random.choice([1,2,3,4,5,6]))
elif a==0:
break
print("chance done")
else:
print("Invalid operation")
| true |
99b753ec074ee2f8f6ae73d9f2ff117aad748f36 | Python | adamtwig/D4D | /src/archive/testviz.py | UTF-8 | 581 | 3.5625 | 4 | [] | no_license | from numpy import corrcoef, sum, log, arange
from numpy.random import rand
from pylab import pcolor, show, colorbar, xticks, yticks
# generating some uncorrelated data
data = rand(10,100) # each row of represents a variable
# creating correlation between the variables
# variable 2 is correlated with all the other var... | true |
e54810b29dc178cb63adb3217730c5ff3a4ff63a | Python | hjhbbd/DY-Data | /下载抖音用户的所有视频/Douyin-DownloadAllVideo/ThreadPool.py | UTF-8 | 668 | 2.9375 | 3 | [] | no_license | import queue
import threading
class ThreadPool(object):
def __init__(self, max_workers):
self.queue = queue.Queue()
self.workers = [threading.Thread(target=self._worker) for _ in range(max_workers)]
def start(self):
for worker in self.workers:
worker.start()
def stop(... | true |
0bdd4c0917856392e34e425d5255d09b07e1bf8f | Python | AaronWWK/Courses-Taken | /6.00.1x/Lecture13 Plotting/123.py | UTF-8 | 222 | 2.875 | 3 | [] | no_license | import pylab as plt
plt.figure('My')
plt.plot([1,4,56,32],[1,16,78,90])
plt.figure('You')
plt.plot([1,2,3,4],[1,2,3,44])
plt.figure('My')
plt.ylabel('numbers')
plt.figure('You')
plt.clf()
# plt.title('My')
plt.show()
| true |
0d6e29b81deba149c648e14c2e22ab25ff3ebaed | Python | jletienne/jletienne.com | /test.py | UTF-8 | 3,033 | 2.765625 | 3 | [] | no_license | import requests
import sys, os
import json
import re
import datetime
import calendar
def addEvent(start_time = '10 pm', location = 'location', opponent = 'Opponent',year=3000, month=1, day=1, team='None'):
event_date = datetime.date(year, month, day)
gameday = str(event_date)
weekday = calendar.day_name[e... | true |
d13065623b7ceb40cddc4a9504fe374833f60676 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_54/273.py | UTF-8 | 541 | 2.84375 | 3 | [] | no_license | import sys
def gcd(a, b):
return a if b == 0 else gcd(b, a%b)
def read_int():
return [int(e) for e in sys.stdin.readline().split()]
C = read_int()[0]
for cases in xrange(1, C+1):
ii = read_int()
N, t = ii[0], ii[1:]
g = reduce(gcd, t)
d, diff = [x/g for x in t], []
for a in d:
... | true |
8fb025d253d46bedf270182c37c215137a1cb95f | Python | ManbokLee/tensor_libs | /SeoulCCTV/iris.py | UTF-8 | 3,466 | 3.078125 | 3 | [] | no_license | # ************************************
# 랜덤 포레스트 알고리즘의 앙상블 기법
# 사이킷런에 내장된 아이리스 데이터셋 활용
# ************************************
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
np.random.seed(0)
iris = load_iris()
df = pd.DataFrame(iris.... | true |
22072eaddf461a695ce940f3863f2560f93d42d7 | Python | jpmulligan/learn-python-the-hard-way | /ex17.py | UTF-8 | 609 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 22 12:08:30 2018
@author: 40261
"""
print("LPTHW exercises complete: ", round((17.0/48.0)*100,1),"%")
from sys import argv
from os.path import exists
script, from_file, to_file = argv
#print(f"Copying from {from_file} to {to_file}")
indata = open(from_file).read()
#... | true |
f084b8e1cdd29ea70efc5b4593a6abc22c0f5d63 | Python | eduardmak/learnp | /lesson2/homework/ocenki_z3.py | UTF-8 | 475 | 3.125 | 3 | [] | no_license |
uch_list = [{'school_class': '4a', 'scores': [3,4,4,5,2]}, {'school_class': '5a', 'scores': [1,2,4,5,2]}]
avg_per_class = [sum(i.get("scores")) / len(i.get("scores")) for i in uch_list]
avg_per_school = sum(avg_per_class) / len(uch_list)
str_avg_ps = " ".join(str(avg_per_class))
str_avg_sch = " ".join(str(avg_per_s... | true |
3b31101040dca914881c88ccdf6264456844f407 | Python | dlf412/thunderCopyright | /vddb_async/auto_deploy_tool/http_url_parser.py | UTF-8 | 969 | 3.015625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
def parse (url):
import urllib
import socket
http_conf = {};
start_idx = url.find ('http://');
if (not (start_idx == 0)):
raise Exception ("bad http format (%s)" %url);
start_idx = len ('http://');
try:
host, port = urllib.splitport (url[start_idx:])
... | true |
be442962641eddc8003d82cced788d4e72213920 | Python | joey100/simpleBBS | /bbs/commentHandler.py | UTF-8 | 1,581 | 2.703125 | 3 | [] | no_license |
def addNode(treeDic,comment):
if comment.parent_comment is None:
treeDic[comment]={}
else:
for k,v in treeDic.items():
if k == comment.parent_comment:
treeDic[comment.parent_comment][comment]={}
else:
addNode(v,comment)
def buildTr... | true |
787e9301d9d0898e18f9926b206fdc5717a1e724 | Python | connorwarnock/logbox | /models/log.py | UTF-8 | 1,156 | 2.625 | 3 | [] | no_license | import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import UUID
from lib import db
from lib.database import CRUD, Model
from lib.log_parser import LogParser
from .log_event import LogEvent
class Log(Model, CRUD):
__tablename__ = 'logs'
id = db.Column(UUID(as_uuid=True), primary_key=True, server_defau... | true |
7e8508bf27507bab1350608a954b9cc80147a1c2 | Python | hadaytullah/sa_port | /mape/evaluation/average_wait.py | UTF-8 | 1,468 | 3.0625 | 3 | [] | no_license | from mape.evaluation.abstract_evaluation import AbstractEvaluation
from mape.evaluation.meta_data import EvaluationMetaData
import operator
class AverageWait(AbstractEvaluation):
def __init__(self):
super().__init__()
self.evaluation_name = "Average Wait Time"
self.evaluation_unit = "Minu... | true |
5cad12807cac015bd95a327b0cc7e075ef08548f | Python | whglamrock/leetcode_series | /leetcode343 Integer Break.py | UTF-8 | 544 | 3.28125 | 3 | [] | no_license |
# write down the biggest integer break from 2 to 15, you will be able to find out
class Solution(object):
def integerBreak(self, n):
if n == 2:
return 1
if n == 3:
return 2
ans = 1
if n%3 == 0:
for i in xrange(n/3):
ans *= 3
... | true |
6479a7f63fe6536ef952b3c941de0e2fea615f74 | Python | pangzy/experiment | /data processing/reassemble.py | UTF-8 | 4,923 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from collections import defaultdict
from time import strptime, mktime
def pause():
if raw_input("press any key to continue:"):
pass
def reassemble_from_date():
list_dir = os.listdir(os.getcwd())
date_list = []
record_list = []
for... | true |
8259af9cbb5a9c76d805a9d72a603af0ecc7b99b | Python | abner0908/pythonProject | /practices/re_test_patterns.py | UTF-8 | 685 | 3.484375 | 3 | [] | no_license | import re
def test_patterns(text, patterns = []):
for pattern, desc in patterns:
print("Pattern: {0} ({1})\n".format(pattern, desc))
print(" {0}".format(text))
for match in re.finditer(pattern, text):
start = match.start()
end = match.end()
stars = '*' * start
print(" {0}{1}".for... | true |
e5a0bd0d801e8326f43f68488061a9dddd4e20d0 | Python | Jason-bolt/projectWork | /pHSensor.py | UTF-8 | 269 | 3.03125 | 3 | [] | no_license | from machine import Pin, ADC
import time
pH = ADC(Pin(33))
gradient = -0.114285714
intercept = 29.771428522
while True:
voltage = (gradient * pH.read()) + intercept
print("With intercept:", voltage)
print("Raw analog:", pH.read())
time.sleep_ms(500)
| true |
04bead6a4ecd3aaaf9ad1f56c3bbfb5dee1c4c90 | Python | cottrell/mylib | /my/oldlib/plotting.py | UTF-8 | 1,032 | 2.6875 | 3 | [] | no_license | import numpy as np
# notes mostly
def meshgrid_from_df(df, **kwargs):
# this is useful because meshgrid is confusing ... is like 'real space' not i,j space ... things are flipped.
df = df.sort_index(axis=1).sort_index(axis=0)
x, y = np.meshgrid(df.index.values, df.columns.values, **kwargs)
z = df.val... | true |
c32d5e82d026f93ead46ddf62a292ba53aade154 | Python | frestr/Python-obfuscator-3000 | /pyobfs3000.py | UTF-8 | 333 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
from sys import argv
from obfuscator import Obfuscator
def main():
obfs = Obfuscator()
try:
argv[1]
argv[2]
except:
print('Format: ./pyobfs3000.py <in_file> <out_file>')
return
obfs.obfuscate_file(argv[1], argv[2])
if __name__ == '__main__'... | true |
5bfedd4af5ad9d30586881a3e0c66709cca9e793 | Python | zahidzqj/learn_python | /函数/z_匿名函数.py | UTF-8 | 645 | 3.953125 | 4 | [] | no_license | #coding=utf-8
test2 = lambda a,b:a-b
result2 = test2(11,22)#调用匿名函数
print(result2)
infors = [{"name":"laowang","age":21},{"name":"xiaoming","age":20},{"name":"banzhang","age":21}]
infors.sort(key=lambda x:x['age'])
print(infors)
def test_sum(a,b,func):
result = func(a,b)
return result
num1 = test_sum(11,22,lam... | true |
b059143d6f3690ca97520762f9ae3ab03177e5a0 | Python | Avivbh/ffxiv_experiment | /ultimatum_game_intro/models.py | UTF-8 | 1,235 | 2.6875 | 3 | [
"MIT"
] | permissive | from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range
)
import random
doc = """
One player decides how to divide a certain amount between himself and the other
player.
See: Kahneman, Daniel, Jack L. Knetsch, and Richard H. Thaler. "Fairnes... | true |
8b2659f22c629d7de388e33433cb5a6be08f1705 | Python | gobert/ud120-projects | /svm/svm_author_id.py | UTF-8 | 1,688 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
"""
This is the code to accompany the Lesson 2 (SVM) mini-project.
Use a SVM to identify emails from the Enron corpus by their authors:
Sara has label 0
Chris has label 1
"""
import sys
from time import time
sys.path.append("../tools/")
from email_preprocess import preprocess
### ... | true |
d2ebfd09e47a80733c87eecfe508af6dd4c1a51e | Python | saymoniphal/fswd3-tournament-result | /tournament.py | UTF-8 | 7,676 | 3 | 3 | [] | no_license | #!/usr/bin/env python
#
# tournament.py -- implementation of a Swiss-system tournament
#
import contextlib
import time
import psycopg2
import config
@contextlib.contextmanager
def connect():
"""Connect to the PostgreSQL database. Returns a database connection.
Use context manager decorator for database... | true |
8873ed462557e6f692f8f610be15766044ff99ae | Python | SushilPudke/PythonTest | /test.py | UTF-8 | 235 | 3.734375 | 4 | [] | no_license | msg="hello! World"
print (msg)
x=5
if x==10:
print("x is ",x)
else:
print("Not match")
'''
Multi Line Comment
sfsf
s
'''
a=input("Enter any no ")
print("Entered no ",a)
nm=input("Enter Your Name ")
print("Entered Name ",nm) | true |
95a01ef80989b6d16b7bf74d10cbd13ebdd08506 | Python | PaulZhu0122/CS303_AI | /Reversi_AI.py | UTF-8 | 2,855 | 3.65625 | 4 | [] | no_license | import numpy as np
import random
import time
COLOR_BLACK = -1
COLOR_WHITE = 1
COLOR_NONE = 0
random.seed(0)
# don't change the class name
class AI(object):
# chessboard_size, color, time_out passed from agent
def __init__(self, chessboard_size, color, time_out):
self.chessboard_size = chess... | true |
29c475f7516115b529e0f650ad9dca58bf78997e | Python | matthew-maya-17/CSCI-1100-Computer-Science-1 | /RPI-CS1100-HW/hw8_files_F19/hw8_files_F19/hw8_part1.py | UTF-8 | 939 | 3.21875 | 3 | [] | no_license | import json
import BerryField
import Bear
import Tourist
file = input("Enter the json file name for the simulation => ")
print(file)
#file = "bears_and_berries_1.json"
f = open(file)
data = json.loads(f.read())
bf = (data["berry_field"])
ab = (data["active_bears"])
rb =(data["reserve_bears"])
at = (data["... | true |
d23f2755679f789c7a8ba97c38227474e18046cc | Python | aaqingsongyike/Python | /Python_Process/test/demo-02.py | UTF-8 | 507 | 3.671875 | 4 | [] | no_license | #并发
#fork()
import os
import time
#只能在Linux和Mac中使用
ret = os.fork() #fork()的返回值是 等于0(主进程)和大于0(子进程)
print("父进程和子进程都执行")
"""
os.getpid() 获取当前进程的值(pid)
os.getppid() 获取父进程的pid
"""
if ret == 0:
while True:
print("-父进程-%d"%os.getpid())
time.sleep(1)
else:
while True:
... | true |
a58668e2e2f2b567a4be003d3f5811dbe52d0428 | Python | rnaidu999/MyLearnings | /Date_Difference.py | UTF-8 | 943 | 3.53125 | 4 | [] | no_license |
from datetime import datetime
from datetime import date
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%Y-%m-%d")
d2 = datetime.strptime(d2, "%Y-%m-%d")
return abs((d2 - d1).days)
#dat1=input("Enter Start Date :")
#dat2=input("Enter End Date :")
#print(days_between(dat1,dat2))
d1=date(2014,1,1)... | true |
11ae801cc209da44ed9642aac795a943ab69bb77 | Python | SindriSB/Info284 | /Kandidat81/81.py | UTF-8 | 1,170 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
author: 81
"""
#Loads libraries
import pandas as pd
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsRegressor
# Loads dataset
dataset = pd.read_csv('Flaveria.csv')
# Makes new columns with float instead of string objects... | true |
f2893e28a85157993c8e6cc04c886b95a4983d12 | Python | akakcolin/myDocumentsSyn | /scripts/plot_vasp_ir.py | UTF-8 | 8,280 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################
# #
# plot IR #
# S.Nenon 2015 #
# tiny changed by lzh 2021 #
###########################################... | true |
63e68d2a6eb2027b62eec3761ee5706dceb5af08 | Python | Cahersan/django-formulator | /formulator/__init__.py | UTF-8 | 263 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
VERSION = (0, 2, 0, 'dev')
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
return '.'.join((str(each) for each in VERSION[:4]))
| true |
ce78aff2fd8d641037ad824290d2a90d787523f8 | Python | owhyy/automate-the-boring-stuff-2e | /Ch3/collatz.py | UTF-8 | 356 | 4.03125 | 4 | [] | no_license |
def collatz(number):
if number % 2 == 0:
print(number // 2)
return number // 2
print(3 * number + 1)
return 3 * number + 1
def read():
try:
number = int(input())
while(number != 1):
number = collatz(number)
except ValueError:
print('Error: Invali... | true |
09ea6b977a63aff6af688c3f43178f09f56a3099 | Python | Clipsey/PI-Drone-Camera | /Working-Demo-Stuff/Test_Bench.py | UTF-8 | 1,371 | 2.515625 | 3 | [] | no_license | import pygame
import Drone_Controller_Module
import Drone_Webcam_Module
import time
import threading
import socket
drone_quit = False
def ControllerThreadLoop(Controller):
global drone_quit
while Controller.done == False and drone_quit == False:
try:
Controller.RunSingleIteration()
... | true |
2596d563338342d256225de606c600ff6257c8c8 | Python | lienordni/ProjectEuler | /45.py | UTF-8 | 321 | 3.390625 | 3 | [] | no_license | import math
def tri(x):
return (-1+math.sqrt(1+8*x))/2==int((-1+math.sqrt(1+8*x))/2)
def pent(x):
return (1+math.sqrt(1+24*x))/6==int((1+math.sqrt(1+24*x))/6)
def hexa(x):
return int((1+math.sqrt(1+8*x))/4)
i=2
while True:
if(pent(i*(2*i-1)) and tri(i*(2*i-1))):
print(i*(2*i-1))
print()
i+=... | true |
4cf03066983aad1c58761950d96ea9d60a2c265c | Python | ryannewman2828/Documented-Learning | /Algorithms/Sequences/Merge Sort/MergeSort.py | UTF-8 | 795 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python
import random
maxNum = 1000000
# The array that is to be sorted
arr = [int(maxNum * random.random()) for i in range(10000)]
def merge(listA, listB):
listReturn = []
while len(listA) > 0 or len(listB) > 0:
if len(listA) == 0:
listReturn.extend(listB)
listB.cle... | true |
f7fa6a7519c347da064547a547b3ca8d0d96af13 | Python | denny0323/EM_Project | /Seq2Seq/sm_tool.py | UTF-8 | 5,335 | 2.515625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from hanspell import spell_checker
from collections import defaultdict
import operator
import re
#### data_loading function
def loading_data(data_name):
# data format : csv
corpus = pd.read_csv(data_name, sep=",", names=None, encoding='cp949')
... | true |
78cfd31f76adb1c5db9667cde9a3ec3b10354e80 | Python | bitsapien/anuvaad | /public/phase-2-20160620022203/PYTHON/do-you-even-swap.py | UTF-8 | 290 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
# Name : Do You Even Swap
# input:
# a : given integer
# t : number of swaps
elements = raw_input().strip().split(' ')
a = int(elements[0])
t = int(elements[1])
# write your code here
# store your results in `result`
# output
# Dummy Data
result = 4321
print(result)
| true |
ae23c4cd0dbc9b67b9cd7c5d7920d7c78b40a883 | Python | majidgourkani/python | /learn 2/begginer/25.py | UTF-8 | 584 | 3.484375 | 3 | [] | no_license | import datetime as dt
def add(a,b,c):
return a+b+c
print(add(2,5,8))
#####################################################
def addj(*nums):
total = 0
for n in nums:
total += n
return total
print(addj(65,65,89,646,87,9,223,9))
print(addj(651,98,65,1))
print(addj(1,2,3,4,4,56,7,9... | true |
37d73e166ecde77d6afab32afaf707959a808017 | Python | Aasthaengg/IBMdataset | /Python_codes/p03472/s012623524.py | UTF-8 | 968 | 2.59375 | 3 | [] | no_license | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y:... | true |
c057846db5bbd243d3e24108b32c2ef53e384c3a | Python | Luolingwei/LeetCode | /OA/Amazon/QAmazon_Longest Palindrone Substring.py | UTF-8 | 444 | 2.84375 | 3 | [] | no_license | class Solution:
def longestPalindrome(self, s: str) -> str:
N=len(s)
l,r=0,0
def check(i,j):
while i>=0 and j<N and s[i]==s[j]:
i-=1
j+=1
return i+1,j-1
for i in range(len(s)):
a,b=check(i,i)
if b-a>r-l:
... | true |
595d74d4fbb4b4159c8ebc5471047a123a60b51a | Python | andrewp-as-is/markdown-table.py | /tests/markdown-table/examples/Table.py | UTF-8 | 222 | 2.65625 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import markdown_table
columns = ["name","__doc__"]
matrix = [
["name1","desc1"],
["name2","desc2"],
]
table = markdown_table.Table(columns,matrix)
print(str(table))
| true |
cf5a0129b4cb312360b47148a1fd056406af1f12 | Python | Sparshith/hackerrank-solutions | /CrackingTheCodingInterview/arrays_left_rotation.py | UTF-8 | 1,097 | 4.28125 | 4 | [] | no_license | '''
A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array , then the array would become .
Given an array of integers and a number, , perform left rotations on the array. Then print the updated array as a single line... | true |
d5ea4cf163f94be2f4aba28108c75eb846f6b91e | Python | wangkailovebaojiakun/Test_Python_OpenCV | /Python-OpenCV/Arithmetic Operations on Images/Image_Blending.py | UTF-8 | 497 | 2.828125 | 3 | [] | no_license | #coding:utf-8
#Image Blending 图像融合
import cv2
import numpy as np
import os
#Both images should be of same depth and type,
#or second image can just be a scalar value(标量值).
#read logo and image
path = os.getcwd()
parent_path = os.path.dirname(path)
logo_path = parent_path + '/IMAGES/logo.jpg'
logo = cv2.imread(logo_pat... | true |
7efe8c87dd7868e5dddbca6249cdc7be150e5e0b | Python | marcusfreire0504/mememakertwitter | /Robo.py | UTF-8 | 10,304 | 3.046875 | 3 | [
"MIT"
] | permissive | import datetime
import os
import random
import re
import shutil
import time
import pytz
import requests
import tweepy
class Robo:
"""
Este é o robô com suas funções pré-determinadas para efetuar a autenticação e publicação de Tweets com imagens e vídeos.
"""
def __init__(self, nome,... | true |
b55daaef5c0f74914e48bf2c0a4705acef4f6f17 | Python | limapedro2002/PEOO_Python | /Projeto M4/Gabriela, Yasmin, Wellen e Sarah/produto.py | UTF-8 | 2,608 | 3.8125 | 4 | [] | no_license | #adicionar #listar #deletar #atualizar
class Produto:
def __init__(self, nome = None, marca = None, preço = None, cod = None):
self.nome = nome
self.marca = marca
self.preço = preço
self.cod = cod
self.lista_produtos = []
def adicionar(self, nome, marca, preço, cod)... | true |
c05a27cb8a6912ea6f30d37b3795e71d2c7cc62a | Python | priyarora4/Adaptive-learning | /part_a/knn.py | UTF-8 | 2,950 | 3.09375 | 3 | [] | no_license | from sklearn.impute import KNNImputer
from utils import *
import matplotlib.pyplot as plt
def knn_impute_by_user(matrix, valid_data, k):
""" Fill in the missing values using k-Nearest Neighbors based on
student similarity. Return the accuracy on valid_data.
See https://scikit-learn.org/stable/modules/gen... | true |
65606af09cc9e6c7f47c40c94a51d78ca25692cd | Python | bourque/stak | /stak/tests/test_example.py | UTF-8 | 2,406 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | def test_primes():
from ..example_mod import primes
assert primes(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
def test_deprecation():
import warnings
warnings.warn(
"This is deprecated, but shouldn't raise an exception, unless "
"enable_deprecations_as_exceptions() called from conftest.... | true |
244c9d1cc8dbb84aa7883ffdbb0fb73970f5ac2d | Python | fjpiao/pyclass | /pythonthread/thread/lock.py | UTF-8 | 374 | 3.4375 | 3 | [] | no_license | from threading import Thread,Lock
a=b=0#全局变量两个线程都读写
lock=Lock()#锁对象
def value():
while Ture:
lock.acquire()#加锁 另一个线程也要加锁
if a !=b:
print('a=%d,b=%d'%(a,b))
lock.release()
t=Thread(target=value)
t.start()
while True:
with lock:
a+=1
b+=1
t.join() ... | true |
19b8db5422629b271d85121bdce7e72dbec865a5 | Python | MaxValue/Python-Tools | /gxep/gxep | UTF-8 | 5,513 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
#
import re, os, argparse, time
from lxml import html, etree
parser = argparse.ArgumentParser(argument_default=False, usage="%(prog)s [OPTION]... --pattern='PATTERN' FILE...\n or: %(prog)s [OPTION]... --file=PFILE FILE...\nSearch for PATTERN in each FILE.\nA FILE of “-” stands... | true |
a4827a0c695ebb309f477ca6356c35d83228dc3e | Python | DhanaMani1983/Python | /Iterator.py | UTF-8 | 613 | 4.34375 | 4 | [] | no_license | '''
Iterators are used to loop an iterable but one item at a time
each time it remember the last value and gives the next value
'''
#lst = [5,9,3,1,7]
#it = iter(lst)
#print (it.next())
#print (it.next())
# own iterator
class TopTen:
def __init__(self):
self.num = 1
def __iter_... | true |
81b9992f53105ed58cc125a784255060f6edc900 | Python | alinghi/PracticeAlgorithm | /baekjoon/5585.py | UTF-8 | 131 | 3.03125 | 3 | [
"MIT"
] | permissive | N=int(input())
l=[500,100,50,10,5,1]
N=1000-N
ans=0
for coin in l:
if N>=coin:
ans+=N//coin
N=N%coin
print(ans) | true |
20310425fcbb2d7c4a948c66b11c9fbb6f97829d | Python | AaronDweck/all-Python-folders | /turtle test.py | UTF-8 | 81 | 2.6875 | 3 | [] | no_license |
from turtle import *
pen1 = Pen()
pen2 = Pen()
pen1.screen.bgcolor("#5D5732")
| true |
5c1568b178b6c77cda27662e172f2029a8287127 | Python | qijiamin/learn-python | /test1-07.py | GB18030 | 947 | 3.515625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
#########ѧϢ############
#:
#ѧ:1403050116
#༶ͨ14-1
##############Ŀ###############
#
#############################
import math
a=input('a:')
#dx=0.1
f1=(math.pow(3+0.1,a)-math.pow(3,a))/0.1
print 'f1=',f1
#dx=0.01
f2=(math.pow(3+0.01,a)-math.pow(3,a))/0.01
print 'f1=',f1,'f2=',f2
#dx=0.001
f3=(math.... | true |
067b3a1b0573b3b06ed1881e1ad5cac23699abea | Python | adrian-soch/Pacemaker-Project | /DCM/graph/ExperimentDCM.py | UTF-8 | 75,876 | 2.890625 | 3 | [
"MIT"
] | permissive | #Imports
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import sqlite3
#Creating sqlite3 database
db = sqlite3.connect("DCM.sqlite", detect_types= sqlite3.PARSE_DECLTYPES)
#Create seperate table for each state within database
db.execute("CREATE TABLE IF NOT EXISTS AOO (user TEXT NOT NULL... | true |
1abff19a7827a6f911bc981eb4fb97728751b218 | Python | A-Jacobson/FaceNet-Pytorch | /datasets.py | UTF-8 | 1,905 | 2.828125 | 3 | [] | no_license | import os
import random
from glob import glob
from PIL import Image
from torch.utils.data import Dataset
class TripletImageDataset(Dataset):
"""
Creates anchor, positive, negative triples from diretory of Image folders
"""
def __init__(self, root, transform=None):
self.name_to_id = dict((nam... | true |
0eabf157cc5b8aa71cad34be7ae0807e3ac6a5d7 | Python | crashish/stuff | /stakreport.py | UTF-8 | 577 | 2.78125 | 3 | [] | no_license | import requests
import bs4
hosts = ['192.168.1.104:1001', '192.168.1.90:1001']
res = {}
for host in hosts:
data = requests.get("http://"+host+"/h")
soup = bs4.BeautifulSoup(data.text, "html.parser")
res[host] = {}
for row in soup.findAll('tr'):
th = row.findAll('th')[0].text.strip()
if 'Thread' in th:
cont... | true |
cb387a3b463d5b768cbcff13769f3adb886e6427 | Python | Snehagit6/G-Pythonautomation_softwares-Sanfoundry_programs | /Basic_Programs/reverseofno.py | UTF-8 | 171 | 4.03125 | 4 | [] | no_license | n = int(input("Enter the number of elements to be reversed:"))
rev=0
while n > 0:
dig = n % 10
rev = rev*10+dig
n = n//10
print("Reversed number : ", rev)
| true |
46f183d8b82110fa4ed292449d1864326570fb86 | Python | 215836017/LearningPython | /code/Test11.py | UTF-8 | 3,447 | 4.71875 | 5 | [] | no_license | print('函数式编程 --- 高阶函数 --- 内建函数:map/reduce')
'''
map/reduce
1. map()函数接收两个参数,一个是函数,一个是Iterable,map将传入的函数依次作用到序列的每个元素,并把结果作为新的Iterator返回
2. map()作为高阶函数,事实上它把运算规则抽象了,因此,我们不但可以计算简单的f(x)=x2次方,还可以计算任意复杂的函数
'''
# 比如我们有一个函数f(x)=x2次方,要把这个函数作用在一个list [1, 2, 3, 4, 5, 6, 7, 8, 9]上,就可以用map()实现如下
def f(x):
return x * x... | true |
652e82ebb251213f3a9dd8eaf57223674452b704 | Python | prechelt/pyth | /tests/test_writelatex.py | UTF-8 | 1,517 | 2.8125 | 3 | [
"MIT"
] | permissive | """
unit tests of the latex writer
"""
from __future__ import absolute_import
import unittest
from pyth.plugins.latex.writer import LatexWriter
from pyth.plugins.python.reader import *
class TestWriteLatex(unittest.TestCase):
def test_basic(self):
"""
Try to create an empty latex document
... | true |
2826677218722f622f19052d3cc59c8652db3eff | Python | ardacancglyn/Python | /17_List_Comprehension.py | UTF-8 | 592 | 4.375 | 4 | [] | no_license | #List Comprehension
#1-)
print("1-): ")
list1=[1,2,3,4,5,6,7,8,9,10]
list2=list()
for i in list1:
list2.append(i)
print(*list2)
#2-)1. SAME(Basic)
print("2-): ")
list3=list(range(1,21))
liste = []
for i in range(1000):
liste += [i]
#2-)2.SAME (Comprehension)
liste1 = [i for i in r... | true |
0abd6ac1945bb90d421437be47a743e6f35f185b | Python | messerzen/Udacity_DataEngineer | /2_datamodeling/project1_datamodeling_with_postgres/etl.py | UTF-8 | 4,806 | 3.109375 | 3 | [] | no_license | import os
import glob
import psycopg2
import pandas as pd
from sql_queries import *
def process_song_file(cur, filepath):
"""
- Process the data stored in the song file, splitting the data in song and artist dataframe.
- Register each dataframe record in its respective tables in the database .
Param... | true |
f608b04f4c1fe001bdf632d38c514655e023ae54 | Python | gaurab123/DataQuest | /02_DataAnalysis&Visualization/01_DataAnalysisWithPandas-Intermediate/05_WorkingWithMissingData/03_FindingTheMissingData_examples.py | UTF-8 | 498 | 3.6875 | 4 | [] | no_license | import pandas as pd
titanic_survival = pd.read_csv('titanic_survival.csv')
sex = titanic_survival["sex"]
sex_is_null = pd.isnull(sex)
# This loop show the sex element value with the corresponding isnull return value
# It illustrates the fact that a null value will return a true value
for index, item in enum... | true |
350a0b385242283be21ecd93316e7c44939f4005 | Python | uttank/haksangbu | /sample_file.py | UTF-8 | 1,129 | 2.90625 | 3 | [] | no_license | import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
# Instantiates a client
client = vision.ImageAnnotatorClient()
# The name of the image file to annotate
file_name = os.path.abspath('./data2.jpg')
result_file_name = os.path.abspath('./result.json')
# Loads the image into ... | true |
fd0a4a3111605e97fa21ac6c21ea240414013728 | Python | jsmojver/Backup_LoboPharm | /project/openpyxl/writer/tests/test_lxml.py | UTF-8 | 24,122 | 2.78125 | 3 | [] | no_license | from __future__ import absolute_import
# Copyright (c) 2010-2014 openpyxl
# stdlib
import datetime
import decimal
from io import BytesIO
# package
from openpyxl import Workbook
from lxml.etree import xmlfile, Element
# test imports
import pytest
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def wor... | true |
79e66315e18f2a9e3cf3a9e050f21f637f06fe14 | Python | hirajanwin/LeetCode-5 | /1451. Rearrange Words in a Sentence/main.py | UTF-8 | 297 | 3.03125 | 3 | [
"MIT"
] | permissive | class Solution:
def arrangeWords(self, text: str) -> str:
text = text.lower().split()
res = []
for i, word in enumerate(text):
res.append((len(word), i, word))
res.sort()
p = " ".join([i[2] for i in res])
return p[0].upper() + p[1:]
| true |
67b347cde3d1d4a57176041fc3819ca93790edcc | Python | rspies/NWS_Python | /PRISM/PRISM_summary_table_monthly.py | UTF-8 | 4,663 | 2.671875 | 3 | [] | no_license | #_calculate_basin_nlcd_summary.py
#Ryan Spies
#ryan.spies@amec.com
#AMEC
#Description: creates summary table of PRISM data (converts mm to in)
#from .xls files output from ArcGIS Model Builder
#7/24/2014 -> modified to also run the script using .csv files (output from python arcpy tool)
#output single .csv
#... | true |
fc5d84b0c5dde4ba5f3cc9ffe6a0f3f4cf5305dc | Python | busraerkoc/BookLibrary | /app/forms.py | UTF-8 | 475 | 2.578125 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SubmitField
class AddForm(FlaskForm):
title = StringField('Name of Book: ')
author = StringField('Name of Author: ')
publisher = StringField('Name of Publisher: ')
available = StringField('Note for Availability: ')
submi... | true |
018b3b99179a6858c8486d58a5d44de1ee723954 | Python | RoachLok/MyCloudInstance | /database/external/yt_stack_data_db_dump.py | UTF-8 | 1,823 | 2.8125 | 3 | [] | no_license | import sqlite3
from nltk.tokenize import api
import yt_stack_query
#Lists from Youtube API
dates_yt = list(yt_stack_query.decode_yt()[0])
upvotes_yt = yt_stack_query.decode_yt()[1]
views_yt = yt_stack_query.decode_yt()[2]
#Lists from Stack Exchange API
dates_stack = list(yt_stack_query.decode_stack()[0])
upvotes_stac... | true |
af9c19af1fd1c61ab130469613a7d1431db5abcf | Python | Aasthaengg/IBMdataset | /Python_codes/p02397/s255996488.py | UTF-8 | 124 | 3.015625 | 3 | [] | no_license | i=0
while 1:
i+=1
x,y=map(int, raw_input().split())
if x==0 and y==0:
break
print min(x,y),max(x,y) | true |
997a6c72f99c9b008dfdff862e6ce21912dc4c29 | Python | Apb58/Python-Projects | /range_check.py | UTF-8 | 4,363 | 3.375 | 3 | [] | no_license | #!/usr/bin/python3
## Intrarange checker:
## Adrian Bubie
## 12/03/18
## ------------
## This program takes 2 files of genomic positions as inputs, a reference and a query, and returns the positions
## in the query that fall within the positions of the reference. The reference file should be structured with
## 'chromo... | true |
f153571d57a516a6850ddf451d17cf622c4bf063 | Python | saisai/python-3 | /beginner_scripts/functions.py | UTF-8 | 200 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
def ifState():
a = 10;
if a > 10:
print "A is bigger than 10."
elif a < 10:
print "A is smaller than or equal to 10."
else :
print "A is not a number."
ifState()
| true |