prompt
stringlengths
19
1.03M
completion
stringlengths
4
2.12k
api
stringlengths
8
90
# Copyright 2019-2020 The Lux Authors. # # 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...
pd.read_csv("https://github.com/lux-org/lux-datasets/blob/master/data/airbnb_nyc.csv?raw=true")
pandas.read_csv
from random import randint import pandas as pd import pytest import janitor # noqa: F401 import janitor.timeseries # noqa: F401 @pytest.fixture def timeseries_dataframe() -> pd.DataFrame: """ Returns a time series dataframe """ ts_index =
pd.date_range("1/1/2019", periods=1000, freq="1H")
pandas.date_range
# Copyright 2017-present, Bill & <NAME> Foundation # # 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 ...
pd.Series(data=["var", "var"], name='var_label')
pandas.Series
from datetime import date, datetime, timedelta from dateutil import tz import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, date_range import pandas._testing as tm class TestDatetimeIndex: def test_setitem_with_datetime_tz(self): # 168...
tm.assert_series_equal(result, expected)
pandas._testing.assert_series_equal
# -*- 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...
Series(['foo', 'bar', NA, 'baz'])
pandas.Series
import datetime as dt import os from datetime import datetime from typing import List, Tuple import numpy as np import pandas as pd from domain.demand_prediction_mode import DemandPredictionMode # random.seed(1234) np.random.seed(1234) # torch.manual_seed(1234) # torch.cuda.manual_seed_all(1234) # torch.backends.cu...
pd.concat(node_list)
pandas.concat
""" execution environment: cdips, + pipe-trex .pth file in /home/lbouma/miniconda3/envs/cdips/lib/python3.7/site-packages python -u paper_plot_all_figures.py &> logs/paper_plot_all.log & """ from glob import glob import datetime, os, pickle, shutil, subprocess import numpy as np, pandas as pd import matplotlib.pyplot ...
pd.read_csv(dfpath, sep=',')
pandas.read_csv
from datetime import datetime import pytest from pandas import ( DatetimeIndex, offsets, to_datetime, ) import pandas._testing as tm from pandas.tseries.holiday import ( AbstractHolidayCalendar, Holiday, Timestamp, USFederalHolidayCalendar, USLaborDay, USThanksgivingDay, get_c...
get_calendar("USFederalHolidayCalendar")
pandas.tseries.holiday.get_calendar
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
pandas.DataFrame(result)
pandas.DataFrame
# coding=utf-8 # Author: <NAME> # Date: June 17, 2020 # # Description: Calculates entropy-based on network PCA # # import numpy as np import pandas as pd pd.set_option('display.max_rows', 100) pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pandas.set_option
from qd.cae.dyna import D3plot import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # import holoviews as hv # from holoviews import dim, opts # # hv.extension('matplotlib') # ===============================================================...
pd.DataFrame(initial_shape, columns=['x', 'y', 'z'])
pandas.DataFrame
# Neural network for pop assignment # Load packages import tensorflow.keras as tf from kerastuner.tuners import RandomSearch from kerastuner import HyperModel import numpy as np import pandas as pd import allel import zarr import h5py from sklearn.model_selection import RepeatedStratifiedKFold, train_test_split from s...
pd.DataFrame(top_freqs["freq"])
pandas.DataFrame
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import sys import mlflow import mlflow.sklearn def eval_metrics(actual, pred): rmse = np.sqrt(mean_squared_error(actual, pred)) mae = mean_absolute_error(actual, pred) r2 = r2_score(actual, pred) ...
pd.get_dummies(ndf)
pandas.get_dummies
import numpy as np import pandas as pd from hotspot import sim_data from hotspot import Hotspot def test_models(): """ Ensure each model runs """ # Simulate some data N_CELLS = 100 N_DIM = 10 N_GENES = 10 latent = sim_data.sim_latent(N_CELLS, N_DIM) latent = pd.DataFrame( ...
pd.Series(umi_counts)
pandas.Series
# -*- coding: utf-8 -*- """Make a curation sheet for the bioregistry.""" import pandas as pd import bioregistry from bioregistry.constants import BIOREGISTRY_MODULE def descriptions(): """Make a curation sheet for descriptions.""" columns = [ "prefix", "name", "homepage", "d...
pd.DataFrame(rows, columns=columns)
pandas.DataFrame
import glob import os import sys # these imports and usings need to be in the same order sys.path.insert(0, "../") sys.path.insert(0, "TP_model") sys.path.insert(0, "TP_model/fit_and_forecast") from Reff_functions import * from Reff_constants import * from sys import argv from datetime import timedelta, datetime from ...
pd.to_datetime(df_forecast2_state_R_L.date)
pandas.to_datetime
from .get_tmy_epw_file import get_tmy_epw_file from .get_noaa_isd_lite_file import get_noaa_isd_lite_file from .meteorology import Meteorology from .analyze_noaa_isd_lite_file import analyze_noaa_isd_lite_file import tempfile import pandas as pd import numpy as np import os import pkg_resources from typing import Tupl...
pd.Timedelta("1h")
pandas.Timedelta
'''Perform clustering of single particle images based on their latent representations generated by cryoDRGN or cryoSPARC.''' import sys import os import pickle import numpy as np import pandas as pd import cryopicls def main(): args = cryopicls.args.clustering.parse_args() # Load particle metadata if ...
pd.Series(data=cluster_labels, name='cluster')
pandas.Series
from datetime import datetime import numpy as np import pandas as pd import pytest from numba import njit import vectorbt as vbt from tests.utils import record_arrays_close from vectorbt.generic.enums import range_dt, drawdown_dt from vectorbt.portfolio.enums import order_dt, trade_dt, log_dt day_dt = np.timedelta64...
pd.Index(['a', 'b', 'c', 'd'], dtype='object')
pandas.Index
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import pandas as pd import traceback as tb def json_to_eventlog(file_path): with open(file_path, "r", encoding = "utf-8") as f: data = json.load(f) f.close() game = [] player = [] color = [] move = [] timestamp_1 = []...
pd.DataFrame({"game":game, "player":player, "color":color, "move":move, "turn":timestamp_1})
pandas.DataFrame
import datetime as dt from functools import wraps from unittest import TestCase from unittest.mock import patch import numpy as np import numpy.testing as npt import pandas as pd from pandas.util.testing import assert_frame_equal from pandas.util.testing import assert_series_equal import seaice.nasateam as nt import ...
pd.Period('1978-11-01', freq='D')
pandas.Period
#!/usr/bin/env python # -*- coding: utf-8 -*- # # viewer.py - View aggregated i2p network statistics. # Author: <NAME> <<EMAIL>> # License: This is free and unencumbered software released into the public domain. # # NOTE: This file should never write to the database, only read. import argparse import datetime import m...
pd.read_sql_query(query, conn)
pandas.read_sql_query
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import pickle import shutil import sys import tempfile import numpy as np from numpy import arange, nan import pandas.testing as pdt from pandas import DataFrame, MultiIndex, Series, to_datetime # dependencies testing specific import pytest import recordlinka...
DataFrame({'col': [1, 1, 1, nan, nan]})
pandas.DataFrame
# -*- coding: utf-8 -*- ''' General toolboxs ''' import sys import time import inspect import numpy as np import pandas as pd from functools import reduce, wraps from random import randint, random, uniform from dramkit.logtools.utils_logger import logger_show from dramkit.speedup.multi_thread import SingleThread PY...
pd.DataFrame({'v': series})
pandas.DataFrame
# coding=utf-8 """ Module to apply a previously trained model to estimate the epigenome for a specific cell type in a different species """ import os as os import pandas as pd import numpy as np import numpy.random as rng import operator as op import multiprocessing as mp import json as json import pickle as pck fro...
pd.HDFStore(fpath, 'r')
pandas.HDFStore
# -*- 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...
Series(['a;b', 'a', 7])
pandas.Series
from __future__ import print_function from datetime import datetime, timedelta import numpy as np import pandas as pd from pandas import (Series, Index, Int64Index, Timestamp, Period, DatetimeIndex, PeriodIndex, TimedeltaIndex, Timedelta, timedelta_range, date_range, Float64Index...
tm.assert_index_equal(result, expected)
pandas.util.testing.assert_index_equal
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import os from config import test_snr_dB import pandas as pd from scipy.stats import ttest_1samp def plot_paper_results(folder_envtfs, folder_stft): sns.set(style="whitegrid") df_env = pd.read_csv('models\\' + folder_envtfs + ...
pd.concat([df_env1, df_env2, df_env3, df_env4, df_env5, df_env6])
pandas.concat
import numpy import pandas import operator import ema_workbench.analysis.prim from ..scope.box import Box, Bounds, Boxes from ..scope.scope import Scope from .discovery import ScenarioDiscoveryMixin from plotly import graph_objects as go class Prim(ema_workbench.analysis.prim.Prim, ScenarioDiscoveryMixin): def fi...
pandas.DataFrame( index=uncs, columns=['min','max'])
pandas.DataFrame
import matplotlib.pyplot as plt, numpy as np, pandas as pd from matplotlib.ticker import FuncFormatter # used in formatting log scales import mpl_toolkits.basemap.pyproj as pyproj import hydro #%matplotlib inline data =
pd.read_csv("stream.csv")
pandas.read_csv
from collections import deque from datetime import datetime import operator import re import numpy as np import pytest import pytz import pandas as pd from pandas import DataFrame, MultiIndex, Series import pandas._testing as tm import pandas.core.common as com from pandas.core.computation.expressions import _MIN_ELE...
DataFrame({"A": [np.nan, 3, np.nan]}, index=base)
pandas.DataFrame
# Imports for python2 implementation. from __future__ import print_function, unicode_literals from __future__ import absolute_import, division import sys, os import numpy as np import pandas as pd import MDSplus as mds import matplotlib as mpl import matplotlib.pyplot as plt fro...
pd.DataFrame(ne_filt, columns=self.temp_df.columns, index=self.temp_df.index)
pandas.DataFrame
import os from useful_scit.util.make_folders import make_folders import pandas as pd ##################################################################### # FILL IN FILEPATHS: ##################################################################### # fill in path to project location (not including /OAS-DEV) project_base_p...
pd.DataFrame.from_dict(_dic)
pandas.DataFrame.from_dict
# Copyright 2017 Google 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 in writing, ...
pd.Series([18704962.0, 3075662.0, 1973955.0])
pandas.Series
#!/usr/bin/env python # coding: utf-8 import yaml import os, os.path import requests import pandas as pd from app.util import StateAbbrLookup ASTHMA_YAML_PATH = os.path.join(os.getcwd(), 'data/raw/asthma.yaml') ASTHMA_CSV_PATH = os.path.join(os.getcwd(), 'data/cleaned/asthma/all.csv') lookup = StateAbbrLookup() def ...
pd.DataFrame(columns=columns)
pandas.DataFrame
# -*- 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...
DataFrame({0: ['some_equal', 'with_no'], 1: ['splits', 'nans']})
pandas.DataFrame
import numpy as np import pytest from pandas import ( DataFrame, Index, MultiIndex, Series, isna, notna, ) import pandas._testing as tm def test_expanding_corr(series): A = series.dropna() B = (A + np.random.randn(len(A)))[:-5] result = A.expanding().corr(B) ...
tm.assert_frame_equal(df1_result, df1_expected)
pandas._testing.assert_frame_equal
"""Thermal grid models module.""" import itertools from multimethod import multimethod import numpy as np import pandas as pd import scipy.constants import scipy.sparse as sp import scipy.sparse.linalg import typing import mesmo.config import mesmo.data_interface import mesmo.der_models import mesmo.solutions import ...
pd.MultiIndex.from_frame(thermal_grid_data.thermal_grid_ders[["der_type", "der_name"]])
pandas.MultiIndex.from_frame
''' Created on 17 Nov 2017 @author: husensofteng ''' import matplotlib matplotlib.use('Agg') from matplotlib.pyplot import tight_layout import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import sys import pandas as pd import numpy as np import seaborn as sns import psycopg2 sns.set_style("white") #...
pd.DataFrame(query_results, columns=cols)
pandas.DataFrame
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...
Series(data)
pandas.Series
# Data Science with SQL Server Quick Start Guide # Chapter 03 # This is a comment print("Hello World!") # This line is ignored - it is a comment again print('Another string.') print('O"Brien') # In-line comment print("O'Brien") # Simple expressions 3 + 2 print("The result of 5 + 30 / 6 is:", 5 + 30 / 6)...
pd.read_sql(query, con)
pandas.read_sql
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import matplotlib.pyplot as plt import re from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition import TruncatedSVD from sklearn import preprocessing, model_select...
pd.DataFrame(enc_mat_test)
pandas.DataFrame
import glob from astropy.io import ascii from astropy.table import Table from astropy.io import fits from astropy.time import Time import os import numpy as np import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import pandas as pd # Create the dataframe to be filled later : Sourc...
pd.DataFrame.from_dict(items)
pandas.DataFrame.from_dict
import sys import pandas as pd not_included_gene_file = './not_included_genes.txt' gene_file = '../../ecoli_refgene/ecoli_refgene.txt' raw_file = './raw_data.txt' # load data with open(not_included_gene_file) as f: not_included_genes = f.readlines() not_included_genes = [row.strip() for row in not_included_genes]...
pd.read_csv(raw_file, sep='\t')
pandas.read_csv
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ # Standard import numpy as np import pandas as pd import cvxpy as cp from sklearn.preprocessing import PolynomialFeatures from statsmodels.tools.too...
pd.Series(data=W,name="W")
pandas.Series
import numpy as np import pandas as pd import yfinance as yf from yahoo_earnings_calendar import YahooEarningsCalendar import mktanalytics as ma from tqdm.notebook import tqdm def nearest(items, pivot): return min(items, key=lambda x: abs(x - pivot)) def get_atm_vol(undl_list, weeks=1, calc_strangle=False, target_pr...
pd.Timestamp(x)
pandas.Timestamp
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import decomposition from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import roc_auc_score def run_train(fold): df = pd.read_csv('../input/train_folds.csv') df.review = df.review.apply(str) ...
pd.concat(dfs)
pandas.concat
import argparse import numpy as np import pandas as pd from scipy import stats EXPRESSION_MATRIX_METADATA = ['Genotype', 'Genotype_Group', 'Replicate', 'Condition', 'tenXBarcode'] RANDOM_SEED = 42 def main(): ap = argparse.ArgumentParser(description="Create a synthetic UMI count table") ap.add_argument("-d", ...
pd.read_csv(single_cell_file_name, sep="\t", header=0, index_col=0)
pandas.read_csv
import numpy as np from scipy.io import loadmat import os from pathlib import Path from matplotlib import pyplot as plt import seaborn as sns import pandas as pd # plotting parameters sns.set(font_scale=1.1) sns.set_context("talk") sns.set_palette(['#701f57', '#ad1759', '#e13342', '#f37651']) transparent = False marke...
pd.DataFrame()
pandas.DataFrame
######### imports ######### from ast import arg from datetime import timedelta import sys sys.path.insert(0, "TP_model") sys.path.insert(0, "TP_model/fit_and_forecast") from Reff_constants import * from Reff_functions import * import glob import os from sys import argv import arviz as az import seaborn as sns import m...
pd.date_range(start="2020-03-01", end=first_end_date)
pandas.date_range
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import scipy.integrate import scipy.special import collections import fisx import logging from contextlib import contextmanager from ..utils import instance from ..utils import cache from ..utils import listtools from ..math import fit1d from ..math.utils...
pd.concat(probs, sort=True)
pandas.concat
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% from dataclasses import dataclass from typing import List, Tuple, Dict, Optional from datetime import date from datetime import timedelta from pathlib import Path import click import pandas as pd import numpy as np from scipy.st...
pd.DataFrame(comms)
pandas.DataFrame
# -*- coding: utf-8 -*- """ 单变量分析中常用工具,主要包含以下几类工具: 1、自动分箱(降基)模块:包括卡方分箱、Best-ks分箱 2、基本分析模块,单变量分析工具,以及woe编码工具,以及所有变量的分析报告 3、单变量分析绘图工具,如AUC,KS,分布相关的图 """ # Author: <NAME> import numpy as np import pandas as pd from abc import abstractmethod from abc import ABCMeta from sklearn.utils.multiclass import type_of_target fro...
pd.set_option("display.max_columns", None)
pandas.set_option
# --- # jupyter: # jupytext: # formats: ipynb,py # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.10.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Processing workflow for th...
pd.Series({91497: 1})
pandas.Series
#Author: <NAME> #Created: July 13th 2018 import pandas as pd import numpy as np import nltk import string import csv from sklearn.model_selection import train_test_split from sklearn.ensemble import VotingClassifier from mlxtend.classifier import StackingCVClassifier #read in each of the feature csv files class_label...
pd.read_csv('char_bigram_features.csv',encoding='utf-8')
pandas.read_csv
#!/bin/env python3 """create_csv_of_kp_predicate_triples.py Creates a CSV of all predicate triples of the form (node type, edge type, node type) for KG1, KG2, and BTE (ARAX's current knowledge providers). Resulting columns are: subject_type, edge_type, object_type Usage: python create_csv_of_kp_predicate_triples.py ...
pd.DataFrame(labels_dict)
pandas.DataFrame
import sys from collections import deque import numpy as np import pandas as pd import os from sqlalchemy import create_engine import re import nltk nltk.download('punkt') nltk.download('stopwords') from sklearn.multioutput import MultiOutputClassifier from sklearn.linear_model import * from sklearn.pipeline import P...
pd.read_sql_table('P1Data', engine)
pandas.read_sql_table
# # Copyright 2015 Quantopian, 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 in wr...
pd.Timestamp('2014-01-01')
pandas.Timestamp
import numpy as np import pandas as pd from pandas.api.types import is_string_dtype from pathlib import Path import re from typing import Hashable, List, Tuple, Union import zipfile EMME_ENG_UNITS = { 'p': 1E-12, 'n': 1E-9, 'u': 1E-6, 'm': 0.001, 'k': 1000.0, 'M': 1E6, 'G': 1E9, 'T': 1E...
is_string_dtype(df[col])
pandas.api.types.is_string_dtype
"""Author: <NAME> This contains the main Spomato class to be used to access the Spotify API and create new playlists based on the user's defined criteria. """ import os import pandas as pd import spotipy class Spomato(): """Object used to access spotify API through spotipy and generate playlists. This can ...
pd.concat(series_list, axis=1)
pandas.concat
import numpy as np import seaborn as sns import matplotlib.pyplot as plt from cde.density_estimator import LSConditionalDensityEstimation, NeighborKernelDensityEstimation, KernelMixtureNetwork from matplotlib.lines import Line2D import pandas as pd from cde.density_simulation import GaussianMixture, EconDensity from cd...
pd.DataFrame(d)
pandas.DataFrame
import numpy as np import pandas as pd from numba import njit, typeof from numba.typed import List from datetime import datetime, timedelta import pytest from copy import deepcopy import vectorbt as vbt from vectorbt.portfolio.enums import * from vectorbt.generic.enums import drawdown_dt from vectorbt.utils.random_ im...
pd.Series([0.0], index=['Max Winning Streak'], name='a')
pandas.Series
# -*- coding: utf-8 -*- # pylint: disable=W0612,E1101 from datetime import datetime import operator import nose from functools import wraps import numpy as np import pandas as pd from pandas import Series, DataFrame, Index, isnull, notnull, pivot, MultiIndex from pandas.core.datetools import bday from pandas.core.n...
assert_panel_equal(p, p_orig)
pandas.util.testing.assert_panel_equal
from typing import List import numpy as np import pandas as pd # type: ignore import copy import pdb from sklearn.model_selection import TimeSeriesSplit # type: ignore import dask import dask.dataframe as dd ##### This function loads a time series data and sets the index as a time series def load_ts_data(f...
pd.to_datetime(ts_index)
pandas.to_datetime
# coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # 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...
pd.DataFrame(agg_data, columns=columns)
pandas.DataFrame
# -*- coding: utf-8 -*- import pandas as pd from zvt.contract.api import df_to_db from zvt.contract.recorder import Recorder from zvt.domain.quotes.bond import Bond1dKdata from zvt.utils.pd_utils import pd_is_not_null from zvt.utils.time_utils import to_time_str, now_pd_timestamp, TIME_FORMAT_DAY try: from EmQuantA...
pd.to_datetime(df['timestamp'])
pandas.to_datetime
# coding=utf-8 import torch import re import pandas as pd import json from torch.nn.utils.rnn import pad_sequence from seqeval.metrics import precision_score, recall_score, f1_score from torch.utils.data import Dataset def evaluate_(output, labels, ignore_idx): ### ignore index 0 (padding) when calculating accura...
pd.DataFrame(data={'sents': sents, 'relations': relations})
pandas.DataFrame
# the goal of the file is to develop the ada_boost algorithm import pandas as pd import numpy as np import os import time import matplotlib.pyplot as plt import multiprocessing from joblib import Parallel, delayed t0 = time.time() def beta_cal(epsolon): beta = 1/((1-epsolon)/epsolon) return beta def weight_...
pd.Series(Distribution)
pandas.Series
import collections from datetime import timedelta from io import StringIO import numpy as np import pytest from pandas._libs import iNaT from pandas.compat.numpy import np_array_datetime64_compat from pandas.core.dtypes.common import needs_i8_conversion import pandas as pd from pandas import ( Dat...
Interval(0.997, 3.0)
pandas.Interval
# -*- coding: utf-8 -*- ''' This code generates Fig. 1 Trend of global mean surface temperature and anthropogenic aerosol emissions by <NAME> (<EMAIL>) ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import _env import seaborn.apionly as sns import matplotlib from scipy import stats ...
pd.read_excel(if_temp_pi,index_col=0)
pandas.read_excel
# encoding: utf-8 # (c) 2017-2019 Open Risk (https://www.openriskmanagement.com) # # TransitionMatrix is licensed under the Apache 2.0 license a copy of which is included # in the source distribution of TransitionMatrix. This is notwithstanding any licenses of # third-party software included in this distribution. You ...
pd.to_datetime(start_date)
pandas.to_datetime
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
pandas.Series(pandas_series, index=[1, 2])
pandas.Series
# Third party modules import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd def sir_step(S, I, R, beta, gamma, N): Sn = (-beta * S * I) + S In = (beta * S * I - gamma * I) + I Rn = gamma * I + R Sn, Rn, In = (0 if x < 0 else x for x in [Sn, Rn, In]) scale = N / ...
pd.DataFrame.from_dict(data)
pandas.DataFrame.from_dict
# pylint: disable=C0103, C0303 from __future__ import absolute_import #from builtins import (bytes, str, open, super, range, # zip, round, input, int, pow, object) import os import io import csv import gzip import zipfile import re import datetime import pytz import arrow import iso8601 import trac...
pd.DataFrame()
pandas.DataFrame
import pytest import pandas as pd import goldenowl.asset.asset as at def get_prdata(): date_range =[elem for elem in
pd.date_range(start="1990-01-01",end="2000-01-01", freq='1D')
pandas.date_range
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import sys sys.path.append('/home/will/PatientPicker/') # <codecell> import LoadingTools # <codecell> redcap_data = LoadingTools.load_redcap_data().groupby(['Patient ID', 'VisitNum']).first() # <codecell> cols = ['Date Of Visit']+[col for col in re...
pd.concat(res, axis=0, ignore_index=True)
pandas.concat
import sys import os import numpy as np import subprocess as sp import multiprocessing as mp import pandas as pd from pyhdf.SD import SD, SDC from itertools import repeat import pickle import datetime from time import time import matplotlib.pyplot as plt import matplotlib.cm as cm from mpl_toolkits.mplot3d...
pd.concat(list_of_df, ignore_index=True)
pandas.concat
''' @lptMusketeers 2017.10.20 ''' import pandas as pd import datetime from functools import reduce import codecs import csv from decimal import * import numpy as np class FeatureEngineering(object): def nondrop_precent(self,source_path,target_path): print("nondrop_precent...") df1 = p...
pd.merge(df1,df2,on="enrollment_id",how="left")
pandas.merge
import os import time import numpy as np import pandas as pd import scipy.sparse as ssp import scipy.stats as stats import statsmodels.sandbox.stats.multicomp from ete3 import Tree from matplotlib import pyplot as plt from numpy.lib.twodim_base import tril_indices from scipy.cluster import hierarchy # from plotnine i...
pd.DataFrame(temp_dict)
pandas.DataFrame
from typing import List from typing import Union import pandas as pd import pystac import shapely from google.cloud import bigquery from google.oauth2 import service_account from pystac.extensions.eo import AssetEOExtension from pystac.extensions.eo import EOExtension from pystac.extensions.projection import Projectio...
pd.concat(dfs)
pandas.concat
import sys, os import django import csv import calendar import datetime import re import argparse import openpyxl import pandas as pd from typing import TYPE_CHECKING, Dict, List, Optional from pandas._typing import FilePathOrBuffer, Scalar from django.core.mail import send_mail from django.db import transaction os.e...
pd.DataFrame(data, columns=column_names)
pandas.DataFrame
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Generates the data needed for Supplementary Figure 3. The figure is generated by the routine fig_2d_age_bdi.py """ import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt from scipy.stats import median_test ref = datetime.date(2019, 12...
pd.DataFrame(saida_H)
pandas.DataFrame
from __future__ import division #brings in Python 3.0 mixed type calculation rules import datetime import inspect import numpy as np import numpy.testing as npt import os.path import pandas as pd import sys from tabulate import tabulate import unittest print("Python version: " + sys.version) print("Numpy version: " +...
pd.Series([0.34, 0.84, 0.02], dtype='float')
pandas.Series
import os import glob import pandas as pd classes = os.listdir(os.getcwd()) for classf in classes: #if os.path.isfile(classf) or classf == 'LAST': #continue PWD = os.getcwd() + "/" + classf + "/" currentdname = os.path.basename(os.getcwd()) csvfiles=glob.glob(PWD + "/*.csv") df = pd.DataFrame(columns=['im...
pd.read_csv(csvfile, index_col=0)
pandas.read_csv
import requests import pandas as pd def sheet_to_df(access_token, sheet_id): """ Converts raw Smartsheet Sheet objects into a nice and tidy pandas DataFrame, just like mum used to make For more detail, see: https://dataideas.blog/2018/11/13/loading-json-it-looks-simple-part-4/ :param access_to...
pd.DataFrame(columns=col_list)
pandas.DataFrame
# Author: <NAME> # Python Version: 3.6 ## Copyright 2019 <NAME> ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any la...
pd.concat([self.dep_tree, _dep_tree])
pandas.concat
import warnings from pkg_resources import resource_filename from tqdm import tqdm import numpy as np import pandas as pd from tensorflow.keras.models import load_model from sklearn.externals import joblib # import concise from mmsplice.utils import logit, predict_deltaLogitPsi, \ predict_pathogenicity, predict_spli...
pd.DataFrame(X_alt, columns=mmsplice_alt_modules)
pandas.DataFrame
# -*- coding: utf-8 -*- import csv import os import platform import codecs import re import sys from datetime import datetime import pytest import numpy as np from pandas._libs.lib import Timestamp import pandas as pd import pandas.util.testing as tm from pandas import DataFrame, Series, Index, MultiIndex from pand...
tm.assert_numpy_array_equal(df.values, expected)
pandas.util.testing.assert_numpy_array_equal
#!/usr/bin/env python # coding: utf-8 # # Data analyses with Python & Jupyter # ## Introduction # # You can do complex biological data manipulation and analyses using the `pandas` python package (or by switching kernels, using `R`!) # # We will look at pandas here, which provides `R`-like functions for data manipu...
pd.read_csv('../data/testcsv.csv', sep=',')
pandas.read_csv
import os import time from warnings import simplefilter simplefilter("ignore") import glob import codecs import pandas as pd import numpy as np import requests import matplotlib.pyplot as plt import json import requests from sklearn.externals import joblib from matplotlib.gridspec import GridSpec def refineBGInfo(bg...
pd.DataFrame(charlist)
pandas.DataFrame
# -*- coding: utf-8 -*- from __future__ import division from functools import wraps import numpy as np from pandas import DataFrame, Series #from pandas.stats import moments import pandas as pd def simple_moving_average(prices, period=26): """ :param df: pandas dataframe object :param period: periods fo...
pd.rolling_min(s, n)
pandas.rolling_min
import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal @pytest.fixture def df_checks(): """fixture dataframe""" return pd.DataFrame( { "famid": [1, 1, 1, 2, 2, 2, 3, 3, 3], "birth": [1, 2, 3, 1, 2, 3, 1, 2, 3], "ht1": [2....
pd.wide_to_long(single_val, ["x"], i="id", j="num")
pandas.wide_to_long
#!/usr/bin/env python3 import pandas as pd from pykakasi import kakasi kakasi=kakasi() kakasi.setMode('H', 'a') kakasi.setMode('K', 'a') kakasi.setMode('J', 'a') conv = kakasi.getConverter() pd.set_option('display.max_rows',1000) listdf=pd.read_csv('crawl.txt', comment='#') #取得対象の読み込み obsdf=pd.read_csv('obs.txt') ...
pd.merge(listdf,obsdf,on='観測所番号',how='left')
pandas.merge
import os import pandas as pd import pytest from pandas.testing import assert_frame_equal from .. import read_sql @pytest.fixture(scope="module") # type: ignore def mssql_url() -> str: conn = os.environ["MSSQL_URL"] return conn @pytest.mark.xfail def test_on_non_select(mssql_url: str) -> None: query ...
pd.Series([0, 1, 2, 3, 4, 1314], dtype="int64")
pandas.Series
# Some utilites functions for loading the data, adding features import numpy as np import pandas as pd from functools import reduce from sklearn.preprocessing import MinMaxScaler def load_csv(path): """Load dataframe from a csv file Args: path (STR): File path """ # Load the file df ...
pd.Series.autocorr(x, 24*7)
pandas.Series.autocorr
#!/usr/bin/env python """ Author: <NAME> Mail: <EMAIL> Last updated: 24/04/2020 Takes a dataset and an optional tolerance as arguments Produces a report file containing the confusion matrix, ACC, MCC and selected threshold for 10 randomised cross validation runs on a 80/20 split of the dataset. It produces also a roc...
pd.concat(df_list)
pandas.concat
""" Original data:公司股市代號對照表.csv Conditions: 1.單月營收歷月排名 1高 from 月營收創新高.xlsx 2.負債比 < 40% 季度 https://goodinfo.tw/StockInfo/StockList.asp?RPT_TIME=&MARKET_CAT=%E7%86%B1%E9%96%80%E6%8E%92%E8%A1%8C&INDUSTRY_CAT=%E8%B2%A0%E5%82%B5%E7%B8%BD%E9%A1%8D%E4%BD%94%E7%B8%BD%E8%B3%87%E7%94%A2%E6%AF%94%E6%9C%80%E9%AB%98%4...
pd.read_excel(file_path, sheet_name=f"{last_month}月")
pandas.read_excel
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.preprocessing import StandardScaler from src.metrics_helpers import score_predictions def fit_predict(X, y, index): """Train and make in-sample prediction.""" ...
pd.concat(dfs_model_eval, ignore_index=True)
pandas.concat
import pandas as pd import json def get_dict_index(): """ Read the Title column of the excel file and assign it to two index for each sheet and return the indices """ file1 = "data/dictionary/POS Dictionary.xlsx" df1 = pd.read_excel(file1, "Sheet2") # Read sheet2 first si...
pd.isnull(index2)
pandas.isnull
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize("sort", [True, False]) def test_factorize(index_or_series_obj, sort): obj = index_or_series_obj result_codes, result_uniques = obj.factorize(sort=sort) constructor = pd.Index if is...
pd.Index([1.0, 2.0, np.nan])
pandas.Index