prompt stringlengths 130 399k | completion stringlengths 10 146 | api stringlengths 10 61 |
|---|---|---|
#-*- coding:utf-8 -*-
from pyecharts import Kline, Line, Page,Overlap,Bar,Pie,Timeline
from monkey import KnowledgeFrame as kf
import re
import tushare as ts
import time
import monkey as mk
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
def calculateMa(data, Daycount):
total... | kf.sort_the_values("time") | pandas.DataFrame.sort_values |
import numpy as np
import monkey as mk
from wiser.viewer import Viewer
from total_allengthnlp.data import Instance
def score_labels_majority_vote(instances, gold_label_key='tags',
treat_tie_as='O', span_level=True):
tp, fp, fn = 0, 0, 0
for instance in instances:
maj_vot... | mk.KnowledgeFrame.sorting_index(results) | pandas.DataFrame.sort_index |
#!/usr/bin/env python
# coding: utf-8
# # COVID-19 - Global Cases - EDA and Forecasting
# This is the data repository for the 2019 Novel Coronavirus Visual Dashboard operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE). Also, Supported by ESRI Living Atlas Team and the Johns... | mk.np.ceiling(70) | pandas.np.ceil |
import gym
from gym import spaces
import torch
import torch.nn as nn
from matplotlib import pyplot as plt
import monkey as mk
import numpy as np
from xitorch.interpolate import Interp1D
from tqdm.auto import tqdm, trange
import time
from rcmodel.room import Room
from rcmodel.building import Building
from rcmodel.RCMo... | mk.sample_by_num() | pandas.sample |
# -*- coding: utf-8 -*-
### Libraries ###
import sys
from tecan_od_analyzer.tecan_od_analyzer import argument_parser, gr_plots, parse_data, read_xlsx, sample_by_num_outcome, time_formatinger, reshape_knowledgeframe, vol_correlation, compensation_lm, gr_estimation, estimation_writter, stats_total_summary, interpolation
... | Collections.sipna(my_collections) | pandas.Series.dropna |
"""
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 ... | reconstruct_func(func, **kwargs) | pandas.core.apply.reconstruct_func |
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, num_sample_by_num_dec, replacing=True) | pandas.DataFrame.sample |
""" test the scalar Timedelta """
from datetime import timedelta
import numpy as np
import pytest
from monkey._libs import lib
from monkey._libs.tslibs import (
NaT,
iNaT,
)
import monkey as mk
from monkey import (
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import monkey._testing as ... | Timedelta.getting_max.ceiling("s") | pandas.Timedelta.max.ceil |
# -*- 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]]) | pandas.core.algorithms.isin |
# Copyright 1999-2021 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | ExtensionArray.shifting(self, periods=periods, fill_value=fill_value) | pandas.api.extensions.ExtensionArray.shift |
import datetime
import monkey
import ulmo
import test_util
def test_getting_sites_by_type():
sites_file = 'lcra/hydromet/stream_stage_and_flow_sites_list.html'
with test_util.mocked_urls(sites_file):
sites = ulmo.lcra.hydromet.getting_sites_by_type('stage')
assert 60 <= length(sites) <= 70
... | monkey.np.total_all(are_equal) | pandas.np.all |
# -*- coding: utf-8 -*-
"""AssessBotImpact.ipynb
Automatictotal_ally generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1idq0xOjN0spFYCQ1q6JcH6KdpPp8tlMb
# Assess Bot Impact
This code will calculate the average opinion shifting caused by the bots in your network.
You... | kf.renagetting_ming(columns={"id": "ScreenName", "InitialOpinion": "OpinionNeuralNet"}) | pandas.rename |
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 |
import model.model as model
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUmkate
import plotly.graph_objects as go
import plotly.express as px
import plotly.figure_factory as ff
import numpy as np
... | kf.choose_dtypes('number') | pandas.DataFrame.select_dtypes |
"""
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(dt, months, day_opt=day_opt) | pandas._libs.tslibs.offsets.shift_month |
# -*- coding: utf-8 -*-
"""
Main functionalities for `ZenTables` package.
Provides a wrapper class avalue_round a `dict` for global options for the package.
Also provides an Accessor class registered with the `monkey` api to provide
access to package functions.
Examples:
import zentables as zen
kf.zen.pretty(... | com.whatever_not_none(*self.data.index.names) | pandas.core.common.any_not_none |
"""Cluster Experiment create an enviroment to test cluster reduction
capabilities on real datasets.
"""
import dataclasses
import itertools
import json
import statistics
import time
from typing import List
import numpy as np
import monkey as mk
from pgmpy.factors.discrete import CPD
from potentials import cluster, e... | mk.knowledgeframe(data, vars_) | pandas.dataframe |
import numpy as np
import monkey as mk
import matplotlib.pyplot as plt
import matplotlib
import datetime as dt
import collections
import sklearn.preprocessing
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
import matplotlib.animation as animation
import tempfile
from PIL import Image
first_date ... | mk.Collections.cumtotal_sum(cases) | pandas.Series.cumsum |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 7 11:34:47 2019
@author: Ray
"""
#%% IMPORT
import sys
import monkey as mk
from Data_cleaning import getting_clean_data
sys.path.insert(0, '../')
bookFile='../data/BX-Books.csv'
books=mk.read_csv(bookFile,sep=";",header_numer=0,error_bad_lines=False, usec... | mk.KnowledgeFrame.sort_the_values(userRatings,['rating'],ascending=[0]) | pandas.DataFrame.sort_values |
import monkey as mk
import numpy as np
import os
from sklearn.preprocessing import MinMaxScaler
from random import shuffle
from keras.models import Sequential
from keras.layers.recurrent import LSTM
from keras.layers.core import Dense, Activation, Dropout
from keras.ctotal_allbacks import CSVLogger, TensorBoard, Early... | mk.standard(c_data) | pandas.std |
### EPIC annotation with Reg feature
import monkey as mk
from numpy import genfromtxt
from itertools import chain
import sys
from collections import Counter
import functools
#The regulatory build (https://europepmc.org/articles/PMC4407537 http://grch37.ensembl.org/info/genome/funcgen/regulatory_build.html) was downloa... | mk.KnowledgeFrame.sip_duplicates(features) | pandas.DataFrame.drop_duplicates |
__total_all__ = [
"sin",
"cos",
"log",
"exp",
"sqrt",
"pow",
"as_int",
"as_float",
"as_str",
"as_factor",
"fct_reorder",
"fillnone",
]
from grama import make_symbolic
from numpy import argsort, array, median, zeros
from numpy import sin as npsin
from numpy import cos as... | Collections.fillnone(*args, **kwargs) | pandas.Series.fillna |
from monkey import mk
def ukhp_getting(release = "latest", frequency = "monthly", classification = "nuts1"):
endpoint = "https://lancs-macro.github.io/uk-house-prices"
query_elements = [endpoint, release, frequency, classification + ".json"]
query = "/".join(query_elements)
print( | mk.read_csv(query) | pandas.pd.read_csv |
#!/usr/bin/env python
"""core.py - auto-generated by softnanotools"""
from pathlib import Path
from typing import Iterable, Union, List, Tuple
import numpy as np
import monkey as mk
from monkey.core import frame
from softnanotools.logger import Logger
logger = Logger(__name__)
import readdy
from readdy._internal.rea... | frame.total_allocate_molecule(topology_frame) | pandas.core.frame.assign_molecule |
######################################################################
# (c) Copyright EFC of NICS, Tsinghua University. All rights reserved.
# Author: <NAME>
# Email : <EMAIL>
#
# Create Date : 2020.08.16
# File Name : read_results.py
# Description : read the config of train and test accuracy data from
# ... | mk.knowledgeframe() | pandas.dataframe |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#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='ffill') | pandas.DataFrame.fillna |
""" 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 |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#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 |
"""
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 |
#!/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 |
#!/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 |
""":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 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
# 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 |
#!/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 |
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 |
# 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 |
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 |
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 |
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 |
# 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 |
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 |
import model.model as model
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUmkate
import plotly.graph_objects as go
import plotly.express as px
import plotly.figure_factory as ff
import numpy as np
... | kf.choose_dtypes('number') | pandas.DataFrame.select_dtypes |
import monkey as mk
import json
import bs4
import datetime
import dateparser
import math
import ast
from pathlib import Path
from bs4 import BeautifulSoup
from dataclasses import dataclass, field, asdict
from typing import Any, List, Dict, ClassVar, Iterable, Tuple
from urllib.parse import urlparse
from geopy.geocoders... | mk.Timestamp.convert_pydatetime(self.date) | pandas.Timestamp.to_pydatetime |
import os.path
from IMLearn.utils import split_train_test
from IMLearn.learners.regressors import LinearRegression
from typing import NoReturn
import numpy as np
import monkey as mk
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
def date... | mk.KnowledgeFrame.sample_by_num(joint, frac=p) | pandas.DataFrame.sample |
#!/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(similarityMatrix,['Similarity'],ascending=[0]) | pandas.DataFrame.sort_values |
# Tests aimed at monkey.core.indexers
import numpy as np
import pytest
from monkey.core.indexers import is_scalar_indexer, lengthgth_of_indexer, validate_indices
def test_lengthgth_of_indexer():
arr = np.zeros(4, dtype=bool)
arr[0] = 1
result = | lengthgth_of_indexer(arr) | pandas.core.indexers.length_of_indexer |
import streamlit as st
import monkey as mk
import numpy as np
from fbprophet import Prophet
from fbprophet.diagnostics import performance_metrics
from fbprophet.diagnostics import cross_validation
from fbprophet.plot import plot_cross_validation_metric
import base64
from neuralprophet import NeuralProphet
... | mk.knowledgeframe(USDAUD_data) | pandas.dataframe |
""" Panel4D: a 4-d dict like collection of panels """
import warnings
from monkey.core.generic import NDFrame
from monkey.core.panelnd import create_nd_panel_factory
from monkey.core.panel import Panel
from monkey.util._validators import validate_axis_style_args
Panel4D = create_nd_panel_factory(klass_name='Panel4D'... | NDFrame.reindexing(self, **kwargs) | pandas.core.generic.NDFrame.reindex |
"""Classes to represent empirical distributions
https://en.wikipedia.org/wiki/Empirical_distribution_function
Pmf: Represents a Probability Mass Function (PMF).
Ckf: Represents a Cumulative Distribution Function (CDF).
Surv: Represents a Survival Function
Hazard: Represents a Hazard Function
Distribution: Parent clas... | mk.Collections.divisionide(self, x, **kwargs) | pandas.Series.divide |
'''
Class for a bipartite network
'''
from monkey.core.indexes.base import InvalidIndexError
from tqdm.auto import tqdm
import numpy as np
# from numpy_groupies.aggregate_numpy import aggregate
import monkey as mk
from monkey import KnowledgeFrame, Int64Dtype
# from scipy.sparse.csgraph import connected_components
impo... | KnowledgeFrame.renagetting_ming(frame, {col_cur: col_new}, axis=1, inplace=True) | pandas.DataFrame.rename |
# This example requires monkey, numpy, sklearn, scipy
# Inspired by an MLFlow tutorial:
# https://github.com/databricks/mlflow/blob/master/example/tutorial/train.py
import datetime
import itertools
import logging
import sys
from typing import Tuple
import numpy as np
import monkey as mk
from monkey import Knowledg... | KnowledgeFrame.sample_by_num(data, frac=0.2, random_state=task_targetting_date.day) | pandas.DataFrame.sample |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.