prompt stringlengths 19 1.03M | completion stringlengths 4 2.12k | api stringlengths 8 90 |
|---|---|---|
# -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import shutil
import tempfile
import pytest
from ddf_utils.chef.api import Chef
from ddf_utils.chef.exceptions import IngredientError, ProcedureError, ChefRuntimeError
wd = os.path.dirname(__file__)
def chef_fn(fn):
return Chef.from_recip... | pd.DataFrame(x) | pandas.DataFrame |
import matplotlib.pyplot as plt
import pyVIA.examples as via#examples as via
import pandas as pd
import umap
import scanpy as sc
import numpy as np
import warnings
def run_Toy_multi(foldername="Datasets/"):
via.main_Toy(ncomps=10, knn=30,dataset='Toy3', random_seed=2,foldername=foldername)
def run_Toy_discon(fo... | pd.read_csv(foldername + "toy_disconnected_M9_n1000d1000_ids.csv", delimiter=",") | pandas.read_csv |
import turtle
import pandas
screen = turtle.Screen()
screen.title("US States Game")
image = "blank_states_img.gif"
screen.addshape(image)
turtle.shape(image)
data = | pandas.read_csv("50_states.csv") | pandas.read_csv |
import pandas as pd
import instances.dinamizators.dinamizators as din
import math
def simplest_test():
'''
Test if the dinamizators are running
'''
df = (
pd.read_pickle('./instances/analysis/df_requests.zip')
.reset_index()
)
din.dinamize_as_berbeglia(df.pickup_location_x_co... | pd.Series([1, 2, 3]) | pandas.Series |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from FileUtil import FileUtil
from Util import Util
from constants import Constants
from pathlib import Path
import scipy.stats as stats
import seaborn as sns
import stats.CliffDelta as cld
from scipy import stats
class SLOCSelection:
def __i... | pd.DataFrame.from_dict(result) | pandas.DataFrame.from_dict |
#!/usr/bin/python3
import sys
import os
import shutil
import csv
import zipfile
import pandas as pd
import glob
infile = sys.argv[1]
outfile = sys.argv[2]
# remove holding_folder if it exists, and create new folder
# use 'rm -r /holding_folder/* in shell script instead?'
holding_path = '/media/secure_volume/holding_... | pd.read_table(infile) | pandas.read_table |
import glob
import os
import sys
import numpy
import pandas
#METADATA_FILENAME = "20220121 Overview CG plates and compounds _small.xlsx"
METADATA_FILENAME = sys.argv[1]
## if you want to evaluate only a single imaging, do like this:
# QUERY = "`imaging campaign ID` == 'CQ1-ctf004-t12'"
## if you want to select all i... | pandas.read_excel(METADATA_FILENAME, sheet_name=f"compound map {see}") | pandas.read_excel |
#-coding: utf-8 -*-
# tools
import pandas as pd
import numpy as np
# interfacedb
from . import interfacedb
# datetime
import datetime
class HomeView:
DATE_TIME_COL = 'datetime'
MATCH_STATUS = 'status' # etat du match
# started
# nostarted
STARTED... | pd.to_datetime(self.metadata[matchs_table.date]) | pandas.to_datetime |
# Bellfort Sequence Parser
## Modules
import numpy as np
import pandas as pd
import tkinter as tk
from tkinter import ttk
import tkinter.font as tkf
from tkinter import messagebox
from tkinter import filedialog
import threading
import time
import os
import shutil
## Helper Functions
### Reverse Complement
def rever... | pd.DataFrame(arr, columns = ['gene_id', 'UID', 'seq', 'Reserved', 'Count', 'Tag']) | pandas.DataFrame |
# Copyright 2021 The QUARK Authors. 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 applic... | pd.api.types.is_string_dtype(df.applicationConfigCombo.dtype) | pandas.api.types.is_string_dtype |
#
# Copyright (C) 2019 Databricks, Inc.
#
# 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 agreed to i... | CategoricalDtype(["b", "c", "a"]) | pandas.api.types.CategoricalDtype |
# ClinVarome annotation functions
# Gather all genes annotations : gene, gene_id,
# (AF, FAF,) diseases, clinical features, mecanismes counts, nhomalt.
# Give score for genes according their confidence criteria
# Commented code is the lines needed to make the AgglomerativeClustering
import pandas as pd
import numpy as ... | pd.read_csv(compare_variant, sep="\t", compression="gzip") | pandas.read_csv |
import re
import numpy as np
import pandas as pd
from arc._common import prob_metric_cal
import matchzoo as mz
from arc.anmm_impl import anmm_train
from arc.arci_impl import arci_train
from arc.arcii_impl import arcii_train
from arc.bimpm_impl import bimpm_train
from arc.cdssm_impl import cdssm_train
from arc.conv_k... | pd.Series(text_right_list) | pandas.Series |
"""Personal Challenge_Draft.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1-25-B3CO6yVCH9u2vgbhIjyyFeU3tJ3w
"""
# Working environment set up
import pandas as pd
from sklearn.metrics import accuracy_score
from sklearn.feature_extraction.text imp... | pd.Series(estimated_accuracy) | pandas.Series |
import pandas as pd
import numpy as np
import scipy
import os, sys, time, json, math
import matplotlib.pyplot as plt
import seaborn as sns
from functools import reduce
from os.path import join
from datetime import datetime
from scipy.integrate import odeint
from numpy import loadtxt
from scipy.optimize import minimize
... | pd.isnull(Cchol0) | pandas.isnull |
import numpy as np
import pandas as pd
from postproc_utils import rmse_masked, nse
def test_rmse_masked():
y_true = pd.Series([1, 5, 3, 4, 2])
y_pred = y_true.copy()
err = rmse_masked(y_true, y_pred)
assert err == 0
y_pred = pd.Series([0, 0, 0, 0, 0])
err = rmse_masked(y_true, y_pred)
ass... | pd.Series([2, 4, 0, 4, 2]) | pandas.Series |
from pathlib import Path
from itertools import chain
from lxml import etree
from django.db import models
from django.db.models import F
from django.db.models import Max, Min, Sum
from django.shortcuts import render
from django.urls import reverse
from polymorphic.models import PolymorphicModel
import numpy as np
impo... | pd.DataFrame(data, columns=columns) | pandas.DataFrame |
from ..heuristics.spacy_base import SpacyModel
from sklearn.base import BaseEstimator, TransformerMixin
from tqdm import tqdm
import pandas as pd
from attrdict import AttrDict
class Tokenizer(BaseEstimator, TransformerMixin):
def __init__(self, tokenizer):
self.tokenizer = SpacyModel(tokenizer)
... | pd.concat([X[cols], res], axis=1) | pandas.concat |
"""
Measuring the performance of key functionality.
:author: <NAME>
"""
import functools
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path
from time import perf_counter
import klib
# Paths
base_path = Path(__file__).resolve().parents[2]
print(base_path)
data_path = base_path / "examples"
... | pd.read_csv(filepath) | pandas.read_csv |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101,W0612
from datetime import datetime, timedelta
import pytest
import re
from numpy import nan as NA
import numpy as np
from numpy.random import randint
from pandas.compat import range, u
import pandas.compat as compat
from pandas import Index, Series, DataFrame, isn... | tm.assert_almost_equal(result, exp) | pandas.util.testing.assert_almost_equal |
#!/usr/bin/env python
# coding=utf-8
# vim: set filetype=python:
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import os
import posixpath
import sys
import math
import datetime
import string
from functools import wraps
import traceback
import xlrd3 as xl... | pd.merge(left_frame, right_frame, left_on=left_on, right_on=right_on, how='outer') | pandas.merge |
"""
Area Weighted Interpolation
"""
import numpy as np
import geopandas as gpd
from ._vectorized_raster_interpolation import _fast_append_profile_in_gdf
import warnings
from scipy.sparse import dok_matrix, diags, coo_matrix
import pandas as pd
from tobler.util.util import _check_crs, _nan_check, _inf_check, _check_p... | pd.DataFrame(extensive.T, columns=extensive_variables) | pandas.DataFrame |
import itertools
import numpy as np
import pandas as pd
def F_score(v, y_label):
x_0 = 0
x_1 = 0
v_pos = v[y_label > 0]
v_neg = v[y_label <= 0]
v_ave = np.mean(v)
v_pos_ave = np.mean(v_pos)
v_neg_ave = np.mean(v_neg)
len_pos = len(v_pos)
len_neg = len(v_neg)
... | pd.DataFrame(tra_positive_seq) | pandas.DataFrame |
#-*- coding: utf-8 -*-
import sys
import random
import numpy as np
import pandas as pd
import utility_1
import h5py
import json
eps=1e-12
def countCG(strs):
strs = strs.upper()
return float((strs.count("C")+strs.count("G")))/(len(strs))
def countCG_N(strs):
strs = strs.upper()
return float((strs.count("C")+strs... | pd.read_csv(filename2,sep='\t') | pandas.read_csv |
import pandas as pd
# which 10 subjects do we want to clean data for?
subjects = ['DE220', 'DE221', 'DE222', 'DE223', 'DE224', 'DE225', 'DE226', 'DE227', 'DE228', 'DE229', 'DE230']
for sub in subjects:
# let's add in a note so we know which subject is being worked on
print('Working on ', sub)
# ... | pd.read_csv(f'/Users/lizbeard/Desktop/intro-to-coding-2021/misc/logs/{k}/{k}_ebdm_run_2.csv') | pandas.read_csv |
from pathlib import Path
import click
import feather
import pandas as pd
from dotenv import find_dotenv
from dotenv import load_dotenv
from scipy.io import arff
from src.utils.logger import info
from src.utils.logger import init_logger
def make_dataset(name):
"""Runs data processing scripts to turn raw data fro... | pd.read_csv(input_file_test, header=None) | pandas.read_csv |
# Created on 2020/7/15
# This module is for the class TimeSeries and related functions.
# Standard library imports
from datetime import datetime
from typing import Any, Callable, Optional, Union
import warnings
# Third party imports
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytz
i... | pd.DataFrame(index=delta.data.index, data=tick_imb_data) | pandas.DataFrame |
# Necessary libraries
import pandas as pd
import re
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.graph_objs as go
import plotly.offline as py
from statsmodels.stats.outliers_influence import variance_inflation_factor
from sklearn.model_selection import train_test_split
from sklearn.preprocessin... | pd.read_csv("zomato.csv") | pandas.read_csv |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_checklist_scenariobased_step01 [<img src="https:/... | pd.Series(v_tinit[n]) | pandas.Series |
# script that builds on the column diagnostic code to rename cols as needed in order to to reconcile across years and then rowbinds the 2014-2021 datasets.
# load necessary packages
import pandas as pd
import openpyxl as openpyxl
import os
from os import listdir
from pathlib import Path
import re
import numpy as np
... | pd.read_excel(DROPBOX_RAW_PATH + file) | pandas.read_excel |
import datetime
import logging
import coloredlogs
import pandas as pd
from common import right_form_from_number
coloredlogs.install()
logging.basicConfig(level=logging.DEBUG)
tea = pd.read_csv(
open("Концерты Чайковский.csv", "r", encoding="utf-8"),
encoding="utf-8",
parse_dates=[1, 2],
)
rah = pd.read... | me(res["дата, гггг-мм-дд"]) | pandas.to_datetime |
"""The Model class is the main object for creating model in Pastas.
Examples
--------
>>> oseries = pd.Series([1,2,1], index=pd.to_datetime(range(3), unit="D"))
>>> ml = Model(oseries)
"""
from collections import OrderedDict
from copy import copy
from inspect import isclass
from logging import getLogger
from os im... | pd.Timestamp(tmin) | pandas.Timestamp |
import datetime
import hashlib
import os
import time
from warnings import (
catch_warnings,
simplefilter,
)
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
timedelt... | ensure_clean_path(setup_path) | pandas.tests.io.pytables.common.ensure_clean_path |
# '''
# (c) REACT LAB, Harvard University
# Author: <NAME>
# '''
#!/usr/bin/env python3
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import json
import glob, os
import seaborn as sns
import numpy as np
import argparse
SMALL_SIZE = 8
MEDIUM_SIZE = 10
BIGGER_SIZE = 12
plt.rc('font', size... | pd.DataFrame.from_dict(data_json, orient="index") | pandas.DataFrame.from_dict |
import pandas as pd
def merge_sets(alexa_set, dga_set):
# Concatenate the domains
merged = pd.concat([alexa_set, dga_set], ignore_index=True)
return merged
if __name__ == '__main__':
import argparse
import os
parser = argparse.ArgumentParser('merge_sets.py')
parser.add_argument('alexa_set', help='Alexa set')
... | pd.read_pickle(args.dga_set) | pandas.read_pickle |
# coding: utf-8
# # Extract Load and Dispatch Signals
# Data from AEMO's MMSDM database are used to construct historic load and dispatch signals. To illustrate how these signals can be constructed we extract data for one month as a sample. As the schema is the same for all MMSDM files, signals from different peri... | pd.to_datetime(df_DISPATCH_UNIT_SCADA['SETTLEMENTDATE']) | pandas.to_datetime |
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/04_Create_Acs_Indicators_Original.ipynb (unless otherwise specified).
__all__ = ['racdiv', 'pasi', 'elheat', 'empl', 'fam', 'female', 'femhhs', 'heatgas', 'hh40inc', 'hh60inc', 'hh75inc',
'hhchpov', 'hhm75', 'hhpov', 'hhs', 'hsdipl', 'lesshs', 'male', 'n... | pd.DataFrame() | pandas.DataFrame |
import json
import os
import subprocess
import h5py
import uuid
from installed_clients.KBaseReportClient import KBaseReport
from installed_clients.DataFileUtilClient import DataFileUtil
from pprint import pprint
from shutil import copy
import subprocess
import matplotlib.pyplot as plt
import numpy as np
import pandas a... | pd.isnull(rxn_df.iloc[irow,icol]) | pandas.isnull |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 13:52:36 2020
@author: diego
"""
import os
import sqlite3
import numpy as np
import pandas as pd
import plots as _plots
import update_prices
import update_companies_info
pd.set_option("display.width", 400)
pd.set_option("display.max_columns", 10)
pd.options.mode.chai... | pd.concat([statistics, df], axis=0) | pandas.concat |
# License: Apache-2.0
from gators.encoders.target_encoder import TargetEncoder
from pandas.testing import assert_frame_equal
import pytest
import numpy as np
import pandas as pd
import databricks.koalas as ks
ks.set_option('compute.default_index_type', 'distributed-sequence')
@pytest.fixture
def data():
X = pd.Da... | assert_frame_equal(X_new, X_expected) | pandas.testing.assert_frame_equal |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from mabwiser.mab import MAB, LearningPolicy, NeighborhoodPolicy
from tests.test_base import BaseTest
class MABTest(BaseTest):
#################################################
# Test context fr... | pd.Series([0, 0, 0, 0, 0, 0, 1, 1, 1]) | pandas.Series |
# Package import
from __future__ import print_function, division
from warnings import warn
from nilmtk.disaggregate import Disaggregator
import os
import pickle
import pandas as pd
import numpy as np
from collections import OrderedDict
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split... | pd.DataFrame(new_mains) | pandas.DataFrame |
# -*- coding: utf-8 -*-
import unittest
import pandas as pd
import pandas.testing as tm
import numpy as np
from pandas_xyz import algorithms as algs
class TestAlgorithms(unittest.TestCase):
def test_displacement(self):
"""Test out my distance algorithm with hand calcs."""
lon = pd.Series([0.0, 0.0, 0.0... | pd.Series([0, 1, 1]) | pandas.Series |
import os
import time
from collections import OrderedDict, defaultdict
import numpy as np
from scipy.stats import entropy as KL
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['agg.path.chunksize'] = 100000
import matplotlib.pyplot as plt
from matplotlib import cm
import seaborn as sns
import pandas as p... | pd.DataFrame({'x': losses, 'y': influences}) | pandas.DataFrame |
import numpy as np
import pandas as pd
from multiprocessing import Pool
class Neighborhood:
_names = {}
_namemap = {}
# We don't expect for there to be a large quantity of Neighborhoods.
# Therefore, this class isn't designed with efficiency in mind
# per se.
def __init__(self):
pass
... | pd.DataFrame(index=index) | pandas.DataFrame |
import numpy as np
import pandas as pd
import pdb
import os
import shutil
import argparse
from matplotlib import pyplot as plt
from scipy.io import loadmat, savemat
from sklearn.metrics import roc_curve
from sklearn.metrics import roc_auc_score
from utils import metric_scores
from utils import load_config_file, ucf_c... | pd.DataFrame(gt_list) | pandas.DataFrame |
# Librerias standard
import pandas as pd
from statsmodels.distributions.empirical_distribution import ECDF
from scipy.stats import gamma
import numpy as np
import pystan
import pickle
from matplotlib import pyplot as plt
import arviz as az
from datetime import datetime
from datetime import timedelta
# funcion... | pd.DataFrame(out['alpha'], columns=plot_labels) | pandas.DataFrame |
##############################################################################################################
# This script reads in the two gold standards Litbank and Dekker et al and compares them to
# the .token files created by booknlp
# The data used here consists of only the 12 overlapping novels with their resp... | pd.read_csv(litbank_filepath, sep='\t', quoting=csv.QUOTE_NONE, usecols=[0,1], names=["original_word", "gs"]) | pandas.read_csv |
"""
@name: syn_size_violoin.py
@description:
plot distribution of synapse sizes
@author: <NAME>
@email: "cabrittin"+ <at>+ "gmail"+ "."+ "com"
@date: 2020-03
"""
import os
import argparse
from configparser import ConfigParser,ExtendedInterpolation
import pandas as pd
import seaborn as sns
import matplotlib.pyplot... | pd.DataFrame(data=chem,columns=['delta','# EM sections','Data source']) | pandas.DataFrame |
#!/usr/bin/env python3
import subprocess, os,time,gzip
import pandas as pd
import numpy as np
from functools import reduce
from .convertor import mergeToSample, calTNzcore, rmEntrez, tpmToFpkm, mapEm2Gene, formatClin, pick,formatDrug
from .outformat import storeData
import requests,json,re,io
from .setting import CLIN... | pd.read_table(temp_file, **kwargs) | pandas.read_table |
# Numpy Arrays;
# Numpy arrays are great alternatives to Python Lists. Some of the key advantages of Numpy arrays are that
# they are fast, easy to work with, and give users the opportunity to perform calculations across entire arrays.
import numpy as np
height = [1.87, 1.87, 1.82, 1.91, 1.90, 1.85]
weight = [81.65... | pd.DataFrame(dict) | pandas.DataFrame |
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.base.base import BaseExtensionTests
class BaseGroupbyTests(BaseExtensionTests):
"""Groupby-specific tests."""
def test_grouping_grouper(self, data_for_grouping):
df = pd.DataFrame(
{"A"... | tm.assert_index_equal(result, expected) | pandas._testing.assert_index_equal |
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import overhang.tree as tree
import overhang.reaction_node as node
import logging
from overhang.dnastorage_utils.system.dnafile import *
import os
import sys
import shutil
import math
import numpy as np
import overhang.plot_utils.plot_utils as plt_... | pd.read_csv(root_prefix+'1_bit_opt_to_no_opt_'+category+'.csv',index_col=0) | pandas.read_csv |
import string
import random
import pathlib
import numpy as np
import pandas as pd
from scipy import stats
path = pathlib.Path(
'~/dev/python/python1024/data/dataproc/006analysis/case').expanduser()
shop_path = path.joinpath('店铺基本数据.xlsx')
# 产品列表
product_list = [f'产品{c}' for c in string.ascii_uppercase]
# 产品价格/成本列... | pd.concat(df_order_all, ignore_index=True) | pandas.concat |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import pandas
from pandas.compat import string_types
from pandas.core.dtypes.cast import find_common_type
from pandas.core.dtypes.common import (
is_list_like,
is_numeric_dtype,
... | pandas.DataFrame(series_result) | pandas.DataFrame |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
from functools import reduce
import pickle
import os
import pymssql
from virgo import market
startDate_default = '20060101'
endDate_default = (datetime.now() + timedelta(days=-1)).strftime('%Y%m%d')
# endDate_defau... | pd.notnull(data.OutDate) | pandas.notnull |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2021/4/29 14:30
Desc: 基金数据-新发基金-新成立基金
http://fund.eastmoney.com/data/xinfound.html
"""
import pandas as pd
import requests
from akshare.utils import demjson
def fund_em_new_found() -> pd.DataFrame:
"""
基金数据-新发基金-新成立基金
http://fund.eastmoney.com/data/x... | pd.DataFrame(data_json["datas"]) | pandas.DataFrame |
import decimal
import math
import warnings
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from decimal import Decimal, localcontext
from itertools import repeat
from pathlib import Path
from time import time
from typing import List, Optional, Union
import numpy as np
import pandas as pd
from tq... | pd.DataFrame(ssn_outcomes, columns=["L_RAND"]) | pandas.DataFrame |
'''Original implementation at https://github.com/wangtongada/BOA
'''
import itertools
import operator
import os
import warnings
from os.path import join as oj
from bisect import bisect_left
from collections import defaultdict
from copy import deepcopy
from itertools import combinations
from random import sample
impor... | pd.concat([df, dfn], axis=1) | pandas.concat |
from services.SingletonMeta import SingletonMeta
import pandas as pd
import numpy as np
import jenkspy
import joblib
from sklearn import linear_model
import os
class EtlService(metaclass=SingletonMeta):
def setEda(self, eda):
self.eda = eda
def readDataSource(self):
filename = os.path.dirname(... | pd.cut(data[feature['name']], bins=outlierData['breaks'], labels=outlierData["labels"], include_lowest=True) | pandas.cut |
import os # isort:skip
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import numpy as np
import pandas as pd
import tensorflow as tf
from scipy import stats
from tensorflow.keras.layers import (
Activation,
Conv2D,
Dense,
Dropout,
Flatten,
MaxPooling2D,
)
from tensorflow.keras.models import Sequent... | pd.read_hdf(dataset.hdf, key=p) | pandas.read_hdf |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | testing.assert_frame_equal(output, expected) | pandas.testing.assert_frame_equal |
import h5py
import numpy as np
import pandas as pd
from PIL import Image
from sklearn.datasets import make_blobs
from sklearn.metrics import log_loss
from sklearn.preprocessing import MinMaxScaler
# ----------------------------------------------------------------------
# Preprocess data
# ---------------------------... | pd.DataFrame(data=train_y[0], columns=['yt']) | pandas.DataFrame |
from io import StringIO
from copy import deepcopy
import numpy as np
import pandas as pd
import re
from glypnirO_GUI.get_uniprot import UniprotParser
from sequal.sequence import Sequence
from sequal.resources import glycan_block_dict
# Defining important colume names within the dataset
sequence_column_name = "Peptide... | pd.read_excel(r["filename"], sheet_name="Spectra") | pandas.read_excel |
import argparse
import os
import pickle
import random
import time
import matplotlib.pyplot as plt
import numpy as np
import ot
import pandas as pd
import pyabc
import utils
from scipy.stats import invgamma
np.random.seed(1)
random.seed(1)
def distance_fn(type, k=2, m=32):
if type == "bombOT":
return l... | pd.DataFrame({"post_samples": post_samples}) | pandas.DataFrame |
#!/usr/bin/env python3
# compare event timing from adult raters with event timing from children raters
import numpy as np
import pandas as pd
from settings import *
def get_boundaries(df,agedf):
PartIDs = np.array(df.loc[df['Screen Name'] == 'Desc_Me']['Participant Public ID'].value_counts()[df.loc[df['Screen Name'... | pd.read_csv('data_exp_68194-v4/data_exp_68194-v4_questionnaire-xtqr.csv') | pandas.read_csv |
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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.concat(inputs, axis=op.axis) | pandas.concat |
import os
import pickle
import pandas as pd
from . import feature_selection
PATRIC_FILE_EXTENSION_TO_PGFAM_COL = {'.txt' : 'pgfam', '.tab' : 'pgfam_id'}
GENOME_ID = 'Genome ID'
LABEL = 'Label'
HP = 'HP'
NHP = 'NHP'
def read_merged_file(file_path):
"""
Reads genomes merged file into pd.Series object
Para... | pd.Series(genomes_pgfams, index=genomes_ids, dtype="string") | pandas.Series |
"""This module containts the Universe class.
It can be used to group and manage descriptive, fundamental, and price data
for a number of equities.
"""
import pathlib
import tablib
import pandas as pd
import equities.utils
class Universe:
"""Represents a universe of equities."""
SUPPORTED_STORAGE_FORMATS = ... | pd.DataFrame() | pandas.DataFrame |
# -*- coding: utf-8 -*-
# pylint: disable-msg=W0612,E1101
import itertools
import warnings
from warnings import catch_warnings
from datetime import datetime
from pandas.types.common import (is_integer_dtype,
is_float_dtype,
is_scalar)
from pandas.compat... | DataFrame() | pandas.core.api.DataFrame |
import os
import copy
import datetime
import numpy as np
import xarray as xr
import pandas as pd
from collections import Counter
from ahh.ext import (round_to, get_order_mag, report_err, lonw2e)
from ahh.sci import get_stats, get_norm_anom, get_anom, get_norm
from ahh.era import td2dict
import matplotlib as mpl
import ... | pd.to_datetime(xlim) | pandas.to_datetime |
import pandas as pd
import numpy as np
def raw_to_no_missing():
df = pd.read_csv("compas-scores-two-years.csv")
# We will add two new features
df['in_custody'] = pd.to_datetime(df['in_custody'])
df['out_custody'] = | pd.to_datetime(df['out_custody']) | pandas.to_datetime |
"""
Collection of tests asserting things that should be true for
any index subclass. Makes use of the `indices` fixture defined
in pandas/tests/indexes/conftest.py.
"""
import re
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas.core.dtypes.common import is_period_dtype, needs_i8_conv... | tm.assert_index_equal(result_dropped, unique_idx) | pandas._testing.assert_index_equal |
"""scr_get_work_details
This script will export in a csv file one or several works from senscritique.
The -f option will use the "URL" field of a csv file.
Launch the script with the -h flag to see available options.
"""
import logging
import time
import argparse
import pandas as pd
from senscritiquescraper import Se... | pd.read_csv(file, sep="\t") | pandas.read_csv |
import pandas as pd
import no_transfer_linear, no_transfer_lstm
import global_linear_linear, global_linear_lstm, global_lstm_linear, global_lstm_lstm
import torch
import utils
import pickle
import numpy as np
import random
# data params
manualSeed = 999999999
np.random.seed(manualSeed)
random.seed(manualSe... | pd.DataFrame(df_train_ret, columns=df.columns) | pandas.DataFrame |
import pandas as pd
import numpy as np
from sklearn import linear_model
from itertools import combinations
from .stats import *
from functools import partial
import multiprocessing as mp
from tqdm import tqdm
def csRenameOrth(adQuery,adTrain,orthTable,speciesQuery='human',speciesTrain='mouse'):
_,_,cgenes=np.int... | pd.SparseDtype("int", 0) | pandas.SparseDtype |
import sys
import os
import numpy as np
from collections import Counter
import pandas as pd
from sklearn.metrics import auc
import chromHMM_utilities_common_functions_helper as helper
TRAIN_INDEX = 0
TEST_INDEX = 1
PRECISION_INDEX = 0
RECALL_INDEX = 1
PRECAL_HEADER_LIST = ["_precision", "_recall"]
PRECAL_AXIS_NAME_LIST... | pd.concat([first_row, result_df]) | pandas.concat |
#
# Gathers and processes relevant data from multiple apis and files
# and builds hydrodynamic lake model code as configured by the user.
#
# Basically just needs one coordinate within the target lake,
# model grid resolution and desired time interval.
#
# Required data sources:
# - NLS terrain database: (local) files ... | pandas.concat( [ gdf, gdf_all[gdf_all['LUOKKA']==classnumber][[attribute,'geometry']] ], axis = 0) | pandas.concat |
import datetime as dt
import gc
import json
import logging
import os
import pickle
from glob import glob
from typing import Dict, List, Optional, Tuple, Union
import h5py
import matplotlib as mpl
import matplotlib.dates as mdates
import matplotlib.gridspec as gs
import matplotlib.pyplot as plt
import numpy as np
impor... | pd.read_pickle(self.ann_df_path) | pandas.read_pickle |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# In[18]:
import requests
import json
from lxml import etree
from bs4 import BeautifulSoup
headers={
'Cookie':'SINAGLOBAL=5067277944781.756.1539012379187; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WFXAgGhhYE-bL1UlBNsI6xh5JpX5KMhUgL.Foqce0eN1h2cehB2dJLoIEXLxK-L1h5L... | pd.DataFrame(pro_cont,columns=['words']) | pandas.DataFrame |
import pandas as pd
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import pairwise_distances
from Levenshtein._levenshtein import distance as lev_distance
from sadie.airr import AirrTable, LinkedAirrTable
from typing import Union
import numpy as np
class Cluster:
"""Main clustering class... | pd.concat(cluster_catcher) | pandas.concat |
#!/usr/bin/env python
# coding: utf-8
#imports
import pandas as pd
from datetime import datetime, timedelta
import numpy as np
# date range
str_st = "2019-12-28"
str_en = "2021-01-30"
start_date = datetime.strptime(str_st,"%Y-%m-%d")
end_date = datetime.strptime(str_en,"%Y-%m-%d")
def date_range_str(start_date, end... | pd.DataFrame(columns=column_names) | pandas.DataFrame |
"""
.. module:: trend
:synopsis: Trend Indicators.
.. moduleauthor:: <NAME> (Bukosabino)
"""
import numpy as np
import pandas as pd
from ta.utils import IndicatorMixin, ema, get_min_max
class AroonIndicator(IndicatorMixin):
"""Aroon Indicator
Identify when trends are likely to change direction.
Ar... | pd.Series(vin, name='vin') | pandas.Series |
from abc import ABC, abstractmethod
from typing import List, Any, Dict
import pandas as pd
import numpy as np
from hdbscan import HDBSCAN, all_points_membership_vectors
from pydantic.main import BaseModel
from sklearn.neighbors import LocalOutlierFactor
from pyod.models.iforest import IForest
from pyod.models.hbos impo... | pd.read_pickle(self.path) | pandas.read_pickle |
'''
Script with Functions to
- clean Timeseries Data from ECA&D and save the cleaned Data as csv-file
- analyze Trend, Seasonaliyt and Remainder
- calculate the # of lags for an AutoReg Model
'''
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preproces... | pd.read_csv(csv_file, index_col=0, parse_dates=True) | pandas.read_csv |
import numpy as np
import pandas as pd
from rank_preferences import *
from correlations import *
from weighting_methods import *
from spotis import SPOTIS
from de import DE_algorithm
from visualization import *
def main():
# load dataset
filename = 'input/mobile_phones2000.csv'
data = | pd.read_csv(filename) | pandas.read_csv |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 18:29:04 2021
@author: danielgui
"""
import pandas as pd
import numpy as np
import transsim.xml2csv as xml2csv
import os
import dask.dataframe as dd
class Output_Processor:
def __init__(self):
pass
def generate(self, result_p... | pd.merge(busref, vehtype, on='actorConfig_id') | pandas.merge |
from copy import copy
from pandas import DataFrame, concat, notnull, Series
from typing import List, Optional
from survey.attributes import RespondentAttribute
class AttributeContainerMixin(object):
_attributes: List[RespondentAttribute]
@property
def data(self) -> DataFrame:
"""
Return... | Series(data=new_data, name=name) | pandas.Series |
"""
Utilities, accessible via subcommands.
"""
import datetime
import itertools
import json
import os
import re
import shutil
import sys
import click
import numpy as np
import pandas as pd
import vampire.common as common
from vampire import preprocess_adaptive
from vampire.gene_name_conversion import convert_gene_n... | pd.read_csv(path) | pandas.read_csv |
import pandas as pd
import matplotlib.pyplot as plt
from utils.constants import Teams
# Pandas options for better printing
| pd.set_option('display.max_columns', 500) | pandas.set_option |
import pytest
import pandas as pd
import numpy as np
from sugarplot import interpolate, normalize_pandas, normalize_reflectance, ureg
from pandas.testing import assert_frame_equal
def test_normalize_pandas_simple_multiply():
data1 = pd.DataFrame({
'Time (ms)': [0, 1, 2, 3, 4, 5],
'Current (... | assert_frame_equal(multiplied_data_actual, multiplied_data_desired) | pandas.testing.assert_frame_equal |
import tweepy
import pandas as pd
consumer_key= "XXX"
consumer_secret = "XXX"
access_token ="XXX"
access_token_secret= "XXX"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# authentication of access token and secret
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on... | pd.concat(frames) | pandas.concat |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/5/18 9:53 AM
# @Author : R
# @File : TMDB_predict_2.py
# @Software: PyCharm
# @Software: PyCharm
# coding: utf-8
# # Kaggle for TMDB
# In[1]:
import numpy as np
import pandas as pd
import warnings
from tqdm import tqdm
from sklearn.preprocessing... | pd.merge(test, release_dates, how='left', on=['id']) | pandas.merge |
# 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.api.types.is_numeric_dtype(x[x.columns[0]]) | pandas.api.types.is_numeric_dtype |
"""
Plot as-run river time series.
"""
from lo_tools import Lfun
from lo_tools import plotting_functions as pfun
import xarray as xr
import pandas as pd
import matplotlib.pyplot as plt
Ldir = Lfun.Lstart(gridname='cas6', tag='v3')
# load extraction (an xarray Dataset)
#fn = Ldir['LOo'] / 'pre' / 'river' / Ldir['gta... | pd.DataFrame(index=x.time.values) | pandas.DataFrame |
import json
import logging
import os
from pathlib import Path
import re
import yaml
import numpy as np
import pandas as pd
from biclust_comp.analysis import benchmarking
import biclust_comp.analysis.accuracy as acc
from biclust_comp import logging_utils, utils
DATASET_ORDER = [
"base",
"N50-T2",
"N10-T20... | pd.DataFrame(params_dicts) | pandas.DataFrame |
import pandas as pd
import numpy as np
import git
import os
import sys
import bokeh.io
import bokeh.application
import bokeh.application.handlers
import bokeh.models
import bokeh.plotting as bkp
from bokeh.models import Span
import holoviews as hv
from pathlib import Path
# from bokeh.io import export_png
#-- Setup... | pd.to_datetime(boundary) | pandas.to_datetime |
"""
Module containing classes, methods and functions related to queries to the ZAMG datahub.
"""
import pandas as pd
class ZAMGdatahubQuery:
"""
Attributes:
"""
def __init__(self,dataset,params,gridboxlabel,lat_min,lat_max,lon_min,lon_max,output="netcdf"):
dataset = dataset.uppe... | pd.read_table(file,index_col=0) | pandas.read_table |
import pandas as pd
import numpy as np
import pickle
import lap_v2_py3 as lap_v2
reprocess_new_basis = True
#Folder with data:
source_folder = '../Source_Data/'
dest_folder = '../Processed_Data/'
if reprocess_new_basis:
#Load in the conversion table
conv = pd.read_csv(source_folder+'ann.csv',usecols=[1,2],i... | pd.read_csv(source_folder+TimePoint+'/res.0.5.clusterAverages.tsv',sep='\t') | pandas.read_csv |
"""
Written by <NAME> for COMP9418 assignment 2.
"""
import copy
import re
import math
from collections import OrderedDict as odict
from itertools import product
from functools import reduce
import numpy as np
import pandas as pd
from graphviz import Digraph, Graph
from tabulate import tabulate
class GraphicalModel... | pd.concat(df_list, ignore_index=True) | pandas.concat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.