prompt stringlengths 19 1.03M | completion stringlengths 4 2.12k | api stringlengths 8 90 |
|---|---|---|
import subprocess
import json
import os
import csv
import numpy as np
import pandas as pd
import pysam
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
def get_orf(input_genome, output_genome, orf):
orf = int(orf)
record = SeqIO.read(input_genome, 'fasta')
record.seq = re... | pd.DataFrame(data) | pandas.DataFrame |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:59:18 2019
@author: <NAME>
"""
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
data = pd.read_csv('data/data.csv')
data.drop(['Unnamed: 0'], axis=1, inplace=True)
# 'match_id', 'team_id'
dat... | pd.read_csv("modified_data.csv") | pandas.read_csv |
import os
import sqlite3
import pandas as pd
import datetime
import numpy as np
import wget
def updateModisDB(filenames, cacheDir):
if len(filenames) > 0:
db_fn = os.path.join(cacheDir, "modis_db.db")
fn = filenames[0].split(os.sep)[-1]
product = fn.split('.')[0]
years = []
... | pd.DataFrame.from_dict(modis_dict) | pandas.DataFrame.from_dict |
# Copyright [2020] [Two Six Labs, LLC]
# Licensed under the Apache License, Version 2.0
from flask import current_app, render_template, Blueprint, request
import pandas as pd
from app_deploy_data.authentication import auth
from utility.constants import (
INDEX_COLUMN,
UPLOAD_ID,
DATA_SOURCE_TYPE,
MAIN... | pd.read_csv(csvfile, sep=",", comment="#") | pandas.read_csv |
# Copyright 2019 Elasticsearch BV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | pd.get_option("display.max_rows") | pandas.get_option |
"""
This script contains experiment set ups for results in figure 1.
"""
import os
import pandas as pd
from experiment_Setup import Experiment_Setup
from agent_env import get_pi_env
from SVRG import *
if __name__ == '__main__':
NUM_RUNS = 10
# Random MDP
alg_settings = [
{"method... | pd.DataFrame(pi_results) | pandas.DataFrame |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
NbrOfNodes = 35
gain = [0.01,0.02,0.03,0.04]
#--------------------------------------------------------------------------
# File for oversizing 5%
#--------------------------------------------------------------... | pd.Series(file_aux) | pandas.Series |
import pandas as pd
import numpy as np
class PreProcessing:
data = None
quarter_names = None
num_years = None
num_days = None
def __init__(self, name):
name= str(name)
self.get_data(name)
self.data['Normalized_Close'] = self.normalized_data_col(self.data)
self.data... | pd.to_datetime(self.data.Date) | pandas.to_datetime |
import sqlite3
import pandas as pd
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScal... | pd.read_sql(query, conn) | pandas.read_sql |
import logging
from pathlib import Path
import click
import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer, KNNImputer
from sklearn.preprocessing import StandardScaler
def engineer_features(df: pd.DataFrame) -> pd.DataFrame:
"""Transform the data by imputing and creating new features th... | pd.get_dummies(df, drop_first=True) | pandas.get_dummies |
import numpy as np
import urllib
import os
import argparse
from sklearn.cross_validation import train_test_split
from astroML.plotting import setup_text_plots
import empiriciSN
from MatchingLensGalaxies_utilities import *
from astropy.io import fits
import GCRCatalogs
import pandas as pd
from GCR import GCRQuery
sys.pa... | pd.DataFrame(data) | pandas.DataFrame |
"""
Description: functions for text preprocessing
Author: <NAME>. @ AI - Camp
Date: Spring 2022
"""
import sys
root = r"C:\Users\45323\Desktop\新python文件夹\AI_Camp\AICS_Bert"
sys.path.append(root)
import config
import pandas as pd
from aug_helper_func import load_dfs_from_folder, get_specific_label_dfs, add_... | pd.read_csv(config.data_path) | pandas.read_csv |
from __future__ import annotations
from typing import Optional, Dict, List, Union, Type, TYPE_CHECKING
from datetime import date, datetime
import pandas as pd
import numpy as np
import re
import locale
try:
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
except locale.Error:
# Readthedocs has a problem, but dif... | pd.to_datetime(x, errors="coerce", dayfirst=True) | pandas.to_datetime |
import sys
import pandas as pd
import numpy as np
import catboost
DUR_RU = 'Длительность разговора с оператором, сек'
DUR_EN = 'oper_duration'
RU_COLS = [
'Время начала вызова', 'Время окончания вызова', 'Время постановки в очередь',
'Время переключения на оператора', 'Время окончания разговора с оператором'... | pd.DataFrame(index=times.index) | pandas.DataFrame |
from methylcapsnet.samplers import ImbalancedDatasetSampler
from pymethylprocess.MethylationDataTypes import MethylationArray
import numpy as np, pandas as pd
from captum.attr import GradientShap
import torch
from torch.utils.data import DataLoader, Dataset, TensorDataset, Subset, ConcatDataset
from torch.utils.data.sa... | pd.cut(ma.pheno[interest_col],bins=n_bins,retbins=True) | pandas.cut |
# Created by <NAME> at 2021/5/12
import pathlib
import numpy as np
import pandas as pd
import statsmodels.api as sm
from fracdiff import FracdiffStat
from scipy.stats import entropy
from sklearn.decomposition import PCA
from sklearn.impute import SimpleImputer
from sklearn.model_selection._split import _BaseKFold, ind... | pd.to_datetime(df.index) | pandas.to_datetime |
import pandas as pd
import datetime
from typing import List, Dict
# Define hourly cost per line - regular, overtime and weekend
reg_costs_per_line = {"Line_1": 245, "Line_2": 315, "Line_3": 245}
lines: List[str] = list(reg_costs_per_line.keys())
# Get orders
customer_orders = pd.read_excel("Customer_orders.xlsx")
# ... | pd.read_csv("Planning_model4_list.csv") | pandas.read_csv |
import math
from datetime import datetime, timedelta
import pandas as pd
import requests
from pandas.io.json import json_normalize
def build_query_url(
begin_date, end_date, stationid, product, datum=None, bin_num=None,
interval=None, units='metric', time_zone='gmt'):
"""
Build an URL to be u... | pd.to_datetime(df_HH['date_time_HH']) | pandas.to_datetime |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 11 16:31:58 2021
@author: snoone
"""
import os
import glob
import pandas as pd
pd.options.mode.chained_assignment = None # default='warn'
OUTDIR = "D:/Python_CDM_conversion/hourly/qff/cdm_out/observations_table"
os.chdir("D:/P... | pd.read_csv("D:/Python_CDM_conversion/new recipe tables/record_id.csv") | pandas.read_csv |
# Lint as: python3
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | pd.testing.assert_frame_equal(actual, self.input_df[names]) | pandas.testing.assert_frame_equal |
from delphin_6_automation.database_interactions import general_interactions
from delphin_6_automation.database_interactions import mongo_setup
from delphin_6_automation.database_interactions.auth import auth_dict
from delphin_6_automation.database_interactions import delphin_interactions
from delphin_6_automation.datab... | pd.ExcelWriter(r'U:\RIBuild\2D_1D\4A_36_Acronyms.xlsx') | pandas.ExcelWriter |
import numpy as np
import pandas as pd
import fiona
import io
from shapely import geometry
import click
from wit_tooling import query_wit_data
def shape_list(key, values, shapefile):
"""
Get a generator of shapes from the given shapefile
key: the key to match in 'properties' in the shape file
... | pd.DatetimeIndex(wit_df['TIME']) | pandas.DatetimeIndex |
"""Plots graphs of timings"""
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def main():
"""Saves plots of benchmarks to disk"""
io_df = pd.read_csv("benchmark_timings_iolimited.csv")
cpu_df = pd.read_csv("benchmark_timings_cpulimited.csv")
def plot(df, title):
"""p... | pd.concat([data.loc[_i:_i]] * 3, ignore_index=True, sort=False) | pandas.concat |
import pandas as pd
import os
import config
import models
from sqlalchemy.orm import sessionmaker
session = sessionmaker(bind=config.ENGINE)()
manual_themes = 'manual_themes'
cleaned_themes = 'cleaned_themes'
manual_territories = 'territories'
cleaned_territories = 'cleaned_territories'
comment_col = 'comment'
territ... | pd.concat([df[[cleaned_themes, cleaned_territories, comment_col]] for df in dataframes]) | pandas.concat |
# Copyright (c) 2020 ING Bank N.V.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distr... | pd.Series(series, index=index) | pandas.Series |
import time # 引入time模块
import pandas as pd
import re
import sqlparse
attributeNameArray = ['tableName', 'createTime', 'lastModifyTime', 'owner', 'rowNumber', 'columnNumber',
'primaryKey', 'uniqueKey', 'foreignKey', 'notNullColumn', 'indexColumn', 'columnDataType']
remarksList = ['表名', '创建时间', '最... | pd.merge(finallyDf, ele, how="inner") | pandas.merge |
import pandas as pd
import numpy as np
df=pd.read_csv("Train.csv")
df_test= | pd.read_csv("Test.csv") | pandas.read_csv |
import arff
import copy
import json
import logging
import math
import os
import pandas as pd
import warnings
from functools import wraps
from a2ml.api.utils import fsclient, get_uid, get_uid4, remove_dups_from_list, process_arff_line, download_file, retry_helper, parse_url
from a2ml.api.utils.local_fsclient import Lo... | pd.to_datetime(res[date_field], infer_datetime_format=True, errors='ignore', utc=True) | pandas.to_datetime |
import os
import sys
from subprocess import Popen, PIPE
from tempfile import NamedTemporaryFile
import happybase
from mrjob.job import MRJob
from mrjob.protocol import PickleProtocol
# # mongo clients libs
from pymongo import MongoClient, ASCENDING, DESCENDING
# # Generic imports
import glob
import pan... | pd.Timedelta('1 days') | pandas.Timedelta |
import decimal
import numpy as np
from numpy import iinfo
import pytest
import pandas as pd
from pandas import to_numeric
from pandas.util import testing as tm
class TestToNumeric(object):
def test_empty(self):
# see gh-16302
s = pd.Series([], dtype=object)
res = to_numeric(s)
... | pd.to_numeric(idx) | pandas.to_numeric |
# Predict_Gesture_Twitch.py
# Description: Recieved Data from ESP32 Micro via the AGRB-Training-Data-Capture.ino file, make gesture prediction and tell it to twitch
# Written by: <NAME>
# Created on July 13th 2020
import numpy as np
import pandas as pd
import datetime
import re
import os, os.path
import time
import ... | pd.DataFrame(data,columns=header) | pandas.DataFrame |
from __future__ import unicode_literals
import copy
import io
import itertools
import json
import os
import shutil
import string
import sys
from collections import OrderedDict
from future.utils import iteritems
from unittest import TestCase
import pandas as pd
import pytest
from backports.tempfile import TemporaryD... | pd.DataFrame(columns=['output', 'summary_id', 'summaryset_id'], data=data, dtype=int) | pandas.DataFrame |
import pandas
import numpy
import warnings
import itertools
import matplotlib.pyplot as plt
import seaborn
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_selection import RFE
from sklearn.model_sel... | pandas.read_csv("test.csv") | pandas.read_csv |
import csv
import numpy
import pandas as pd
import numpy as np
from core.component import Component
from core.power import PowerInterface
class Source(Component):
def __init__(self, location, power):
super().__init__(location)
self.power_in = power
def get_power_in(self): # TODO Check that t... | pd.DataFrame(data={'engine_load': [1, 0.75, 0.5, 0.25, 0.1], 'CO2_eq': CO2_eq}) | pandas.DataFrame |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | pd.Timestamp('20170101') | pandas.Timestamp |
# coding: utf-8
# # Prototype: Merging Newcomer Dataframes with ORES scores for Newcomer Contributions
# June 8, 2018 <NAME>
#
# Using data sources from http://paws-public.wmflabs.org/paws-public/User:Juliakamin/Querying%20new%20editors%20via%20sql.ipynb
import os, time, datetime, csv, glob, math, datetime, pprint... | pd.DataFrame(survival_week_records) | pandas.DataFrame |
import math
import queue
from datetime import datetime, timedelta, timezone
import pandas as pd
from storey import build_flow, SyncEmitSource, Reduce, Table, AggregateByKey, FieldAggregator, NoopDriver, \
DataframeSource
from storey.dtypes import SlidingWindows, FixedWindows, EmitAfterMaxEvent, EmitEveryEvent
tes... | pd.Timestamp("2021-07-13 06:49:01.084587+0000", tz="UTC") | pandas.Timestamp |
import pickle
import os
from Shared.data import Data
from Shared.data_loader import DataLoader
import numpy as np
import keras
from keras import layers
from sklearn.preprocessing import StandardScaler, MinMaxScaler
import anndata as ad
import pandas as pd
from pathlib import Path
import umap
import tensorflow as tf
imp... | pd.DataFrame() | pandas.DataFrame |
"""
Test various functions regarding chapter 8: MDI, MDA, SFI importance.
"""
import os
import unittest
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score, accuracy_score
from mlfinlab.u... | pd.read_csv(self.path, index_col='date_time') | pandas.read_csv |
from ._rrs import decode_rrs
from ._sondepbl import heffter_pbl, bulk_richardson_pbl, liu_liang_pbl
import pandas as pd
# this makes the imported functions appear in sphinx docs
__all__ = ['decode_rrs', 'estimate_pbl']
# an interface to my sondepbl code
def estimate_pbl(method, height, pressure, temp,
... | pd.DataFrame(data={'P': pressure, 'Height': height, 'Temp': temp}) | pandas.DataFrame |
from database import view
import pandas as pd
# Example data retrieval
def main():
data = view.all()
ours_save_file = "./yu_blender_dialogs.csv"
shirleys_save_file = "./shirley_inspired_dialogs.csv"
raw_blender_save_file = "./raw_blender_dialogs.csv"
zhou_save_file = "./zhou_half_half_dialogs.csv... | pd.DataFrame(sum_dialog["red"]) | pandas.DataFrame |
import os
import pandas as pd
import numpy as np
import numpy.random as rd
import torch
class StockTradingEnv:
def __init__(self, cwd='./envs/FinRL', gamma=0.99,
max_stock=1e2, initial_capital=1e6, buy_cost_pct=1e-3, sell_cost_pct=1e-3,
start_date='2008-03-19', end_date... | pd.read_pickle(processed_data_path) | pandas.read_pickle |
import rebound
import numpy as np
import pandas as pd
import multiprocessing
from collections import OrderedDict
from celmech.poincare import Poincare, PoincareHamiltonian
from celmech import Andoyer, AndoyerHamiltonian
from celmech.resonances import resonant_period_ratios, resonance_intersections_list, resonance_prati... | pd.Series(Z-m) | pandas.Series |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Parsing of a csv game tracking sheet of type 'X', saving data in consice and relevant manner."""
# Here comes your imports
import sys
import logging as log
import pandas as pd
# Here comes your (few) global variables
# Here comes your class definitions
# Here comes... | pd.DataFrame('', index=players_goalies.index, columns=['shot', 'assist', 'block']) | pandas.DataFrame |
# https://www.kaggle.com/tocha4/lanl-master-s-approach
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import scipy as sc
import matplotlib.pyplot as plt
import seaborn as sns
import gc
import warnings
warnings.filterwarnings("ignore")
warnings.simplefilter(ac... | pd.read_csv("G:/kaggle/Earthquake/data/train_y_0.csv", index_col=False, header=None) | pandas.read_csv |
# coding: utf-8
# # Structural durability analyses for carbon/epoxy laminates
#
# ## §3: Experimental
# In[39]:
#Preamble to hide inputs so that massive code scripts are not cluttering the data visualization output
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (c... | pd.read_excel(P, header=None) | pandas.read_excel |
import numpy as np
from datetime import timedelta
import pandas as pd
import pandas.tslib as tslib
import pandas.util.testing as tm
import pandas.tseries.period as period
from pandas import (DatetimeIndex, PeriodIndex, period_range, Series, Period,
_np_version_under1p10, Index, Timedelta, offsets)
... | period_range('2007-01', periods=50) | pandas.period_range |
import pandas as pd
from utils_dr_pre_word_simi import *
import os
from utils import *
from transformers import *
from dataset import Dataset_dr
import torch
import numpy as np
TRAIN_DR = './con_rew_data/para/train.csv'
DEV_DR = './con_rew_data/para/dev.csv'
TEST_DR = './con_rew_data/para/test.csv'
fw = ... | pd.read_csv(ROC_TEST_HE) | pandas.read_csv |
#! -*- coding:utf-8 -*-
import os
import re
import gc
import sys
import json
import codecs
import random
import warnings
import numpy as np
import pandas as pd
import textdistance
from tqdm import tqdm
import tensorflow as tf
from random import choice
import matplotlib.pyplot as plt
from collections import Counter
from... | pd.read_csv(data_path + 'Train_Data.csv', encoding='utf-8') | pandas.read_csv |
import numpy as np
import pandas as pd
from tqdm import tqdm
import cv2
import pyfeats
from utils import Plaque
#%% Path & Name of Plaque
path = './data/'
labels = pd.read_excel(path+'labels.xlsx')
path_features = './results/features/'
IMG_NO = len(labels)
#%% Parameters
perc = 1 ... | pd.DataFrame(data=np_glrlm, index=names, columns=labels_glrlm) | pandas.DataFrame |
# -*- coding: utf-8 -*-
import io
import re
import demjson3
import pandas as pd
import requests
from zvt.api.utils import china_stock_code_to_id
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain import EtfStock, Etf
from zvt.recorders.consts import DEFAULT_SH_ETF_LIST_H... | pd.read_html(response.text, header=1) | pandas.read_html |
# coding=utf-8
"""New Credit Card Fraud Detection kernel.
Scaling and sub-sampling is being used.
"""
from sklearn.preprocessing import RobustScaler
from sklearn.model_selection import train_test_split, StratifiedKFold
import pandas as pd
from sklearn.metrics import confusion_matrix
from keras.models import Sequentia... | pd.concat([fraud_subsample, valid_subsample]) | pandas.concat |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
'''
bentoo-calltree-analyser.py - Bottleneck analysis based on calltree
This tool computes relative/absolute percentage for selected events based on
calltree structure.
'''
from __future__ import division
from builtins import map
from past.utils import old_div
import s... | pandas.read_sql_query(sql, conn0) | pandas.read_sql_query |
# Import libraries
import os
import sys
import anemoi as an
import pandas as pd
import numpy as np
import pyodbc
from datetime import datetime
import requests
import collections
import json
import urllib3
def return_between_date_query_string(start_date, end_date):
if start_date != None and end_date != None:
... | pd.read_sql(sql_query, self.conn) | pandas.read_sql |
#!/usr/bin/python3
import sys
input_shortnames = sys.argv[1:-1:2]
input_quast_csvs = sys.argv[2:-1:2]
output_file = sys.argv[-1]
from os import path
import pandas
df = pandas.DataFrame(columns = ["experiment", "x", "y"])
for shortname, quast_csv in zip(input_shortnames, input_quast_csvs):
frame = | pandas.read_csv(quast_csv, names=["x", "y"]) | pandas.read_csv |
"""Tests for the sdv.constraints.tabular module."""
import uuid
import numpy as np
import pandas as pd
import pytest
from sdv.constraints.errors import MissingConstraintColumnError
from sdv.constraints.tabular import (
Between, ColumnFormula, CustomConstraint, GreaterThan, Negative, OneHotEncoding, Positive,
... | pd.to_datetime(['2020-01-01T00:00:01', '2020-01-02T00:00:01']) | pandas.to_datetime |
# -*- coding: utf-8 -*-
"""
docstring goes here.
:copyright: Copyright 2014 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function
import unittest
from itertools import chain
from neo.test.generate_datasets import fake_neo
impo... | assert_frame_equal(targ, res2) | pandas.util.testing.assert_frame_equal |
# -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2019 - 2020
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en... | pd.read_csv(local_file, index_col=0) | pandas.read_csv |
# -*- coding: utf-8 -*-
"""
Automated Tool for Optimized Modelling (ATOM)
Author: Mavs
Description: Module containing utility constants, functions and classes.
"""
import logging
import math
import pprint
import sys
from collections import deque
from collections.abc import MutableMapping
from copy import copy
from d... | pd.api.types.is_sparse(df[col]) | pandas.api.types.is_sparse |
import streamlit as st
import pandas as pd
from simpletransformers.question_answering import QuestionAnsweringModel
from simpletransformers.streamlit.streamlit_utils import get, simple_transformers_model
QA_ANSWER_WRAPPER = """{} <span style="overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; paddi... | pd.DataFrame({"Answer": answers, "Confidence": probabilities}) | pandas.DataFrame |
from IMLearn.utils import split_train_test
from IMLearn.learners.regressors import LinearRegression
from typing import NoReturn
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
def load_data(filename: ... | pd.get_dummies(df, columns=['zipcode']) | pandas.get_dummies |
import pandas as pd
import abc
import numpy as np
from BPMN.TransformationStrategy import SelectRowsStrategy
# abstract base class
class CombineStrategy():
@abc.abstractclassmethod
def combine(self, df_1: pd.DataFrame, df_2: pd.DataFrame) -> pd.DataFrame:
pass
@abc.abstractclassmethod
def g... | pd.concat([df_1, df_2]) | pandas.concat |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from trueskill import Rating, rate
sns.set()
sns.set_style('white')
def get_cumulative_ranks_df(games, rolling_average_n=None):
results = []
rank_map = dict()
for game_number, game in enumerate(games):
# Update rankings
... | pd.DataFrame(results, columns=players) | pandas.DataFrame |
# Copyright 2018 <NAME>. All rights reserved.
#
# Licensed under the MIT license
"""
Script for panels of Figure S5 (Comparison with and structure of C elegans network)
"""
import core as c
import analysis as a
from global_defs import GlobalDefs
import os
import seaborn as sns
import matplotlib as mpl
import matplot... | DataFrame(rem_d) | pandas.DataFrame |
# %% Imports
import os
import glob
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
import seaborn as sns
from sklearn.linear_model import LinearRegression
from scipy.optimize import least_squares
from ruamel_yaml import Y... | pd.read_csv("https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv", header=0, index_col=1) | pandas.read_csv |
# -*- coding: utf-8 -*-
"""
Created on 2018-09-13
@author: <NAME>
"""
import numpy as np
import pandas as pd
CURRENT_ROUND = 38
# Load data from all 2018 rounds
# Data from https://github.com/henriquepgomide/caRtola
rounds = []
rounds.append(pd.read_csv('data/rodada-1.csv'))
rounds.append(pd.read_csv('2018/data/rod... | pd.read_csv('2018/data/rodada-24.csv') | pandas.read_csv |
import pandas as pd
import altair as alt
from typing import List
from gettext import NullTranslations
def calculate_positive_tests_ratio(
df: pd.DataFrame, lang: NullTranslations
) -> pd.DataFrame:
"""
Calculates new column that is the new positive to tests ratio
"""
_ = lang.gettext
daily_te... | pd.concat(regions_raw) | pandas.concat |
#%load_ext autoreload
#%autoreload 2
import dataclasses
import glob
import logging
import os
import shutil
import warnings
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Dict, List, Optional, Tuple
import numpy as np
import pandas as pd
from scipy.sparse.csr import csr_m... | pd.DataFrame([["no anomaly found"]]) | pandas.DataFrame |
import os
import numpy as np
import pandas as pd
from pkg_resources import resource_filename
def load_arrests(return_X_y=False, give_pandas=False):
"""
Loads the arrests dataset which can serve as a benchmark for fairness. It is data on
the police treatment of individuals arrested in Toronto for simple po... | pd.DataFrame({"yt": result}) | pandas.DataFrame |
from copy import copy, deepcopy
from textwrap import dedent
try:
import cPickle as pickle
except ImportError:
import pickle
import numpy as np
import pandas as pd
from xray import (align, concat, conventions, backends, Dataset, DataArray,
Variable, Coordinate)
from xray.core import indexing,... | pd.date_range('20100101', periods=3) | pandas.date_range |
import networkx as nx
import numpy as np
import pandas as pd
from quetzal.analysis import analysis
from quetzal.engine import engine, nested_logit
from quetzal.engine.park_and_ride_pathfinder import ParkRidePathFinder
from quetzal.engine.pathfinder import PublicPathFinder
from quetzal.engine.road_pathfinder import Road... | pd.MultiIndex.from_product([zones, zones]) | pandas.MultiIndex.from_product |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
description: provide 24hr feedback to clinicians
version: 0.0.1
created: 2018-08-01
author: <NAME>
dependencies:
* requires tidepool-analytics-env (see readme for instructions)
* requires a clinician or study username (email) and password
* requires tidals ... | pd.concat([allStats, stats], ignore_index=True, sort=False) | pandas.concat |
# -*- coding: utf-8 -*-
import datetime as dt, IPython, pandas as pd, pyarrow as pa, pytest, requests, unittest
from builtins import object
from common import NoAuthTestCase
import graphistry
from mock import patch
triangleEdges = pd.DataFrame({'src': ['a', 'b', 'c'], 'dst': ['b', 'c', 'a']})
triangleNodes = pd.Da... | pd.DataFrame({'s': [0], 'd': [0]}) | pandas.DataFrame |
from caes import ICAES2
import pandas as pd
from joblib import Parallel, delayed, parallel_backend
import time
import os
from datetime import datetime
# =====================
# function to enable sensitivity analysis
# =====================
def sizing_and_sensitivity(wrkdir, xlsx_filename, sheet_name, capacity, durat... | pd.Series() | pandas.Series |
"""
UTZappos processing.
"""
import os
import pandas as pd
from collections import Counter
import torch
def parse_split(root, split):
def parse_pairs(pair_list):
with open(pair_list, 'r') as f:
pairs = f.read().strip().split('\n')
pairs = [t.split() for t in pairs]
p... | pd.DataFrame.from_dict(val) | pandas.DataFrame.from_dict |
import os
import pandas
import numpy as np
import warnings
from . import io
__all__ =["get_target_lightcurve"]
ZTFCOLOR = { # ZTF
"p48r":dict(marker="o",ms=7, mfc="C3"),
"p48g":dict(marker="o",ms=7, mfc="C2"),
"p48i":dict(marker="o",ms=7, mfc="C1")
}
BAD_ZTFCOLOR = { # ZTF
"p48r"... | pandas.concat(results, keys=filters) | pandas.concat |
from tkinter import *
from random import choice
import pandas
BACKGROUND_COLOR = "#B1DDC6"
to_learn = {}
word = {}
# ---------------------------- PANDAS LOGIC ------------------------------- #
try:
data = | pandas.read_csv("./data/words_to_learn.csv") | pandas.read_csv |
from os import times
import locale
from datetime import date, datetime, timedelta, timezone
import time
import requests
from tqdm import tqdm
import pandas as pd
import urllib.request
import os
locale.setlocale(locale.LC_ALL, "it_IT.UTF-8")
DAYNAMES = {
0: "lunedi",
1: "martedi",
2: "mercoledi",
3: "... | pd.DataFrame(results) | pandas.DataFrame |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 08:02:39 2020
@author: <NAME>
"""
#Standard packages
import os
import numpy as np
import pandas as pd
#Sklearning package
from sklearn.preprocessing import MinMaxScaler
#Graphics packages
from matplotlib import pyplot as plt
from matplotlib.co... | pd.read_csv(best_path) | pandas.read_csv |
import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
def load_data():
here = os.path.realpath(__file__)
here = os.path.dirname(here)
fn = os.path.join(here, 'monthly-milk-production.csv')
return pd.read_csv(fn, index_col='Month')
def clean_data(df):
# c... | pd.to_datetime(df.index) | pandas.to_datetime |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 4 2021, last edited 27 Oct 2021
Fiber flow emissions calculations module - class version
Inputs:
Excel file with old PPI market & emissions data ('FiberModelAll_Python_v3-yields.xlsx')
Outputs:
Dict of keys 'old','new','forest','trade' with emissions calcs
... | pd.Series(oldProd['bioCO2'] + oldRsdl['bioImp'], name='g2gbio') | pandas.Series |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 7 15:50:55 2020
@author: Emmett
"""
import nltk
nltk.download('stopwords')
nltk.download('wordnet')
import LDA_Sampler
import string
import copy
import pandas as pd
import numpy as np
import keras.backend as K
import matplotlib.pyplot as plt
import tens... | pd.DataFrame(comments_predict) | pandas.DataFrame |
import matplotlib
#matplotlib.use("qt4agg")
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.patches import Ellipse
import seaborn as sns
from matplotlib.path import Path
import os
#plt.ion()
#plt.show(block=False)
'''
SMALL_SIZE = 8
MEDIUM_SIZE = 10
BIGGER_SIZE = 12
plt.rc('fon... | pd.isna(mean_pts['y']) | pandas.isna |
# License: Apache-2.0
import databricks.koalas as ks
import pandas as pd
import numpy as np
import pytest
from pandas.testing import assert_frame_equal
from gators.imputers.numerics_imputer import NumericsImputer
from gators.imputers.int_imputer import IntImputer
from gators.imputers.float_imputer import FloatImputer
f... | pd.DataFrame({'A': [0, 1, np.nan]}) | pandas.DataFrame |
import os
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
import pandas as pd
from pyqmc.mc import vmc, initial_guess
from pyscf import gto, scf
from pyqmc.reblock import reblock
from pyqmc.slater import Slater
from pyqmc.accumulators i... | pd.DataFrame(df) | pandas.DataFrame |
import pandas as pd
import numpy as np
from web_constants import *
from signatures import Signatures, get_signatures_by_mut_type
from project_data import ProjectData, get_selected_project_data
def compute_counts(chosen_sigs, projects, mut_type, single_sample_id=None, normalize=False):
signatures = get_signature... | pd.DataFrame(index=samples, columns=[]) | pandas.DataFrame |
import itertools
import numba as nb
import numpy as np
import pandas as pd
import pytest
from sid.contacts import _consolidate_reason_of_infection
from sid.contacts import _numpy_replace
from sid.contacts import calculate_infections_by_contacts
from sid.contacts import create_group_indexer
@pytest.mark.unit
@pytest.... | pd.Series([-1] + [0] * 3 + [-1] * 4, dtype="int8") | pandas.Series |
import os
import pandas as pd
def print_best(result_dir):
res = | pd.DataFrame() | pandas.DataFrame |
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_integer
import pandas as pd
from pandas import (
Series,
Timestamp,
date_range,
isna,
)
import pandas._testing as tm
def test_where_unsafe_int(any_signed_int_numpy_dtype):
s = Ser... | tm.assert_series_equal(s, expected) | pandas._testing.assert_series_equal |
# third party import
import pytest
from os import path
import pandas as pd
# module import
from dependencynet.model import ModelBuilder
from dependencynet.core.model.tree_model import TreeModelBuilder
@pytest.fixture
def source_data_towns(schema_towns, compact_columns_towns):
filename = path.join('tests', 'res... | pd.DataFrame(data, columns=compact_columns_towns) | pandas.DataFrame |
from abc import ABC
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.tsa.statespace.sarimax import SARIMAX
# Construct the model
class StateSpaceModel(sm.tsa.statespace.MLEModel, ABC):
def __init__(self, endog, exog, factors_x, factors_y):
# Initialize the state space m... | pd.DataFrame(model.ssm['transition'], index=state_names, columns=state_names) | pandas.DataFrame |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | pd.to_datetime(value, format="%H:%M:%S%z") | pandas.to_datetime |
#!/usr/bin/env python3
#
# Copyright 2019 <NAME> <<EMAIL>>
#
# This file is part of Salus
# (see https://github.com/SymbioticLab/Salus).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | pd.Series(s, idx) | pandas.Series |
# -*- coding: utf-8 -*-
# Arithmetc tests for DataFrame/Series/Index/Array classes that should
# behave identically.
from datetime import timedelta
import operator
import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
from pandas.compat import long
from pandas.core import ops
from pan... | tm.box_expected(tdi, box) | pandas.util.testing.box_expected |
"""
Name: diffusion_functions
Purpose: Contains functions to calculate diffusion of distributed wind model
(1) Determine maximum market size as a function of payback time;
(2) Parameterize Bass diffusion curve with diffusion rates (p, q) set by
payback time;
(3) Determine current stage (equivaluen... | pd.merge(df, market_share_cap, how = 'left', on = ['county_id', 'bin_id', 'sector_abbr']) | pandas.merge |
from __future__ import print_function
import os, sys, pwd, json, pandas as pd, numpy as np, sqlite3, pwd, uuid, platform, re, base64, string,enum,shelve
import matplotlib as mpl
import matplotlib.cm
import requests
from datetime import datetime as timr
from rich import print as outy
from sqlite3 import connect
from glo... | pd.DataFrame.from_dict(dyct) | pandas.DataFrame.from_dict |
############################################################################
#Copyright 2019 Google LLC
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# https://www.apache.org/licen... | pd.to_datetime(train[date_var],infer_datetime_format=True) | pandas.to_datetime |
from collections import OrderedDict
from datetime import datetime, timedelta
import numpy as np
import numpy.ma as ma
import pytest
from pandas._libs import iNaT, lib
from pandas.core.dtypes.common import is_categorical_dtype, is_datetime64tz_dtype
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
Da... | date_range("20090415", "20090519", freq="B") | pandas.date_range |
import pickle
import pandas as pd
import numpy as np
crnn2_result = pickle.load(open('../../CRNN2/crnn_results/crnn_results_summary.p', 'rb'))
crnn4_result = pickle.load(open('../../CRNN4/crnn_results/crnn_results_summary.p', 'rb'))
crnn6_result = pickle.load(open('../../CRNN6/crnn_results/crnn_results_summary.p', '... | pd.DataFrame(lenet_pitch_shift) | pandas.DataFrame |
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import gc
import matplotlib.pyplot as plt
import seaborn as sns
import lightgbm as lgb
import logging
import itertools
from imblearn.over_sampling import SMOTE
from sklearn.model_selection import train_test_split
#modify to wor... | pd.get_dummies(y_true) | pandas.get_dummies |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.