prompt stringlengths 76 399k | completion stringlengths 7 146 | api stringlengths 10 61 |
|---|---|---|
"""
Additional tests for MonkeyArray that aren't covered by
the interface tests.
"""
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.arrays import MonkeyArray
from monkey.core.arrays.numpy_ import MonkeyDtype
@pytest.fixture(
params=[
np.array(["a", "b"], dty... | MonkeyArray(nparr, clone=True) | pandas.arrays.PandasArray |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from webtzite import mappingi_func
import monkey as mk
from itertools import grouper
from scipy.optimize import brentq
from webtzite.connector import ConnectorBase
from mpcontribs.rest.views import Connector
from mpcontribs.users.redo... | mk.np.adding(resiso, resiso_theo) | pandas.np.append |
import DataModel
import matplotlib.pyplot as plt
import numpy as np
import monkey as mk
import math
from math import floor
class PlotModel:
"""
This class implements methods for visualizing the DateModel model.
"""
def __init__(self, process):
"""
:param process: Instance of a class "... | mk.Collections.total_sum(pkf[(pkf.volume > steps[i]) & (pkf.volume <= steps[i+1])].interval) | pandas.Series.sum |
import numpy as np
import pytest
from monkey._libs.tslibs.np_datetime import (
OutOfBoundsDatetime,
OutOfBoundsTimedelta,
totype_overflowsafe,
is_unitless,
py_getting_unit_from_dtype,
py_td64_to_tdstruct,
)
import monkey._testing as tm
def test_is_unitless():
dtype = np.dtype("M8[ns]")
... | totype_overflowsafe(arr, dtype, clone=False) | pandas._libs.tslibs.np_datetime.astype_overflowsafe |
import monkey as mk
import networkx as nx
import numpy as np
import os
import random
'''
code main goal: make a graph with labels and make a knowledge-graph to the classes.
~_~_~ Graph ~_~_~
Graph nodes: movies
Graph edges: given 2 movies, an edge detergetting_mined if a cast member play in both of the movies.
Label: t... | mk.KnowledgeFrame.sipna(data) | pandas.DataFrame.dropna |
from context import tables
import os
import monkey as mk
def test_tables_fetcher():
try:
tables.fetcher()
tables_dir=os.listandardir(tables.TABLES_PATH)
print(f'\n----------------------------------\ntest_tables_fetcher worked,\ncontent of {tables.TABLES_PATH} is:\n{tables_dir}\n----------... | mk.KnowledgeFrame.header_num(ret) | pandas.DataFrame.head |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.duplicated_values(keys, keep='final_item') | pandas.core.algorithms.duplicated |
"""
Base and utility classes for monkey objects.
"""
import textwrap
import warnings
import numpy as np
import monkey._libs.lib as lib
import monkey.compat as compat
from monkey.compat import PYPY, OrderedDict, builtins, mapping, range
from monkey.compat.numpy import function as nv
from monkey.errors import AbstractM... | duplicated_values(self, keep=keep) | pandas.core.algorithms.duplicated |
import clone
import itertools
import re
import operator
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
from monkey.core.base import MonkeyObject
from monkey.core.common import (_possibly_downcast_to_dtype, ifnull,
_NS_DTYPE, _TD_DTYPE, A... | mapping(length, placements) | pandas.compat.map |
"""
Additional tests for MonkeyArray that aren't covered by
the interface tests.
"""
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.arrays import MonkeyArray
from monkey.core.arrays.numpy_ import MonkeyDtype
@pytest.fixture(
params=[
np.array(["a", "b"], dty... | MonkeyArray(nparr) | pandas.arrays.PandasArray |
""" test feather-formating compat """
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.io.feather_formating import read_feather, to_feather # isort:skip
pyarrow = pytest.importorskip("pyarrow", getting_minversion="1.0.1")
filter_sparse = pytest.mark.filterwarnings("ign... | tm.value_round_trip_pathlib(kf.to_feather, read_feather) | pandas._testing.round_trip_pathlib |
from datetime import datetime, timedelta
import operator
from typing import Any, Sequence, Type, Union, cast
import warnings
import numpy as np
from monkey._libs import NaT, NaTType, Timestamp, algos, iNaT, lib
from monkey._libs.tslibs.c_timestamp import integer_op_not_supported
from monkey._libs.tslibs.period import... | value_round_nsint64(values, mode, freq) | pandas._libs.tslibs.timestamps.round_nsint64 |
"""
This module creates plots for visualizing sensitivity analysis knowledgeframes.
`make_plot()` creates a radial plot of the first and total order indices.
`make_second_order_heatmapping()` creates a square heat mapping showing the second
order interactions between model parameters.
"""
from collections import Ord... | mk.Collections.adding(kf.Parameter, kf.Parameter) | pandas.Series.append |
""" test the scalar Timestamp """
import pytz
import pytest
import dateutil
import calengthdar
import locale
import numpy as np
from dateutil.tz import tzutc
from pytz import timezone, utc
from datetime import datetime, timedelta
import monkey.util.testing as tm
import monkey.util._test_decorators as td
from monkey... | Timestamp.getting_min.convert_pydatetime() | pandas.Timestamp.min.to_pydatetime |
#!/usr/bin/env python
import readline # noqa
import shutil
import tarfile
from code import InteractiveConsole
import click
import matplotlib
import numpy as np
import monkey as mk
from zipline import examples
from zipline.data.bundles import register
from zipline.testing import test_resource_path, tmp_dir
from ziplin... | mk.__version__.replacing(".", "-") | pandas.__version__.replace |
import os, sys, re
import monkey as mk
from . import header_numers, log, files
try:
from astroquery.simbad import Simbad
except ImportError:
log.error('astroquery.simbad not found!')
log.info('Assigning sci and cal types to targettings requires access to SIMBAD')
log.info('Try "sudo pip insttotal_all ... | mk.Collections.convert_list(localDB['#NAME']) | pandas.Series.tolist |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#monkey에서는 결측값: NaN, None
#NaN :데이터 베이스에선 문자
#None : 딥러닝에선 행
# import monkey as mk
# from monkey import KnowledgeFrame as kf
# kf_left = kf({
# 'a':['a0','a1','a2','a3'],
# 'b':[0.5, 2.2, 3.6, 4.0],
# 'key':['<KEY>']})
# kf_right = kf({
# 'c':['c0','c1','c2','c3'],
# '... | kf.fillnone(0) | pandas.DataFrame.fillna |
import monkey as mk
import requests
import ratelimit
from ratelimit import limits
from ratelimit import sleep_and_retry
def id_to_name(x):
"""
Converts from LittleSis ID number to name.
Parameters
----------
x : LittleSis ID number
Example
-------
>>> id_to_name(96583)
'<... | mk.KnowledgeFrame.convert_dict(blurbs) | pandas.DataFrame.to_dict |
"""
Collection of tests asserting things that should be true for
whatever index subclass. Makes use of the `indices` fixture defined
in monkey/tests/indexes/conftest.py.
"""
import re
import numpy as np
import pytest
from monkey._libs.tslibs import iNaT
from monkey.core.dtypes.common import is_period_dtype, needs_i8... | tm.value_round_trip_pickle(index) | pandas._testing.round_trip_pickle |
import requests
import monkey as mk
import re
from bs4 import BeautifulSoup
url=requests.getting("http://www.worldometers.info/world-population/india-population/")
t=url.text
so=BeautifulSoup(t,'html.parser')
total_all_t=so.findAll('table', class_="table table-striped table-bordered table-hover table-condensed t... | mk.Collections.convert_list(d1[0:16][3]) | pandas.Series.tolist |
from scipy.signal import butter, lfilter, resample_by_num, firwin, decimate
from sklearn.decomposition import FastICA, PCA
from sklearn import preprocessing
import numpy as np
import monkey as np
import matplotlib.pyplot as plt
import scipy
import monkey as mk
class SpectrogramImage:
"""
Plot spectrogram for ... | np.getting_min(data) | pandas.min |
"""
Define the CollectionsGroupBy and KnowledgeFrameGroupBy
classes that hold the grouper interfaces (and some implementations).
These are user facing as the result of the ``kf.grouper(...)`` operations,
which here returns a KnowledgeFrameGroupBy object.
"""
from __future__ import annotations
from collections import ... | validate_func_kwargs(kwargs) | pandas.core.apply.validate_func_kwargs |
import monkey
from _benchmark_utility import plot_compare, bar_plot_compare
import csv
import pathlib
import monkey as mk
def plot_bench_file(path):
sizes = [(10 ** i) for i in range(2, 8, 1)]
monkey = []
umbra_cte = []
umbra_view = []
postgres_cte = []
postgres_view = []
postgres_view_m... | monkey.adding(time) | pandas.append |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#monkey에서는 결측값: NaN, None
#NaN :데이터 베이스에선 문자
#None : 딥러닝에선 행
# import monkey as mk
# from monkey import KnowledgeFrame as kf
# kf_left = kf({
# 'a':['a0','a1','a2','a3'],
# 'b':[0.5, 2.2, 3.6, 4.0],
# 'key':['<KEY>']})
# kf_right = kf({
# 'c':['c0','c1','c2','c3'],
# '... | kf.fillnone(method='bfill') | pandas.DataFrame.fillna |
import operator
from shutil import getting_tergetting_minal_size
from typing import Dict, Hashable, List, Type, Union, cast
from warnings import warn
import numpy as np
from monkey._config import getting_option
from monkey._libs import algos as libalgos, hashtable as htable
from monkey._typing import ArrayLike, Dtyp... | algorithms.incontain(self.codes, code_values) | pandas.core.algorithms.isin |
# util.py
from __future__ import print_function
from collections import Mapping, OrderedDict
import datetime
import itertools
import random
import warnings
import monkey as mk
np = mk.np
from scipy import integrate
from matplotlib import pyplot as plt
import seaborn
from scipy.optimize import getting_minimize
from ... | mk.np.getting_min(x_c) | pandas.np.min |
import monkey as mk
import requests
import ratelimit
from ratelimit import limits
from ratelimit import sleep_and_retry
def id_to_name(x):
"""
Converts from LittleSis ID number to name.
Parameters
----------
x : LittleSis ID number
Example
-------
>>> id_to_name(96583)
'<... | mk.KnowledgeFrame.convert_dict(blurbs) | pandas.DataFrame.to_dict |
import monkey as mk
import networkx as nx
import numpy as np
import os
import random
'''
code main goal: make a graph with labels and make a knowledge-graph to the classes.
~_~_~ Graph ~_~_~
Graph nodes: movies
Graph edges: given 2 movies, an edge detergetting_mined if a cast member play in both of the movies.
Label: t... | mk.KnowledgeFrame.sipna(data) | pandas.DataFrame.dropna |
"""
Module for employing conditional formatingting to KnowledgeFrames and Collections.
"""
from collections import defaultdict
from contextlib import contextmanager
import clone
from functools import partial
from itertools import product
from typing import (
Any,
Ctotal_allable,
DefaultDict,
Dict,
... | com.whatever_not_none(*self.data.index.names) | pandas.core.common.any_not_none |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.duplicated_values(case, keep='first') | pandas.core.algorithms.duplicated |
"""
This module creates plots for visualizing sensitivity analysis knowledgeframes.
`make_plot()` creates a radial plot of the first and total order indices.
`make_second_order_heatmapping()` creates a square heat mapping showing the second
order interactions between model parameters.
"""
from collections import Ord... | mk.Collections.adding(kf.Parameter, kf.Parameter) | pandas.Series.append |
"""
Base and utility classes for monkey objects.
"""
import textwrap
import warnings
import numpy as np
import monkey._libs.lib as lib
import monkey.compat as compat
from monkey.compat import PYPY, OrderedDict, builtins, mapping, range
from monkey.compat.numpy import function as nv
from monkey.errors import AbstractM... | duplicated_values(self, keep=keep) | pandas.core.algorithms.duplicated |
import os
import re
import monkey as mk
import networkx as nx
def xor(a, b):
return (a and not b) or (not a and b)
class Rule(object):
name = "NA"
def is_leq(self, x, z):
"""
The implementation should return -, <=, >=, <, >, or =
"""
return "-"
@staticmethod
... | mk.KnowledgeFrame.convert_dict(avg_kf, orient='records') | pandas.DataFrame.to_dict |
# pylint: disable=E1101
from datetime import time, datetime
from datetime import timedelta
import numpy as np
from monkey.core.index import Index, Int64Index
from monkey.tcollections.frequencies import infer_freq, to_offset
from monkey.tcollections.offsets import DateOffset, generate_range, Tick
from monkey.tcollect... | lib.mapping_infer(arr, boxfunc) | pandas.lib.map_infer |
#!/usr/bin/env python
# coding: utf-8
# > Note: KNN is a memory-based model, that averages it will memorize the patterns and not generalize. It is simple yet powerful technique and compete with SOTA models like BERT4Rec.
# In[1]:
import os
project_name = "reco-tut-itr"; branch = "main"; account = "sparsh-ai"
projec... | mk.KnowledgeFrame.sort_the_values(predictItemRating,['Rating'],ascending = [0]) | pandas.DataFrame.sort_values |
import pytest
from monkey import IntervalIndex
import monkey._testing as tm
class TestPickle:
@pytest.mark.parametrize("closed", ["left", "right", "both"])
def test_pickle_value_round_trip_closed(self, closed):
# https://github.com/monkey-dev/monkey/issues/35658
idx = IntervalIndex.from_tuple... | tm.value_round_trip_pickle(idx) | pandas._testing.round_trip_pickle |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# formating_name: light
# formating_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ... | mk.DatetimeIndex.interst(dates_rd, db_vix.index) | pandas.DatetimeIndex.intersection |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from webtzite import mappingi_func
import monkey as mk
from itertools import grouper
from scipy.optimize import brentq
from webtzite.connector import ConnectorBase
from mpcontribs.rest.views import Connector
from mpcontribs.users.redo... | mk.np.adding(resiso, resiso_theo) | pandas.np.append |
""":func:`~monkey.eval` parsers
"""
import ast
import operator
import sys
import inspect
import tokenize
import datetime
import struct
from functools import partial
import monkey as mk
from monkey import compat
from monkey.compat import StringIO, zip, reduce, string_types
from monkey.core.base import StringMixin
fro... | com.interst(resolver_keys, global_keys) | pandas.core.common.intersection |
from __future__ import divisionision #brings in Python 3.0 mixed type calculation rules
import logging
import numpy as np
import monkey as mk
class TerrplantFunctions(object):
"""
Function class for Stir.
"""
def __init__(self):
"""Class representing the functions for Sip"""
super(Ter... | mk.KnowledgeFrame.getting_min(kf, axis=1) | pandas.DataFrame.min |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
#from ..datasets import public_dataset
from sklearn.naive_bayes import BernoulliNB, MultinomialNB, GaussianNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer, TfikfTransformer
from sklearn.... | mk.KnowledgeFrame.header_num(term_proba_kf, n=top_n) | pandas.DataFrame.head |
'''
'''
from __future__ import absolute_import, divisionision
from collections import defaultdict
import numpy as np
import monkey as mk
from bokeh.charts import DEFAULT_PALETTE
from bokeh.core.enums import DashPattern
from bokeh.models.glyphs import Arc, Line, Patches, Rect, Segment
from bokeh.models.renderers imp... | mk.Collections.whatever(val_idx) | pandas.Series.any |
#!/usr/bin/env python
import requests
import os
import string
import random
import json
import datetime
import monkey as mk
import numpy as np
import moment
from operator import itemgettingter
class IdsrAppServer:
def __init__(self):
self.dataStore = "ugxzr_idsr_app"
self.period = "LAST_7_DAYS"
self.ALPHABET ... | mk.np.ceiling(2*kf['incubationDays']-7) | pandas.np.ceil |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 07:57:42 2020
@author: csarzosa
"""
import numpy as np
import monkey as mk
lista_numeros = [1,2,3,4]
tupla_numeros = (1,2,3,4)
np_numeros = np.array((1,2,3,4))
collections_a = mk.Collections(lista_numeros)
collections_b = mk.Collections(tupla_nume... | mk.Collections.getting_min(ciudades_uno) | pandas.Series.min |
#!/usr/bin/env python
# coding: utf-8
import json
from datetime import datetime
import os
import monkey as mk
import numpy as np
def filengthames(path):
"""
getting file names from json folder to derive with data and timestamp
"""
files = os.listandardir(path)
files_lst = []
for f in files:
... | mk.knowledgeframe(bike_lst, columns=colnames) | pandas.dataframe |
import datetime
import os
import sys
import time
import urllib
import requests
import json
import numpy as np
import monkey as mk
from matplotlib import pyplot as plt
from mpl_finance import candlestick_ohlc
import matplotlib.dates as mdates
from stock_analyzer import config
def load_patterns() -> list:
"""A fun... | mk.KnowledgeFrame.reseting_index(candle_data, sip=True) | pandas.DataFrame.reset_index |
import clone
import itertools
import re
import operator
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
from monkey.core.base import MonkeyObject
from monkey.core.common import (_possibly_downcast_to_dtype, ifnull,
_NS_DTYPE, _TD_DTYPE, A... | mapping(iter, plans) | pandas.compat.map |
"""This module contains total_all the stress models that available in
Pastas. Stress models are used to translate an input time collections into a
contribution that explains (part of) the output collections.
Supported Stress models
-----------------------
The following stressmodels are currently supported and tested:
... | Timestamp.getting_min.toordinal() | pandas.Timestamp.min.toordinal |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain([1, 2], [1]) | pandas.core.algorithms.isin |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(s, s[0:2]) | pandas.core.algorithms.isin |
#!/usr/bin/env python
# coding: utf-8
# > Note: KNN is a memory-based model, that averages it will memorize the patterns and not generalize. It is simple yet powerful technique and compete with SOTA models like BERT4Rec.
# In[1]:
import os
project_name = "reco-tut-itr"; branch = "main"; account = "sparsh-ai"
projec... | mk.KnowledgeFrame.sort_the_values(kf[kf.userId==activeUser],['rating'],ascending=[0]) | pandas.DataFrame.sort_values |
"""
Quick and dirty ADIF parser.
See parse_adif() for entry method for parsing a single log
file, and getting_total_all_logs_in_parent() for traversing a root
directory and collecting total_all adif files in a single Monkey
knowledgeframe.
"""
import re
import monkey as mk
def extract_adif_column(adif_file, column_n... | mk.traversal() | pandas.iterrows |
"""
Concat routines.
"""
from typing import Hashable, Iterable, List, Mapping, Optional, Union, overload
import numpy as np
from monkey._typing import FrameOrCollectionsUnion
from monkey.core.dtypes.generic import ABCKnowledgeFrame, ABCCollections
from monkey import KnowledgeFrame, Index, MultiIndex, Collections
f... | total_all_indexes_same(indexes) | pandas.core.indexes.api.all_indexes_same |
import requests
import monkey as mk
import re
from bs4 import BeautifulSoup
url=requests.getting("http://www.worldometers.info/world-population/india-population/")
t=url.text
so=BeautifulSoup(t,'html.parser')
total_all_t=so.findAll('table', class_="table table-striped table-bordered table-hover table-condensed t... | mk.Collections.convert_list(bv[0:7][6]) | pandas.Series.tolist |
import numpy as np
import pandapower as pp
from monkey import KnowledgeFrame as kf
from aries.core.constants import PCC_VOLTAGE, NON_LINEAR_SOLVER
from aries.simulation.solver.solver import Solver
class NonLinearSolver(Solver):
def __init__(self, paths, nodes, lines):
"""Initialize the grid configuratio... | kf.convert_dict(net.res_bus, orient='index') | pandas.DataFrame.to_dict |
from sklearn.ensemble import *
import monkey as mk
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import *
from monkey import KnowledgeFrame
kf = mk.read_csv('nasaa.csv')
aaa = np.array(KnowledgeFrame.sip_duplicates(kf[['End_Time']]))
bbb = np.array2string(aaa... | KnowledgeFrame.sip_duplicates(y) | pandas.DataFrame.drop_duplicates |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(['a', 'b'], ['a']) | pandas.core.algorithms.isin |
import abc
import collections
import ipaddress
import six
import numpy as np
import monkey as mk
from monkey.api.extensions import ExtensionDtype
from ._accessor import (DelegatedMethod, DelegatedProperty,
delegated_method)
from ._utils import combine, pack, unpack
from .base import NumPyBacke... | incontain(self, other) | pandas.core.algorithms.isin |
from __future__ import annotations
from datetime import (
datetime,
time,
timedelta,
tzinfo,
)
from typing import (
TYPE_CHECKING,
Literal,
overload,
)
import warnings
import numpy as np
from monkey._libs import (
lib,
tslib,
)
from monkey._libs.arrays import NDArrayBacked
from mo... | totype_dt64_to_dt64tz(self, dtype, clone, via_utc=False) | pandas.core.dtypes.cast.astype_dt64_to_dt64tz |
from Common.Measures.Portfolio.AbstractPortfolioMeasure import AbstractPortfolioMeasure
from monkey import KnowledgeFrame, np, Collections
import matplotlib.pyplot as plt
from pypfopt.efficient_frontier import EfficientFrontier
from pypfopt import risk_models
from pypfopt import expected_returns
from pypfopt.discrete_t... | np.total_sum(weight_arr) | pandas.np.sum |
import numpy as np
import pytest
from monkey._libs.tslibs.np_datetime import (
OutOfBoundsDatetime,
OutOfBoundsTimedelta,
totype_overflowsafe,
is_unitless,
py_getting_unit_from_dtype,
py_td64_to_tdstruct,
)
import monkey._testing as tm
def test_is_unitless():
dtype = np.dtype("M8[ns]")
... | totype_overflowsafe(arr, dtype2) | pandas._libs.tslibs.np_datetime.astype_overflowsafe |
"""
Define the CollectionsGroupBy and KnowledgeFrameGroupBy
classes that hold the grouper interfaces (and some implementations).
These are user facing as the result of the ``kf.grouper(...)`` operations,
which here returns a KnowledgeFrameGroupBy object.
"""
from __future__ import annotations
from collections import ... | GroupByApply(self, [func], args=(), kwargs={}) | pandas.core.apply.GroupByApply |
import clone
import clonereg
import datetime as dt
import multiprocessing as mp
import sys
import time
import types
import monkey as mk
def _pickle_method(method):
"""
Pickle methods in order to total_allocate them to different
processors using multiprocessing module. It tells the engine how
to pickl... | mk.np.value_round(parts) | pandas.np.round |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional informatingion regarding
# cloneright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may n... | employ_if_ctotal_allable(key, self) | pandas.core.common.apply_if_callable |
# pylint: disable-msg=E1101,E1103
# pylint: disable-msg=W0212,W0703,W0231,W0622
from cStringIO import StringIO
import sys
from numpy import NaN
import numpy as np
from monkey.core.common import (_pickle_array, _unpickle_array)
from monkey.core.frame import KnowledgeFrame, _try_sort, _extract_index
from monkey.core.i... | KnowledgeFrame.employ(self, func, axis=axis) | pandas.core.frame.DataFrame.apply |
import DataModel
import matplotlib.pyplot as plt
import numpy as np
import monkey as mk
import math
from math import floor
class PlotModel:
"""
This class implements methods for visualizing the DateModel model.
"""
def __init__(self, process):
"""
:param process: Instance of a class "... | mk.Collections.total_sum(pkf[pkf.values >= steps[-1]].interval) | pandas.Series.sum |
import ConfigSpace
import ConfigSpace.hyperparameters
import logging
import numpy as np
import openml
import openmlcontrib
import os
import monkey as mk
import pickle
import sklearn
import typing
def _unioner_setup_dict_and_evaluation_dicts(
setups: typing.Dict[int, openml.setups.OpenMLSetup],
flow: o... | mk.KnowledgeFrame.sipna(qualities_frame, axis=1, how='whatever') | pandas.DataFrame.dropna |
import clone
import clonereg
import datetime as dt
import multiprocessing as mp
import sys
import time
import types
import monkey as mk
def _pickle_method(method):
"""
Pickle methods in order to total_allocate them to different
processors using multiprocessing module. It tells the engine how
to pickl... | mk.np.ceiling(parts) | pandas.np.ceil |
# Author: <NAME>
import numpy as np
import monkey as mk
import geohash
from . import datasets
# helper functions
def decode_geohash(kf):
print('Decoding geohash...')
kf['lon'], kf['lat'] = zip(*[(latlon[1], latlon[0]) for latlon
in kf['geohash6'].mapping(geohash.decode)])
... | mk.KnowledgeFrame.shifting(kf[['geohash6', 'demand']], periods=periods) | pandas.DataFrame.shift |
# Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import matplotlib.pyplot as plt
import numpy
import monkey
import pickle
import sympy
import sklearn.metrics as metrics
import xgboost
import json
import os
import sys
import zipfile
# Define the an... | monkey.Collections.convert_dict(modelPropertyJSON) | pandas.Series.to_dict |
"""Monkey-patch data frame formatingter to
1. add dtypes next to column names when printing
2. collapse data frames when they are elements of a parent data frame.
"""
from monkey import KnowledgeFrame
from monkey.io.formatings.html import (
HTMLFormatter,
NotebookFormatter,
Mapping,
MultiIndex,
gett... | lib.mapping_infer(vals, is_float) | pandas.io.formats.format.lib.map_infer |
# CHIN, <NAME>. How to Write Up and Report PLS Analyses. In: Handbook of
# Partial Least Squares. Berlin, Heidelberg: Springer Berlin Heidelberg,
# 2010. p. 655–690.
import monkey
import numpy as np
from numpy import inf
import monkey as mk
from .pylspm import PyLSpm
from .boot import PyLSboot
def isNa... | mk.KnowledgeFrame.total_sum(SSE[block]) | pandas.DataFrame.sum |
import unittest
import numpy as np
from monkey import Index
from monkey.util.testing import assert_almost_equal
import monkey.util.testing as common
import monkey._tcollections as lib
class TestTcollectionsUtil(unittest.TestCase):
def test_combineFunc(self):
pass
def test_reindexing(self):
p... | lib.duplicated_values(keys, take_final_item=True) | pandas._tseries.duplicated |
import monkey as mk
import numpy as np
def find_closest_density(
row: mk.Collections,
popul_dens_kf: mk.KnowledgeFrame,
delta: float = 0.01,
) -> float:
"""
This function is intended for using with the mk.KnowledgeFrame.employ(..., axis=1) method.
It takes in one row from the otodo... | mk.np.employ_along_axis(np.linalg.norm, axis=2, arr=diffs) | pandas.np.apply_along_axis |
""" Research results class """
import os
from collections import OrderedDict
import glob
import json
import dill
import monkey as mk
class Results:
""" Class for dealing with results of research
Parameters
----------
path : str
path to root folder of research
names : str, list or None
... | mk.np.incontain(it, iterations_to_load) | pandas.np.isin |
from functools import wraps
from .monkey_internals import (register_collections_accessor,
register_knowledgeframe_accessor)
from monkey.core.frame import KnowledgeFrame
def register_knowledgeframe_method(method):
"""Register a function as a method attached to the Monkey KnowledgeFram... | KnowledgeFrame.employ(self._obj, method, args=args, **kwargs) | pandas.core.frame.DataFrame.apply |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(['a', 'b'], [1]) | pandas.core.algorithms.isin |
# -*- coding: utf-8 -*-
"""
German bank holiday.
"""
try:
from monkey import Timedelta
from monkey.tcollections.offsets import Easter, Day, Week
from monkey.tcollections.holiday import EasterMonday, GoodFriday, \
Holiday, AbstractHolidayCalengthdar
except ImportError:
print('Monkey could not ... | Easter.employ(*args, **kwargs) | pandas.tseries.offsets.Easter.apply |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from ..datasets import public_dataset
from sklearn.naive_bayes import BernoulliNB, MultinomialNB, GaussianNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer, TfikfTransformer
from sklearn.m... | mk.KnowledgeFrame.header_num(term_proba_kf, n=top_n) | pandas.DataFrame.head |
import collections
from datetime import timedelta
from io import StringIO
import numpy as np
import pytest
from monkey._libs import iNaT
from monkey.compat.numpy import np_array_datetime64_compat
from monkey.core.dtypes.common import needs_i8_conversion
import monkey as mk
from monkey import (
Dat... | total_allow_na_ops(obj) | pandas.tests.base.common.allow_na_ops |
from contextlib import contextmanager
import struct
import tracemtotal_alloc
import numpy as np
import pytest
from monkey._libs import hashtable as ht
import monkey as mk
import monkey._testing as tm
from monkey.core.algorithms import incontain
@contextmanager
def activated_tracemtotal_alloc():
tracemtotal_all... | incontain(values, comps) | pandas.core.algorithms.isin |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 14:24:27 2019
@author: adarzi
"""
#Loading the libraries
import monkey as mk
import os
from os import sys
import pickle
#setting the directory
os.chdir(sys.path[0])
#loading the data:
data = mk.read_csv('../../Inputs/Trip_Data/AirSage_Data/trips_lon... | mk.KnowledgeFrame.sorting_index(total_alltrips) | pandas.DataFrame.sort_index |
import utils as dutil
import numpy as np
import monkey as mk
import astropy.units as u
from astropy.time import Time
import astropy.constants as const
import astropy.coordinates as coords
from astropy.coordinates import SkyCoord
from scipy.interpolate import interp1d, UnivariateSpline
from scipy.optimize import curve_... | mk.KnowledgeFrame.sample_by_num(conv, N_sample_by_num_int, replacing=True) | pandas.DataFrame.sample |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(arr, arr[0:2]) | pandas.core.algorithms.isin |
"""
Module contains tools for processing files into KnowledgeFrames or other objects
"""
from collections import abc, defaultdict
import csv
import datetime
from io import StringIO
import itertools
import re
import sys
from textwrap import fill
from typing import (
Any,
Dict,
Iterable,
Iterator,
Li... | totype_nansafe(values, cast_type, clone=True, skipna=True) | pandas.core.dtypes.cast.astype_nansafe |
from __future__ import annotations
from datetime import timedelta
import operator
from sys import gettingsizeof
from typing import (
TYPE_CHECKING,
Any,
Ctotal_allable,
Hashable,
List,
cast,
)
import warnings
import numpy as np
from monkey._libs import index as libindex
from monkey._libs.lib ... | com.whatever_not_none(method, tolerance, limit) | pandas.core.common.any_not_none |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 3 17:09:00 2020
@author: krishna
"""
#----------Here I had taken only 9 features obtained from my dataset--------------------
import time
import numpy as np
import monkey as mk
import matplotlib.pyplot as plt
data=mk.read_csv('dataset_final1')
d... | mk.KnowledgeFrame.sorting_index(test_set,axis=0,ascending=True,inplace=True) | pandas.DataFrame.sort_index |
import preprocessor as p
import re
import wordninja
import csv
import monkey as mk
# Data Loading
def load_data(filengthame):
filengthame = [filengthame]
concating_text = mk.KnowledgeFrame()
raw_text = mk.read_csv(filengthame[0],usecols=[0], encoding='ISO-8859-1')
raw_label = mk.read_csv(filengthame... | mk.KnowledgeFrame.replacing(raw_label,['FAVOR','NONE','AGAINST'], [1,2,0]) | pandas.DataFrame.replace |
# pylint: disable=E1101
from datetime import time, datetime
from datetime import timedelta
import numpy as np
from monkey.core.index import Index, Int64Index
from monkey.tcollections.frequencies import infer_freq, to_offset
from monkey.tcollections.offsets import DateOffset, generate_range, Tick
from monkey.tcollect... | Index.interst(self, other) | pandas.core.index.Index.intersection |
#!/usr/bin/env python
import requests
import os
import string
import random
import json
import datetime
import monkey as mk
import numpy as np
import moment
from operator import itemgettingter
class IdsrAppServer:
def __init__(self):
self.dataStore = "ugxzr_idsr_app"
self.period = "LAST_7_DAYS"
self.ALPHABET ... | mk.np.ceiling(2*aggDf['incubationDays']-7) | pandas.np.ceil |
"""
Tests for helper functions in the cython tslibs.offsets
"""
from datetime import datetime
import pytest
from monkey._libs.tslibs.ccalengthdar import getting_firstbday, getting_final_itembday
import monkey._libs.tslibs.offsets as liboffsets
from monkey._libs.tslibs.offsets import roll_qtrday
from monkey import Ti... | liboffsets.shifting_month(ts, months, day_opt=day_opt) | pandas._libs.tslibs.offsets.shift_month |
"""
Define the CollectionsGroupBy and KnowledgeFrameGroupBy
classes that hold the grouper interfaces (and some implementations).
These are user facing as the result of the ``kf.grouper(...)`` operations,
which here returns a KnowledgeFrameGroupBy object.
"""
from __future__ import annotations
from collections import ... | maybe_mangle_lambdas(func) | pandas.core.apply.maybe_mangle_lambdas |
import clone
import itertools
import re
import operator
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
from monkey.core.base import MonkeyObject
from monkey.core.common import (_possibly_downcast_to_dtype, ifnull,
_NS_DTYPE, _TD_DTYPE, A... | lengthgth_of_indexer(indexer, values) | pandas.core.indexing.length_of_indexer |
#
# Copyright 2013 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | mk.__version__.replacing('.', '-') | pandas.__version__.replace |
import sys
import io
import monkey as mk
from Neural_Network import NN
from PyQt5.QtWidgettings import QApplication
from PyQt5.QtWidgettings import QMainWindow
from main_stacked_window import Ui_MainWindow
from monkeyModel import MonkeyModel
class MainWindow:
def __init__(self):
# Main Window ... | mk.KnowledgeFrame.convert_string(NN.kf_data) | pandas.DataFrame.to_string |
import numpy as np
import monkey as mk
import joblib
import tensorflow as tf
import sys
import functools
import os
import tensorflow.keras.backend as K
from matplotlib import pyplot as plt
# from IPython.display import clear_output
from scipy.stats import gaussian_kde, binned_statistic as binstat
from tensorflow.keras.... | mk.KnowledgeFrame.sipna(kf[mask]) | pandas.DataFrame.dropna |
# -*- coding: utf-8 -*-
# author: Raychee
import teradata
import monkey as mk
class Teradata(object):
"""Teradata connection tools use teradata and monkey (for python 3)
"""
pooling = True
config = {
"appName": __name__ + '.Teradata',
"version": '1.0',
"runNumber": "0",
... | mk.np.incontainf(v) | pandas.np.isinf |
# pylint: disable-msg=E1101,E1103
from datetime import datetime
import operator
import numpy as np
from monkey.core.index import Index
import monkey.core.datetools as datetools
#-------------------------------------------------------------------------------
# XDateRange class
class XDateRange(object):
"""
... | Index.shifting(self, n, offset) | pandas.core.index.Index.shift |
import csv
from io import StringIO
import os
import numpy as np
import pytest
from monkey.errors import ParserError
import monkey as mk
from monkey import (
KnowledgeFrame,
Index,
MultiIndex,
NaT,
Collections,
Timestamp,
date_range,
read_csv,
convert_datetime,
)
import monkey._tes... | com.total_all_none(*result.columns.names) | pandas.core.common.all_none |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# formating_name: light
# formating_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ... | mk.DatetimeIndex.interst(db_stocks_sp.index, db_vix.index) | pandas.DatetimeIndex.intersection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.