├── .bandit ├── .clang-format ├── .gitattributes ├── .gitignore ├── .pep8speaks.yml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── LICENSE.md ├── MANIFEST.in ├── README.rst ├── azure-pipelines.yml ├── benchmarks ├── LICENSE ├── census_benchmark.py └── exchange_benchmark.py ├── buildscripts ├── autogen_sources.py ├── azure │ ├── template-linux-macos.yml │ └── template-windows.yml ├── build.py ├── build_doc.py ├── install_conda.bat ├── install_conda.sh ├── run_benchmarks.py ├── run_examples.py ├── test.py ├── test_conda_install.py └── utilities.py ├── conda-recipe ├── bld.bat ├── build.sh ├── conda_build_config.yaml ├── meta.yaml ├── run_test.bat └── run_test.sh ├── docs ├── Makefile ├── README.rst ├── make.bat └── source │ ├── _images │ ├── intel_sdc_large_logo.png │ ├── intel_sdc_large_logo.pptx │ ├── scalability.png │ ├── scalability.pptx │ ├── scalability_with_logo.png │ ├── scalability_with_logo.pptx │ ├── timing.png │ ├── timing.pptx │ ├── workflow.png │ └── workflow.pptx │ ├── _templates │ ├── _api_ref.pandas.dataframe_templ.rst │ ├── _api_ref.pandas.groupby_templ.rst │ ├── _api_ref.pandas.io_templ.rst │ ├── _api_ref.pandas.series_templ.rst │ └── _api_ref.pandas.window_templ.rst │ ├── apireference.rst │ ├── buildscripts │ ├── __init__.py │ ├── apiref_generator.py │ ├── examples_generator.py │ ├── module_info.py │ ├── pandas_info.py │ ├── sdc2pd_name.py │ ├── sdc_build_doc.py │ ├── sdc_doc_utils.py │ ├── sdc_info.py │ ├── sdc_object_utils.py │ └── user_guide_gen.py │ ├── compilation.rst │ ├── conf.py │ ├── examples.rst │ ├── ext_links.txt │ ├── for_developers.rst │ ├── getting_started.rst │ ├── index.rst │ ├── other_intel_python_projects.rst │ ├── overview.rst │ ├── performance.rst │ ├── sdc-sphinx-theme │ ├── globaltoc.html │ ├── layout.html │ ├── localtoc.html │ ├── searchbox.html │ ├── static │ │ ├── SDC.png │ │ ├── copybutton.js │ │ ├── intel_logo.png │ │ ├── sdc.css │ │ ├── sdc_email.png │ │ ├── sdc_examples.png │ │ ├── sdc_github.png │ │ ├── sdc_issues.png │ │ └── sidebar.js │ └── theme.conf │ └── workflow.rst ├── examples ├── basic_usage_nyse_predict.py ├── basic_workflow.py ├── basic_workflow_batch.py ├── basic_workflow_parallel.py ├── dataframe │ ├── dataframe_append.py │ ├── dataframe_at.py │ ├── dataframe_columns.py │ ├── dataframe_copy.py │ ├── dataframe_count.py │ ├── dataframe_drop.py │ ├── dataframe_head.py │ ├── dataframe_iat.py │ ├── dataframe_iloc.py │ ├── dataframe_index.py │ ├── dataframe_isin.py │ ├── dataframe_isin_df.py │ ├── dataframe_isin_dict.py │ ├── dataframe_isin_ser.py │ ├── dataframe_isna.py │ ├── dataframe_loc.py │ ├── dataframe_max.py │ ├── dataframe_mean.py │ ├── dataframe_median.py │ ├── dataframe_min.py │ ├── dataframe_pct_change.py │ ├── dataframe_prod.py │ ├── dataframe_reset_index_drop_False.py │ ├── dataframe_reset_index_drop_True.py │ ├── dataframe_rolling_sum.py │ ├── dataframe_std.py │ ├── dataframe_sum.py │ ├── dataframe_values.py │ ├── dataframe_var.py │ ├── getitem │ │ ├── df_getitem.py │ │ ├── df_getitem_array.py │ │ ├── df_getitem_attr.py │ │ ├── df_getitem_series.py │ │ ├── df_getitem_slice.py │ │ └── df_getitem_tuple.py │ ├── groupby │ │ ├── dataframe_groupby_count.py │ │ ├── dataframe_groupby_max.py │ │ ├── dataframe_groupby_mean.py │ │ ├── dataframe_groupby_median.py │ │ ├── dataframe_groupby_min.py │ │ ├── dataframe_groupby_prod.py │ │ ├── dataframe_groupby_std.py │ │ ├── dataframe_groupby_sum.py │ │ └── dataframe_groupby_var.py │ ├── rolling │ │ ├── dataframe_rolling_apply.py │ │ ├── dataframe_rolling_corr.py │ │ ├── dataframe_rolling_count.py │ │ ├── dataframe_rolling_cov.py │ │ ├── dataframe_rolling_kurt.py │ │ ├── dataframe_rolling_max.py │ │ ├── dataframe_rolling_mean.py │ │ ├── dataframe_rolling_median.py │ │ ├── dataframe_rolling_min.py │ │ ├── dataframe_rolling_quantile.py │ │ ├── dataframe_rolling_skew.py │ │ ├── dataframe_rolling_std.py │ │ ├── dataframe_rolling_sum.py │ │ └── dataframe_rolling_var.py │ └── setitem │ │ ├── df_set_existing_column.py │ │ └── df_set_new_column.py ├── employees.csv ├── employees_batch1.csv ├── employees_batch2.csv └── series │ ├── rolling │ ├── series_rolling_apply.py │ ├── series_rolling_corr.py │ ├── series_rolling_count.py │ ├── series_rolling_cov.py │ ├── series_rolling_kurt.py │ ├── series_rolling_max.py │ ├── series_rolling_mean.py │ ├── series_rolling_median.py │ ├── series_rolling_min.py │ ├── series_rolling_quantile.py │ ├── series_rolling_skew.py │ ├── series_rolling_std.py │ ├── series_rolling_sum.py │ └── series_rolling_var.py │ ├── series_T.py │ ├── series_abs.py │ ├── series_add.py │ ├── series_append.py │ ├── series_apply.py │ ├── series_apply_lambda.py │ ├── series_apply_log.py │ ├── series_argsort.py │ ├── series_astype.py │ ├── series_at │ ├── series_at_multiple_result.py │ └── series_at_single_result.py │ ├── series_copy.py │ ├── series_corr.py │ ├── series_count.py │ ├── series_cov.py │ ├── series_cumsum.py │ ├── series_describe.py │ ├── series_div.py │ ├── series_dropna.py │ ├── series_eq.py │ ├── series_fillna.py │ ├── series_floordiv.py │ ├── series_ge.py │ ├── series_getitem │ ├── series_getitem_bool_array.py │ ├── series_getitem_scalar_multiple_result.py │ ├── series_getitem_scalar_single_result.py │ ├── series_getitem_series.py │ └── series_getitem_slice.py │ ├── series_groupby.py │ ├── series_gt.py │ ├── series_head.py │ ├── series_iat.py │ ├── series_idxmax.py │ ├── series_idxmin.py │ ├── series_iloc │ ├── series_iloc_slice.py │ └── series_iloc_value.py │ ├── series_index.py │ ├── series_isin.py │ ├── series_isna.py │ ├── series_isnull.py │ ├── series_le.py │ ├── series_loc │ ├── series_loc_multiple_result.py │ ├── series_loc_single_result.py │ └── series_loc_slice.py │ ├── series_lt.py │ ├── series_map.py │ ├── series_max.py │ ├── series_mean.py │ ├── series_median.py │ ├── series_min.py │ ├── series_mod.py │ ├── series_mul.py │ ├── series_ndim.py │ ├── series_ne.py │ ├── series_nlargest.py │ ├── series_notna.py │ ├── series_nsmallest.py │ ├── series_nunique.py │ ├── series_pct_change.py │ ├── series_pow.py │ ├── series_prod.py │ ├── series_quantile.py │ ├── series_rename.py │ ├── series_setitem_int.py │ ├── series_setitem_series.py │ ├── series_setitem_slice.py │ ├── series_shape.py │ ├── series_shift.py │ ├── series_size.py │ ├── series_skew.py │ ├── series_sort_values.py │ ├── series_std.py │ ├── series_sub.py │ ├── series_sum.py │ ├── series_take.py │ ├── series_truediv.py │ ├── series_unique.py │ ├── series_value_counts.py │ ├── series_values.py │ ├── series_var.py │ └── str │ ├── series_str_capitalize.py │ ├── series_str_casefold.py │ ├── series_str_center.py │ ├── series_str_contains.py │ ├── series_str_endswith.py │ ├── series_str_find.py │ ├── series_str_isalnum.py │ ├── series_str_isalpha.py │ ├── series_str_isdecimal.py │ ├── series_str_isdigit.py │ ├── series_str_islower.py │ ├── series_str_isnumeric.py │ ├── series_str_isspace.py │ ├── series_str_istitle.py │ ├── series_str_isupper.py │ ├── series_str_len.py │ ├── series_str_ljust.py │ ├── series_str_lower.py │ ├── series_str_lstrip.py │ ├── series_str_rjust.py │ ├── series_str_rstrip.py │ ├── series_str_startswith.py │ ├── series_str_strip.py │ ├── series_str_swapcase.py │ ├── series_str_title.py │ ├── series_str_upper.py │ └── series_str_zfill.py ├── generate_data ├── all_syms.csv ├── data │ └── top25babynames-by-sex-2005-2017.csv ├── gen_employees_csv.py └── gen_kde_pq.py ├── parquet_reader ├── CMakeLists.txt ├── Makefile └── hpat_parquet_reader.cpp ├── requirements.txt ├── sdc ├── __init__.py ├── _datetime_ext.cpp ├── _datetime_ext.h ├── _distributed.cpp ├── _distributed.h ├── _hiframes.cpp ├── _hpat_common.h ├── _hpat_sort.h ├── _import_py.h ├── _set_ext.cpp ├── _str_ext.cpp ├── _version.py ├── compiler.py ├── config.py ├── cv_ext.py ├── datatypes │ ├── __init__.py │ ├── categorical │ │ ├── __init__.py │ │ ├── boxing.py │ │ ├── functions.py │ │ ├── init.py │ │ ├── models.py │ │ ├── pandas_support.py │ │ ├── pdimpl.py │ │ ├── rewrites.py │ │ ├── typeof.py │ │ └── types.py │ ├── common │ │ ├── __init__.py │ │ └── rewriteutils.py │ ├── common_functions.py │ ├── hpat_pandas_dataframe_functions.py │ ├── hpat_pandas_dataframe_getitem_types.py │ ├── hpat_pandas_dataframe_pass.py │ ├── hpat_pandas_dataframe_rolling_functions.py │ ├── hpat_pandas_dataframe_rolling_types.py │ ├── hpat_pandas_dataframe_types.py │ ├── hpat_pandas_functions.py │ ├── hpat_pandas_getitem_types.py │ ├── hpat_pandas_groupby_functions.py │ ├── hpat_pandas_groupby_types.py │ ├── hpat_pandas_rolling_types.py │ ├── hpat_pandas_series_functions.py │ ├── hpat_pandas_series_rolling_functions.py │ ├── hpat_pandas_series_rolling_types.py │ ├── hpat_pandas_stringmethods_functions.py │ ├── hpat_pandas_stringmethods_types.py │ ├── indexes │ │ ├── __init__.py │ │ ├── empty_index_type.py │ │ ├── int64_index_type.py │ │ ├── multi_index_type.py │ │ ├── positional_index_type.py │ │ └── range_index_type.py │ ├── pandas_series_functions │ │ ├── __init__.py │ │ ├── apply.py │ │ └── map.py │ ├── sdc_typeref.py │ └── series │ │ ├── __init__.py │ │ ├── boxing.py │ │ ├── init.py │ │ ├── pdimpl.py │ │ ├── rewrites.py │ │ └── types.py ├── decorators.py ├── distributed.py ├── distributed_analysis.py ├── distributed_api.py ├── distributed_lower.py ├── extensions │ ├── __init__.py │ ├── indexes │ │ ├── __init__.py │ │ ├── empty_index_ext.py │ │ ├── indexes_generic.py │ │ ├── int64_index_ext.py │ │ ├── multi_index_ext.py │ │ ├── multi_index_helpers.py │ │ ├── positional_index_ext.py │ │ └── range_index_ext.py │ ├── sdc_arrow_table_ext.py │ ├── sdc_arrow_table_type.py │ ├── sdc_hashmap_ext.py │ ├── sdc_hashmap_type.py │ ├── sdc_string_view_ext.py │ └── sdc_string_view_type.py ├── functions │ ├── __init__.py │ ├── numpy_like.py │ ├── sort.py │ ├── statistics.py │ └── tuple_utils.py ├── hiframes │ ├── __init__.py │ ├── aggregate.py │ ├── api.py │ ├── boxing.py │ ├── join.py │ ├── pd_categorical_ext.py │ ├── pd_dataframe_ext.py │ ├── pd_dataframe_type.py │ ├── pd_series_ext.py │ ├── pd_series_type.py │ ├── pd_timestamp_ext.py │ ├── rolling.py │ └── sort.py ├── io │ ├── __init__.py │ ├── _io.cpp │ ├── _parquet.cpp │ ├── csv_ext.py │ ├── np_io.py │ └── parquet_pio.py ├── native │ ├── arrow_reader.cpp │ ├── conc_dict_module.cpp │ ├── hashmap.hpp │ ├── module.cpp │ ├── sort.cpp │ ├── stable_sort.cpp │ ├── str_ext │ │ ├── sdc_std_string.hpp │ │ ├── sdc_std_string_view.hpp │ │ ├── sdc_str_arr.hpp │ │ └── sdc_str_decode.hpp │ ├── stringlib │ │ ├── asciilib.h │ │ ├── bytesobject.cpp │ │ ├── codecs.h │ │ ├── ucs1lib.h │ │ ├── ucs2lib.h │ │ ├── ucs4lib.h │ │ └── undef.h │ ├── utils.cpp │ └── utils.hpp ├── rewrites │ ├── __init__.py │ ├── dataframe_constructor.py │ ├── dataframe_getitem_attribute.py │ ├── dict_zip_tuples.py │ ├── ir_utils.py │ └── read_csv_consts.py ├── runtests.py ├── sdc_autogenerated.py ├── sdc_function_templates.py ├── set_ext.py ├── shuffle_utils.py ├── str_arr_ext.py ├── str_arr_type.py ├── str_ext.py ├── tests │ ├── __init__.py │ ├── categorical │ │ ├── __init__.py │ │ ├── test_categorical.py │ │ ├── test_categoricaldtype.py │ │ ├── test_df_category.py │ │ └── test_series_category.py │ ├── gen_test_data.py │ ├── indexes │ │ ├── __init__.py │ │ ├── index_datagens.py │ │ ├── test_empty_index.py │ │ ├── test_indexes.py │ │ ├── test_int64_index.py │ │ ├── test_multi_index.py │ │ ├── test_positional_index.py │ │ └── test_range_index.py │ ├── sdf_dt.pq.bz2 │ ├── test_base.py │ ├── test_basic.py │ ├── test_compile_time.py │ ├── test_d4p.py │ ├── test_dataframe.py │ ├── test_date.py │ ├── test_groupby.py │ ├── test_hiframes.py │ ├── test_hpat_jit.py │ ├── test_io.py │ ├── test_join.py │ ├── test_ml.py │ ├── test_prange_utils.py │ ├── test_rolling.py │ ├── test_sdc_numpy.py │ ├── test_series.py │ ├── test_series_apply.py │ ├── test_series_map.py │ ├── test_series_ops.py │ ├── test_strings.py │ ├── test_tbb_hashmap.py │ ├── test_utils.py │ └── tests_perf │ │ ├── README.md │ │ ├── __init__.py │ │ ├── data_generator.py │ │ ├── gen_csv.py │ │ ├── generator.py │ │ ├── test_perf_base.py │ │ ├── test_perf_df.py │ │ ├── test_perf_df_groupby.py │ │ ├── test_perf_df_rolling.py │ │ ├── test_perf_numpy.py │ │ ├── test_perf_read_csv.py │ │ ├── test_perf_series.py │ │ ├── test_perf_series_operators.py │ │ ├── test_perf_series_rolling.py │ │ ├── test_perf_series_str.py │ │ ├── test_perf_unicode.py │ │ └── test_perf_utils.py ├── timsort.py ├── transport │ └── hpat_transport_single_process.cpp ├── types.py └── utilities │ ├── __init__.py │ ├── prange_utils.py │ ├── sdc_typing_utils.py │ └── utils.py ├── setup.cfg ├── setup.py └── versioneer.py /.bandit: -------------------------------------------------------------------------------- 1 | [bandit] 2 | exclude: ./buildscripts/* 3 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | IndentWidth: 4 3 | UseTab: Never 4 | Language: Cpp 5 | Standard: Cpp11 6 | 7 | AccessModifierOffset: -4 8 | 9 | AlignConsecutiveDeclarations: false 10 | AlignConsecutiveAssignments: false 11 | AlignTrailingComments: true 12 | 13 | AllowShortBlocksOnASingleLine: false 14 | AllowShortCaseLabelsOnASingleLine: false 15 | AllowShortFunctionsOnASingleLine: Inline 16 | AllowShortIfStatementsOnASingleLine: false 17 | AllowShortLoopsOnASingleLine: false 18 | 19 | AlwaysBreakBeforeMultilineStrings: true 20 | AlwaysBreakTemplateDeclarations: true 21 | 22 | BinPackArguments: false 23 | BinPackParameters: false 24 | 25 | BreakBeforeBraces: Allman 26 | BreakConstructorInitializersBeforeComma: true 27 | 28 | ColumnLimit: 120 29 | CommentPragmas: '.*' 30 | 31 | IndentCaseLabels: false 32 | IndentWrappedFunctionNames: true 33 | 34 | KeepEmptyLinesAtTheStartOfBlocks: false 35 | NamespaceIndentation: All 36 | 37 | PointerAlignment: Left 38 | SpaceAfterCStyleCast: false 39 | SpaceBeforeAssignmentOperators: true 40 | SpaceBeforeParens: ControlStatements 41 | SpaceInEmptyParentheses: false 42 | SpacesInAngles: false 43 | SpacesInCStyleCastParentheses: false 44 | SpacesInParentheses: false 45 | SpacesInSquareBrackets: false 46 | 47 | SortIncludes: false 48 | ReflowComments: true 49 | 50 | IncludeCategories: 51 | - Regex: '^".*' 52 | Priority: 3 53 | - Regex: '^<.*' 54 | Priority: 2 55 | SortIncludes: true 56 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | hpat/_version.py export-subst 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *__pycache__* 3 | *.so 4 | *.dll 5 | -------------------------------------------------------------------------------- /.pep8speaks.yml: -------------------------------------------------------------------------------- 1 | # File : .pep8speaks.yml 2 | 3 | scanner: 4 | diff_only: True # If False, the entire file touched by the Pull Request is scanned for errors. If True, only the diff is scanned. 5 | linter: pycodestyle # Other option is flake8 6 | 7 | pycodestyle: # Same as scanner.linter value. Other option is flake8 8 | max-line-length: 120 # Default is 79 in PEP 8 9 | 10 | no_blank_comment: True # If True, no comment is made on PR without any errors. 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # reference: https://github.com/numba/numba/blob/master/.travis.yml 2 | 3 | dist: trusty 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | env: 10 | global: 11 | - GIT_DESCRIBE_TAG=0.29.2 12 | - GIT_DESCRIBE_NUMBER=1 13 | - PYTHON_VER=3.6 14 | - NUMPY_VER=1.17 15 | - CONDA_PREFIX_PATH=$HOME/miniconda3 16 | matrix: 17 | - BUILD_MODE=package TEST_MODE=conda SDC_CONFIG_PIPELINE_SDC=False 18 | 19 | before_install: 20 | - chmod 777 buildscripts/install_conda.sh 21 | - buildscripts/install_conda.sh $CONDA_PREFIX_PATH 22 | 23 | install: skip 24 | 25 | script: skip 26 | 27 | after_success: skip 28 | 29 | notifications: 30 | email: false 31 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2020, Intel Corporation 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright notice, 9 | this list of conditions and the following disclaimer in the documentation 10 | and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 13 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 16 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 | THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | include versioneer.py 3 | include hpat/_version.py 4 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - '*' 3 | 4 | pr: 5 | - '*' 6 | 7 | jobs: 8 | - template: buildscripts/azure/template-windows.yml 9 | parameters: 10 | name: Windows2016_vs2017 11 | vmImage: vs2017-win2016 12 | allowFailure: false 13 | matrix: 14 | py3.7_numpy1.17: 15 | PYTHON_VER: '3.7' 16 | NUMPY_VER: '1.17' 17 | USE_NUMBA_MASTER: 'True' 18 | SDC_CONFIG_PIPELINE_SDC: 'False' 19 | 20 | # - template: buildscripts/azure/template-linux-macos.yml 21 | # parameters: 22 | # name: macOS1013_xcode9 23 | # vmImage: xcode9-macos10.13 24 | # allowFailure: false 25 | # matrix: 26 | # py3.7_numpy1.17: 27 | # PYTHON_VER: '3.7' 28 | # NUMPY_VER: '1.17' 29 | # USE_NUMBA_MASTER: 'True' 30 | # SDC_CONFIG_PIPELINE_SDC: 'False' 31 | 32 | - template: buildscripts/azure/template-linux-macos.yml 33 | parameters: 34 | name: Ubuntu1804 35 | vmImage: ubuntu-18.04 36 | allowFailure: false 37 | matrix: 38 | py3.7_numpy1.17: 39 | PYTHON_VER: '3.7' 40 | NUMPY_VER: '1.17' 41 | USE_NUMBA_MASTER: 'True' 42 | SDC_CONFIG_PIPELINE_SDC: 'False' 43 | -------------------------------------------------------------------------------- /buildscripts/azure/template-linux-macos.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | name: '' 3 | vmImage: '' 4 | allowFailure: '' 5 | matrix: [] 6 | 7 | jobs: 8 | - job: ${{ parameters.name }} 9 | timeoutInMinutes: 180 10 | pool: 11 | vmImage: ${{ parameters.vmImage }} 12 | strategy: 13 | maxParallel: 11 14 | matrix: 15 | ${{ insert }}: ${{ parameters.matrix }} 16 | 17 | steps: 18 | - script: | 19 | chmod 777 buildscripts/install_conda.sh 20 | buildscripts/install_conda.sh $HOME/miniconda3 21 | displayName: 'Install conda' 22 | 23 | - script: | 24 | source $HOME/miniconda3/bin/activate 25 | python buildscripts/build.py --python=$PYTHON_VER --numpy=$NUMPY_VER 26 | displayName: 'Build Intel SDC' 27 | continueOnError: ${{ parameters.allowFailure }} 28 | 29 | - script: | 30 | source $HOME/miniconda3/bin/activate 31 | python buildscripts/test.py --python=$PYTHON_VER --sdc-channel=./sdc-build 32 | displayName: 'Test Intel SDC conda package' 33 | continueOnError: ${{ parameters.allowFailure }} 34 | 35 | - script: | 36 | source $HOME/miniconda3/bin/activate 37 | python buildscripts/run_examples.py --python=$PYTHON_VER --sdc-channel=./sdc-build 38 | displayName: 'Run Intel SDC examples' 39 | continueOnError: ${{ parameters.allowFailure }} 40 | 41 | - script: | 42 | source $HOME/miniconda3/bin/activate 43 | python buildscripts/build_doc.py --python=$PYTHON_VER --sdc-channel=./sdc-build 44 | displayName: 'Build Intel SDC documentation' 45 | continueOnError: ${{ parameters.allowFailure }} 46 | 47 | - script: | 48 | source $HOME/miniconda3/bin/activate 49 | python buildscripts/test_conda_install.py --python=$PYTHON_VER --channels="-c anaconda -c conda-forge" 50 | displayName: 'Test SDC installation from conda' 51 | continueOnError: ${{ parameters.allowFailure }} 52 | -------------------------------------------------------------------------------- /buildscripts/azure/template-windows.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | name: '' 3 | vmImage: '' 4 | allowFailure: '' 5 | matrix: [] 6 | 7 | jobs: 8 | - job: ${{ parameters.name }} 9 | timeoutInMinutes: 180 10 | pool: 11 | vmImage: ${{ parameters.vmImage }} 12 | strategy: 13 | maxParallel: 11 14 | matrix: 15 | ${{ insert }}: ${{ parameters.matrix }} 16 | 17 | steps: 18 | # - script: | 19 | # buildscripts\\install_conda.bat "%UserProfile%\\Miniconda3" 20 | # displayName: 'Install conda' 21 | 22 | - script: | 23 | call C:\\Miniconda\\Scripts\\activate.bat 24 | python buildscripts\\build.py --python=%PYTHON_VER% --numpy=%NUMPY_VER% 25 | displayName: 'Build Intel SDC' 26 | continueOnError: ${{ parameters.allowFailure }} 27 | 28 | - script: | 29 | call C:\\Miniconda\\Scripts\\activate.bat 30 | python buildscripts\\test.py --python=%PYTHON_VER% --sdc-channel=.\\sdc-build 31 | displayName: 'Test Intel SDC conda package' 32 | continueOnError: ${{ parameters.allowFailure }} 33 | 34 | - script: | 35 | call C:\\Miniconda\\Scripts\activate.bat 36 | python buildscripts\\run_examples.py --python=%PYTHON_VER% --sdc-channel=.\\sdc-build 37 | displayName: 'Run Intel SDC examples' 38 | continueOnError: ${{ parameters.allowFailure }} 39 | 40 | - script: | 41 | call C:\\Miniconda\\Scripts\activate.bat 42 | python buildscripts\\test_conda_install.py --python=%PYTHON_VER% --channels="-c anaconda -c conda-forge" 43 | displayName: 'Test SDC installation from conda' 44 | continueOnError: ${{ parameters.allowFailure }} 45 | -------------------------------------------------------------------------------- /buildscripts/install_conda.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | @rem Download and install Python 3.7 x64 Miniconda3 on Windows 4 | @rem Miniconda is taken from https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe 5 | 6 | @rem Default prefix if %UserProfile%\Miniconda3 7 | @rem To set other prefix use setup_conda.bat 8 | set prefix=%UserProfile%\Miniconda3 9 | set installer=%UserProfile%\Miniconda3.exe 10 | 11 | echo "Install Miniconda3 on Windows" 12 | IF "%~1"=="" (echo "Note: Conda prefix is empy; To set prefix use setup_conda.bat ") ELSE (set prefix=%~1) 13 | echo "Conda will be installed to %prefix%" 14 | 15 | echo "Remove %prefix% and %installer%" 16 | if exist "%prefix%" RMDIR "%prefix%" /S /Q 17 | if exist "%installer%" del /f "%installer%" 18 | 19 | echo "Download Miniconda3 installer to %installer%" 20 | powershell -Command "(New-Object Net.WebClient).DownloadFile('https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe', '%installer%')" 21 | 22 | echo "Install Miniconda3 to %prefix%" 23 | %installer% /InstallationType=JustMe /RegisterPython=0 /S /D=%prefix% 24 | echo "Done" 25 | -------------------------------------------------------------------------------- /buildscripts/install_conda.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Install Miniconda 5 | # Reference: 6 | # https://github.com/numba/numba/blob/master/buildscripts/incremental/install_miniconda.sh 7 | 8 | echo "Install Miniconda3" 9 | 10 | prefix="$HOME/miniconda3" 11 | if [ "$1" == "" ]; then 12 | echo "Conda prefix is empy; Conda will be installed to $HOME" 13 | echo "To set prefix use setup_conda.sh " 14 | else 15 | prefix="$1" 16 | fi 17 | echo "Conda will be installed to $prefix" 18 | 19 | # Remove miniconda if exists 20 | echo "Remove $prefix" 21 | if [ -d "$prefix" ]; then 22 | rm -rf $prefix 23 | fi 24 | 25 | # Download Miniconda 26 | echo "Download Miniconda3 installer to ~/miniconda.sh" 27 | unamestr=`uname` 28 | if [[ "$unamestr" == 'Linux' ]]; then 29 | wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh 30 | elif [[ "$unamestr" == 'Darwin' ]]; then 31 | wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh 32 | else 33 | echo Error 34 | fi 35 | 36 | # Install Miniconda 37 | echo "Install Miniconda3 to $prefix" 38 | chmod +x ~/miniconda.sh 39 | ~/miniconda.sh -b -p "$prefix" 40 | echo "Done" 41 | -------------------------------------------------------------------------------- /conda-recipe/bld.bat: -------------------------------------------------------------------------------- 1 | echo on 2 | 3 | "%PYTHON%" setup.py build install --single-version-externally-managed --record=record.txt 4 | if errorlevel 1 exit 1 5 | 6 | rem Build wheel package 7 | if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( 8 | %PYTHON% setup.py bdist_wheel 9 | if errorlevel 1 exit 1 10 | copy dist\sdc*.whl %WHEELS_OUTPUT_FOLDER% 11 | if errorlevel 1 exit 1 12 | ) 13 | -------------------------------------------------------------------------------- /conda-recipe/build.sh: -------------------------------------------------------------------------------- 1 | set -ex 2 | 3 | if [ `uname` == Darwin ]; then 4 | WHEELS_BUILD_ARGS="" 5 | export MACOSX_DEPLOYMENT_TARGET=10.9 6 | else 7 | if [ "$CONDA_PY" == "36" ]; then 8 | WHEELS_BUILD_ARGS="-p manylinux1_x86_64" 9 | else 10 | WHEELS_BUILD_ARGS="-p manylinux2014_x86_64" 11 | fi 12 | fi 13 | 14 | $PYTHON setup.py build install --single-version-externally-managed --record=record.txt 15 | 16 | # Build wheel package 17 | if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then 18 | $PYTHON setup.py bdist_wheel ${WHEELS_BUILD_ARGS} 19 | cp dist/sdc*.whl ${WHEELS_OUTPUT_FOLDER} 20 | fi 21 | -------------------------------------------------------------------------------- /conda-recipe/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - 3.6 3 | - 3.7 4 | 5 | numpy: 6 | - 1.17 7 | -------------------------------------------------------------------------------- /conda-recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set NUMBA_VERSION = "==0.54.1" %} 2 | {% set PANDAS_VERSION = "==1.3.4" %} 3 | {% set PYARROW_VERSION = "==4.0.1" %} 4 | 5 | package: 6 | name: sdc 7 | version: {{ GIT_DESCRIBE_TAG }} 8 | 9 | source: 10 | path: ../ 11 | 12 | build: 13 | number: {{ GIT_DESCRIBE_NUMBER|int }} 14 | script_env: 15 | - SDC_CONFIG_PIPELINE_SDC 16 | - WHEELS_OUTPUT_FOLDER 17 | 18 | requirements: 19 | build: 20 | - {{ compiler('c') }} # [not osx] 21 | - {{ compiler('cxx') }} # [not osx] 22 | - sysroot_linux-64 >=2.17 # [linux] 23 | 24 | host: 25 | - python 26 | - setuptools 27 | - numba {{ NUMBA_VERSION }} 28 | - numpy 29 | - pyarrow {{ PYARROW_VERSION }} 30 | - wheel 31 | - tbb-devel 32 | 33 | run: 34 | - python 35 | - {{ pin_compatible('numpy') }} 36 | - pandas {{ PANDAS_VERSION }} 37 | - pyarrow {{ PYARROW_VERSION }} 38 | - numba {{ NUMBA_VERSION }} 39 | - setuptools 40 | - tbb4py 41 | 42 | test: 43 | imports: 44 | - sdc 45 | 46 | about: 47 | home: https://github.com/IntelPython/sdc 48 | license: BSD-2-Clause 49 | license_file: LICENSE.md 50 | summary: A compiler-based big data framework in Python 51 | description: | 52 | LEGAL NOTICE: Use of this software package is subject to the 53 | software license agreement (as set forth above, in the license section of 54 | the installed Conda package and/or the README file) and all notices, 55 | disclaimers or license terms for third party or open source software 56 | included in or with the software. 57 |

58 | EULA: BSD-2-Clause 59 |

60 | -------------------------------------------------------------------------------- /conda-recipe/run_test.bat: -------------------------------------------------------------------------------- 1 | echo on 2 | 3 | set NUMBA_DEVELOPER_MODE=1 4 | set NUMBA_DISABLE_ERROR_MESSAGE_HIGHLIGHTING=1 5 | set PYTHONFAULTHANDLER=1 6 | 7 | python -m sdc.tests.gen_test_data 8 | if errorlevel 1 exit 1 9 | 10 | @rem TODO investigate root cause of NumbaPerformanceWarning 11 | @rem http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics 12 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_basic 13 | if errorlevel 1 exit 1 14 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_series 15 | if errorlevel 1 exit 1 16 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_dataframe 17 | if errorlevel 1 exit 1 18 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_hiframes 19 | if errorlevel 1 exit 1 20 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_date 21 | if errorlevel 1 exit 1 22 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_strings 23 | if errorlevel 1 exit 1 24 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_groupby 25 | if errorlevel 1 exit 1 26 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_join 27 | if errorlevel 1 exit 1 28 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_rolling 29 | if errorlevel 1 exit 1 30 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_ml 31 | if errorlevel 1 exit 1 32 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_io 33 | if errorlevel 1 exit 1 34 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_hpat_jit 35 | if errorlevel 1 exit 1 36 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_sdc_numpy 37 | if errorlevel 1 exit 1 38 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_prange_utils 39 | if errorlevel 1 exit 1 40 | 41 | REM Link check for Documentation using Sphinx's in-built linkchecker 42 | REM sphinx-build -b linkcheck -j1 usersource _build/html 43 | REM if errorlevel 1 exit 1 44 | -------------------------------------------------------------------------------- /conda-recipe/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | export NUMBA_DEVELOPER_MODE=1 6 | export NUMBA_DISABLE_ERROR_MESSAGE_HIGHLIGHTING=1 7 | export PYTHONFAULTHANDLER=1 8 | 9 | python -m sdc.tests.gen_test_data 10 | 11 | #Link check for Documentation using Sphinx's in-built linkchecker 12 | #sphinx-build -b linkcheck -j1 usersource _build/html 13 | 14 | # TODO investigate root cause of NumbaPerformanceWarning 15 | # http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics 16 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_basic 17 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_series 18 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_dataframe 19 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_hiframes 20 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_date 21 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_strings 22 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_groupby 23 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_join 24 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_rolling 25 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_ml 26 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_io 27 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_hpat_jit 28 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_sdc_numpy 29 | python -W ignore -u -m numba.runtests -m -v sdc.tests.test_prange_utils 30 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/source/_images/intel_sdc_large_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/intel_sdc_large_logo.png -------------------------------------------------------------------------------- /docs/source/_images/intel_sdc_large_logo.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/intel_sdc_large_logo.pptx -------------------------------------------------------------------------------- /docs/source/_images/scalability.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/scalability.png -------------------------------------------------------------------------------- /docs/source/_images/scalability.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/scalability.pptx -------------------------------------------------------------------------------- /docs/source/_images/scalability_with_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/scalability_with_logo.png -------------------------------------------------------------------------------- /docs/source/_images/scalability_with_logo.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/scalability_with_logo.pptx -------------------------------------------------------------------------------- /docs/source/_images/timing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/timing.png -------------------------------------------------------------------------------- /docs/source/_images/timing.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/timing.pptx -------------------------------------------------------------------------------- /docs/source/_images/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/workflow.png -------------------------------------------------------------------------------- /docs/source/_images/workflow.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/_images/workflow.pptx -------------------------------------------------------------------------------- /docs/source/_templates/_api_ref.pandas.io_templ.rst: -------------------------------------------------------------------------------- 1 | .. _api_ref.pandas.io: 2 | .. include:: ./../ext_links.txt 3 | 4 | Pandas Input/output 5 | =================== 6 | .. currentmodule:: pandas 7 | 8 | This is basic `Pandas*`_ input/output functions. 9 | 10 | Flat file 11 | --------- 12 | 13 | .. sdc_toctree 14 | read_csv 15 | -------------------------------------------------------------------------------- /docs/source/_templates/_api_ref.pandas.window_templ.rst: -------------------------------------------------------------------------------- 1 | .. _api_ref.pandas.window: 2 | .. include:: ./../ext_links.txt 3 | 4 | Pandas Window 5 | ============= 6 | .. currentmodule:: pandas.core.window 7 | 8 | Standard moving window functions 9 | -------------------------------- 10 | 11 | .. sdc_toctree 12 | Rolling.count 13 | Rolling.sum 14 | Rolling.mean 15 | Rolling.median 16 | Rolling.var 17 | Rolling.std 18 | Rolling.min 19 | Rolling.max 20 | Rolling.corr 21 | Rolling.cov 22 | Rolling.skew 23 | Rolling.kurt 24 | Rolling.apply 25 | Rolling.aggregate 26 | Rolling.quantile 27 | Window.mean 28 | Window.sum 29 | 30 | Standard expanding window functions 31 | ----------------------------------- 32 | 33 | .. sdc_toctree 34 | Expanding.count 35 | Expanding.sum 36 | Expanding.mean 37 | Expanding.median 38 | Expanding.var 39 | Expanding.std 40 | Expanding.min 41 | Expanding.max 42 | Expanding.corr 43 | Expanding.cov 44 | Expanding.skew 45 | Expanding.kurt 46 | Expanding.apply 47 | Expanding.aggregate 48 | Expanding.quantile 49 | 50 | Exponentially-weighted moving window functions 51 | ---------------------------------------------- 52 | 53 | .. sdc_toctree 54 | ewm.ExponentialMovingWindow.mean 55 | ewm.ExponentialMovingWindow.std 56 | ewm.ExponentialMovingWindow.var 57 | ewm.ExponentialMovingWindow.corr 58 | ewm.ExponentialMovingWindow.cov 59 | -------------------------------------------------------------------------------- /docs/source/apireference.rst: -------------------------------------------------------------------------------- 1 | .. _apireference: 2 | 3 | API Reference 4 | ************* 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | Input/output <./_api_ref/api_ref.pandas.io.rst> 10 | Series: Columnar Data Structure <./_api_ref/api_ref.pandas.series.rst> 11 | Dataframe: Tabular Data Structure <./_api_ref/api_ref.pandas.dataframe.rst> 12 | Window <./_api_ref/api_ref.pandas.window.rst> 13 | GroupBy <./_api_ref/api_ref.pandas.groupby.rst> 14 | -------------------------------------------------------------------------------- /docs/source/buildscripts/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # ***************************************************************************** 3 | # Copyright (c) 2020, Intel Corporation All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 11 | # Redistributions in binary form must reproduce the above copyright notice, 12 | # this list of conditions and the following disclaimer in the documentation 13 | # and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 19 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 25 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ***************************************************************************** 27 | -------------------------------------------------------------------------------- /docs/source/examples.rst: -------------------------------------------------------------------------------- 1 | .. _examples: 2 | .. include:: ./ext_links.txt 3 | 4 | List of examples 5 | ================ 6 | 7 | .. literalinclude:: ../../examples/basic_workflow.py 8 | :language: python 9 | :lines: 27- 10 | :caption: Basic workflow. 11 | :name: ex_basic_workflow 12 | 13 | .. command-output:: python ./basic_workflow.py 14 | :cwd: ../../examples 15 | 16 | 17 | .. literalinclude:: ../../examples/basic_workflow_batch.py 18 | :language: python 19 | :lines: 27- 20 | :caption: Expanded basic workflow. 21 | :name: ex_basic_workflow_batch 22 | 23 | .. command-output:: python ./basic_workflow_batch.py 24 | :cwd: ../../examples 25 | 26 | 27 | .. literalinclude:: ../../examples/basic_workflow_parallel.py 28 | :language: python 29 | :lines: 27- 30 | :caption: Basic workflow in parallel. 31 | :name: ex_basic_workflow_parallel 32 | 33 | .. command-output:: python ./basic_workflow_parallel.py 34 | :cwd: ../../examples 35 | 36 | 37 | .. include:: _examples/examples.rst 38 | -------------------------------------------------------------------------------- /docs/source/ext_links.txt: -------------------------------------------------------------------------------- 1 | .. 2 | ********************************************************** 3 | THESE ARE EXTERNAL PROJECT LINKS USED IN THE DOCUMENTATION 4 | ********************************************************** 5 | .. _Python*: https://www.python.org/ 6 | .. _NumPy*: https://numpy.org/ 7 | .. _Numba*: https://numba.pydata.org/ 8 | .. _Pandas*: https://pandas.pydata.org/ 9 | .. _LLVM* Compiler: http://llvm.org/docs/ 10 | .. _Intel® TBB: https://github.com/intel/tbb/ 11 | .. _OpenMP*: https://openmp.org/ 12 | .. _Dask*: https://dask.org/ 13 | .. _Ray*: https://ray.readthedocs.io/ 14 | .. _Spark*: https://spark.apache.org/ 15 | 16 | -------------------------------------------------------------------------------- /docs/source/for_developers.rst: -------------------------------------------------------------------------------- 1 | .. _for_developers: 2 | .. include:: ./ext_links.txt 3 | 4 | Contribute to Intel® Scalable Dataframe Compiler Development 5 | ============================================================ 6 | 7 | Please visit our `GitHub repository `_ 8 | to learn more about the project and how you can contribute to it. 9 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. _index: 2 | .. include:: ./ext_links.txt 3 | 4 | .. image:: ./_images/intel_sdc_large_logo.png 5 | :width: 800px 6 | :align: center 7 | :alt: Intel® Scalable Dataframe Compiler 8 | 9 | 10 | This is Intel® Scalable Dataframe Compiler (Intel® SDC), which is an extension of `Numba*`_ that enables compilation of 11 | `Pandas*`_ operations. It automatically vectorizes and parallelizes the code by leveraging modern hardware instructions 12 | and by utilizing all available cores. 13 | 14 | .. image:: ./_images/scalability.png 15 | :width: 800px 16 | :align: center 17 | :alt: Intel® Scalable Dataframe Compiler scalability 18 | 19 | 20 | User Manual 21 | =========== 22 | 23 | .. toctree:: 24 | :maxdepth: 2 25 | 26 | overview 27 | getting_started 28 | compilation 29 | performance 30 | workflow 31 | apireference 32 | examples 33 | for_developers 34 | other_intel_python_projects 35 | 36 | User Manual To-Do List 37 | ====================== 38 | 39 | .. todolist:: 40 | -------------------------------------------------------------------------------- /docs/source/overview.rst: -------------------------------------------------------------------------------- 1 | .. _overview: 2 | .. include:: ./ext_links.txt 3 | 4 | What is Intel® SDC? 5 | =================== 6 | 7 | Intel® Scalable Dataframe Compiler (Intel® SDC) is an extension of 8 | `Numba*`_ that allows just-in-time and ahead-of-time 9 | compilation of Python codes, which are the mix of `Pandas*`_, 10 | `NumPy*`_, and other numerical functions. 11 | 12 | Being the Numba extension, with the ``@njit`` decorator and respective compilation options 13 | Intel SDC generates machine code using the `LLVM* Compiler`_: 14 | 15 | .. literalinclude:: ../../examples/basic_workflow.py 16 | :language: python 17 | :emphasize-lines: 9-10 18 | :lines: 27- 19 | :caption: Example 1: Compiling Basic Pandas* Workflow 20 | :name: ex_basic_workflow 21 | 22 | On a single machine Intel SDC uses multi-threading (based on `Intel® TBB`_ or `OpenMP*`_ ) 23 | to parallelize `Pandas*`_ and `Numpy*`_ operations. Most of these operations are parallelized on function-level, 24 | so that no extra action is required from users in most cases. 25 | -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/globaltoc.html: -------------------------------------------------------------------------------- 1 |

Table of Contents

2 | {{ toctree(maxdepth=-1, titles_only=true) }} 3 | 4 | -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/localtoc.html: -------------------------------------------------------------------------------- 1 |

Page Contents

2 | {{ toc }} 3 | 4 | -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/searchbox.html: -------------------------------------------------------------------------------- 1 | {%- if pagename != "search" %} 2 |
3 | 4 | 5 | 6 |
7 | {%- endif %} 8 | -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/SDC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/SDC.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/intel_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/intel_logo.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/sdc_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/sdc_email.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/sdc_examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/sdc_examples.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/sdc_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/sdc_github.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/static/sdc_issues.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/docs/source/sdc-sphinx-theme/static/sdc_issues.png -------------------------------------------------------------------------------- /docs/source/sdc-sphinx-theme/theme.conf: -------------------------------------------------------------------------------- 1 | # Intel(R) SDC theme based on Bootstrap-AstroPy CSS 2 | [theme] 3 | inherit = basic 4 | stylesheet = sdc.css 5 | pygments_style = sphinx 6 | 7 | [options] 8 | logotext1 = astro 9 | logotext2 = py 10 | logotext3 = :docs 11 | astropy_project_menubar = False 12 | -------------------------------------------------------------------------------- /docs/source/workflow.rst: -------------------------------------------------------------------------------- 1 | .. _workflow: 2 | .. include:: ./ext_links.txt 3 | 4 | Step by step on typical data analysis workflow 5 | ============================================== 6 | 7 | Coming soon... -------------------------------------------------------------------------------- /examples/dataframe/dataframe_at.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def dataframe_at(): 34 | df = pd.DataFrame({'A': [1.0, 2.0, 3.0, 1.0], 'B': [4, 5, 6, 7], 'C': ['a', 'b', 'c', 'd']}) 35 | 36 | return df.at[1, 'C'] # ['b'] 37 | 38 | 39 | print(dataframe_at()) 40 | -------------------------------------------------------------------------------- /examples/dataframe/dataframe_columns.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def dataframe_columns(): 33 | df = pd.DataFrame({'A': [1, 2], 'AA': [3, 4], 'B': [5, 6]}, index=['a', 'b']) 34 | result = df.columns 35 | 36 | return result # A tuple of column names ('A', 'AA', 'B') 37 | 38 | 39 | print(dataframe_columns()) 40 | -------------------------------------------------------------------------------- /examples/dataframe/dataframe_iat.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def dataframe_iat(): 34 | df = pd.DataFrame({'A': [1.0, 2.0, 3.0, 1.0], 'B': [4, 5, 6, 7], 'C': ['a', 'b', 'c', 'd']}) 35 | 36 | return df.iat[1, 2] # value b 37 | 38 | 39 | print(dataframe_iat()) 40 | -------------------------------------------------------------------------------- /examples/dataframe/dataframe_index.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def dataframe_index(): 33 | df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}, index=['a', 'b']) 34 | result = df.index 35 | 36 | return result # Numpy array of index values ['a', 'b'] 37 | 38 | 39 | print(dataframe_index()) 40 | -------------------------------------------------------------------------------- /examples/employees.csv: -------------------------------------------------------------------------------- 1 | ,Gender,First Name,Start Date,Last Login Time,Salary,Bonus %,Senior Management,Team 2 | 0,Female,EMILY,2015-12-04,0 days 21:41:41.000000000,39582,1.306,,Business Development 3 | 1,Male,NOAH,2011-02-02,0 days 00:04:19.000000000,124742,5.881,False,Client Services 4 | 2,Male,ISAAC,1994-10-25,0 days 04:35:46.000000000,138462,14.995,True,Sales 5 | 3,Male,,1998-12-24,0 days 18:35:33.000000000,60661,3.477,False,Business Development 6 | 4,,CHRISTOPHER,2002-03-05,0 days 12:26:32.000000000,97764,15.65,False, 7 | 5,Female,MIA,2005-01-20,0 days 17:47:44.000000000,42104,12.595,False,Product 8 | 6,Female,OLIVIA,1994-07-13,0 days 00:43:25.000000000,46646,1.284,False,Client Services 9 | 7,Male,ALEXANDER,2019-09-03,0 days 04:15:00.000000000,123807,17.849,True,Legal 10 | 8,Male,JOSEPH,2008-09-15,0 days 01:16:05.000000000,139681,19.904,False,Engineering 11 | 9,Male,JOSEPH,2009-06-11,0 days 20:27:06.000000000,71359,19.103,False,Client Services 12 | -------------------------------------------------------------------------------- /examples/employees_batch1.csv: -------------------------------------------------------------------------------- 1 | ,Gender,First Name,Start Date,Last Login Time,Salary,Bonus %,Senior Management,Team 2 | 0,Female,EMILY,2015-12-04,0 days 21:41:41.000000000,39582,1.306,,Business Development 3 | 1,Male,NOAH,2011-02-02,0 days 00:04:19.000000000,124742,5.881,False,Client Services 4 | 2,Male,ISAAC,1994-10-25,0 days 04:35:46.000000000,138462,14.995,True,Sales 5 | 3,Male,,1998-12-24,0 days 18:35:33.000000000,60661,3.477,False,Business Development 6 | 4,,CHRISTOPHER,2002-03-05,0 days 12:26:32.000000000,97764,15.65,False, 7 | 5,Female,MIA,2005-01-20,0 days 17:47:44.000000000,42104,12.595,False,Product 8 | -------------------------------------------------------------------------------- /examples/employees_batch2.csv: -------------------------------------------------------------------------------- 1 | ,Gender,First Name,Start Date,Last Login Time,Salary,Bonus %,Senior Management,Team 2 | 6,Female,OLIVIA,1994-07-13,0 days 00:43:25.000000000,46646,1.284,False,Client Services 3 | 7,Male,ALEXANDER,2019-09-03,0 days 04:15:00.000000000,123807,17.849,True,Legal 4 | 8,Male,JOSEPH,2008-09-15,0 days 01:16:05.000000000,139681,19.904,False,Engineering 5 | 9,Male,JOSEPH,2009-06-11,0 days 20:27:06.000000000,71359,19.103,False,Client Services 6 | -------------------------------------------------------------------------------- /examples/series/rolling/series_rolling_min.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_rolling_min(): 33 | series = pd.Series([4, 3, 5, 2, 6]) # Series of 4, 3, 5, 2, 6 34 | out_series = series.rolling(3).min() 35 | 36 | return out_series # Expect series of NaN, NaN, 3.0, 2.0, 2.0 37 | 38 | 39 | print(series_rolling_min()) 40 | -------------------------------------------------------------------------------- /examples/series/series_T.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_T(): 34 | series = pd.Series(np.arange(5)) 35 | 36 | return series.T # Expect array of 0, 1, 2, 3, 4 37 | 38 | 39 | print(series_T()) 40 | -------------------------------------------------------------------------------- /examples/series/series_abs.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_abs(): 33 | s = pd.Series([-1.10, 2, -3.33]) 34 | out_series = s.abs() 35 | 36 | return out_series # Expect series of 1.10, 2.00, 3.33 37 | 38 | 39 | print(series_abs()) 40 | -------------------------------------------------------------------------------- /examples/series/series_add.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_add(): 33 | s1 = pd.Series([1, 2, 3]) 34 | s2 = pd.Series([4, 5, 6]) 35 | out_series = s1.add(s2) 36 | 37 | return out_series # Expect series of 5, 7, 9 38 | 39 | 40 | print(series_add()) 41 | -------------------------------------------------------------------------------- /examples/series/series_argsort.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_argsort(): 34 | s = pd.Series([3, -10, np.nan, 0, 92]) 35 | 36 | return s.argsort() # Expect series of 1, 2, -1, 0, 3 37 | 38 | 39 | print(series_argsort()) 40 | -------------------------------------------------------------------------------- /examples/series/series_at/series_at_multiple_result.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_at_many_idx(): 34 | series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 0, 6, 0]) 35 | 36 | return series.at[0] # Expect array: [5 3 1] 37 | 38 | 39 | print(series_at_many_idx()) 40 | -------------------------------------------------------------------------------- /examples/series/series_at/series_at_single_result.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_at_value(): 34 | series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8]) 35 | 36 | return series.at[4] # Expect array: [3] 37 | 38 | 39 | print(series_at_value()) 40 | -------------------------------------------------------------------------------- /examples/series/series_copy.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_copy(): 34 | s1 = pd.Series(np.arange(5)) 35 | s2 = s1.copy() 36 | 37 | return s2 # Expect new series of 0, 1, 2, 3, 4 38 | 39 | 40 | print(series_copy()) 41 | -------------------------------------------------------------------------------- /examples/series/series_corr.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_corr(): 34 | s1 = pd.Series([3.2, -10, np.nan, 0.23, 9.2]) 35 | s2 = pd.Series([5., 0, 3.3, np.nan, 9.2]) 36 | 37 | return s1.corr(s2) # Expect value: 0.98673... 38 | 39 | 40 | print(series_corr()) 41 | -------------------------------------------------------------------------------- /examples/series/series_count.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | import numpy as np 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_count(): 34 | s = pd.Series([1, 2, np.nan]) 35 | out_series = s.count() 36 | 37 | return out_series # Expect the number of non-Nan values == '2' 38 | 39 | 40 | print(series_count()) 41 | -------------------------------------------------------------------------------- /examples/series/series_cov.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_cov(): 34 | s1 = pd.Series([3.2, -10, np.nan, 0.23, 9.2]) 35 | s2 = pd.Series([5., 0, 3.3, np.nan, 9.2]) 36 | 37 | return s1.cov(s2) # Expect value: 44.639... 38 | 39 | 40 | print(series_cov()) 41 | -------------------------------------------------------------------------------- /examples/series/series_cumsum.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_cumsum(): 33 | s = pd.Series([1, 2, 3, 4]) 34 | 35 | return s.cumsum() # Expect series of 1, 3, 6, 10 36 | 37 | 38 | print(series_cumsum()) 39 | -------------------------------------------------------------------------------- /examples/series/series_div.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_div(): 33 | s1 = pd.Series([1, 2, 4]) 34 | s2 = pd.Series([4, 4, 16]) 35 | out_series = s1.div(s2) 36 | 37 | return out_series # Expect series of 0.25, 0.50, 0.25 38 | 39 | 40 | print(series_div()) 41 | -------------------------------------------------------------------------------- /examples/series/series_dropna.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """ 28 | Expect Series 29 | 0 4.0 30 | 2 2.0 31 | 3 1.0 32 | dtype: float64 33 | """ 34 | import numpy as np 35 | import pandas as pd 36 | from numba import njit 37 | 38 | 39 | @njit 40 | def series_dropna(): 41 | s = pd.Series([4, np.nan, 2, 1]) 42 | 43 | return s.dropna() 44 | 45 | 46 | print(series_dropna()) 47 | -------------------------------------------------------------------------------- /examples/series/series_eq.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_eq(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.eq(s2) # Expect series of False, False, True, False, False 37 | 38 | 39 | print(series_eq()) 40 | -------------------------------------------------------------------------------- /examples/series/series_fillna.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """ 28 | Expect Series 29 | 0 4.0 30 | 1 0.0 31 | 2 2.0 32 | 3 1.0 33 | dtype: float64 34 | """ 35 | import numpy as np 36 | import pandas as pd 37 | from numba import njit 38 | 39 | 40 | @njit 41 | def series_fillna(): 42 | s = pd.Series([4, np.nan, 2, 1]) 43 | 44 | return s.fillna(0) 45 | 46 | 47 | print(series_fillna()) 48 | -------------------------------------------------------------------------------- /examples/series/series_floordiv.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_floordiv(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.floordiv(s2) # Expect series of 0, 2, 1, 0, 0 37 | 38 | 39 | print(series_floordiv()) 40 | -------------------------------------------------------------------------------- /examples/series/series_ge.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_ge(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.ge(s2) # Expect series of True, True, True, False, False 37 | 38 | 39 | print(series_ge()) 40 | -------------------------------------------------------------------------------- /examples/series/series_gt.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_gt(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.gt(s2) # Expect series of True, True, False, False, False 37 | 38 | 39 | print(series_gt()) 40 | -------------------------------------------------------------------------------- /examples/series/series_head.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """ 28 | Expected Series 29 | 0 7 30 | 2 6 31 | 4 5 32 | dtype: int64 33 | """ 34 | import pandas as pd 35 | from numba import njit 36 | 37 | 38 | @njit 39 | def series_head(): 40 | s = pd.Series([7, 6, 5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8, 10, 12]) 41 | 42 | return s.head(3) 43 | 44 | 45 | print(series_head()) 46 | -------------------------------------------------------------------------------- /examples/series/series_iat.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | from numba import njit 32 | 33 | 34 | @njit 35 | def series_iat(): 36 | series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8]) 37 | 38 | return series.iat[4] # Expect value: 1 39 | 40 | 41 | print(series_iat()) 42 | -------------------------------------------------------------------------------- /examples/series/series_idxmax.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_idxmax(): 34 | s = pd.Series([4, np.nan, 2, 1], index=['A', 'B', 'C', 'D']) 35 | 36 | return s.idxmax() # Expect index of maximum value A 37 | 38 | 39 | print(series_idxmax()) 40 | -------------------------------------------------------------------------------- /examples/series/series_idxmin.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_idxmin(): 34 | s = pd.Series([4, np.nan, 2, 1], index=['A', 'B', 'C', 'D']) 35 | 36 | return s.idxmin() # Expect index of minimum value D 37 | 38 | 39 | print(series_idxmin()) 40 | -------------------------------------------------------------------------------- /examples/series/series_iloc/series_iloc_value.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_iloc_value(): 34 | series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8]) 35 | 36 | return series.iloc[4] # Expect value: 1 37 | 38 | 39 | print(series_iloc_value()) 40 | -------------------------------------------------------------------------------- /examples/series/series_index.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_index(): 34 | series = pd.Series(np.arange(5), index=['one', 'two', 'three', 'four', 'five']) 35 | 36 | return series.index # Expect array of 'one' 'two' 'three' 'four' 'five' 37 | 38 | 39 | print(series_index()) 40 | -------------------------------------------------------------------------------- /examples/series/series_isin.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_isin(): 34 | s = pd.Series([4, np.nan, 2, 1]) 35 | 36 | return s.isin([4, 1]) # Expect series of True, False, False, True 37 | 38 | 39 | print(series_isin()) 40 | -------------------------------------------------------------------------------- /examples/series/series_isna.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_isna(): 34 | s = pd.Series([4, np.nan, 2, 1]) 35 | 36 | return s.isna() # Expect series of False, True, False, False 37 | 38 | 39 | print(series_isna()) 40 | -------------------------------------------------------------------------------- /examples/series/series_isnull.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_isnull(): 34 | s = pd.Series([4, np.nan, 2, 1]) 35 | 36 | return s.isnull() # Expect series of False, True, False, False 37 | 38 | 39 | print(series_isnull()) 40 | -------------------------------------------------------------------------------- /examples/series/series_le.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_le(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.le(s2) # Expect series of False, False, True, True, True 37 | 38 | 39 | print(series_le()) 40 | -------------------------------------------------------------------------------- /examples/series/series_lt.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_lt(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.lt(s2) # Expect series of False, False, False, True, True 37 | 38 | 39 | print(series_lt()) 40 | -------------------------------------------------------------------------------- /examples/series/series_map.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """Expected: 28 | 0 1.0 29 | 1 4.0 30 | 2 9.0 31 | 3 16.0 32 | 4 25.0 33 | dtype: float64 34 | """ 35 | 36 | import pandas as pd 37 | from numba import njit 38 | 39 | 40 | @njit 41 | def series_map(): 42 | s = pd.Series([1., 2., 3., 4., 5.]) 43 | return s.map(lambda x: x ** 2) 44 | 45 | 46 | print(series_map()) 47 | -------------------------------------------------------------------------------- /examples/series/series_max.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_max(): 33 | s = pd.Series([1, 4, 2, 0]) 34 | out_series = s.max() 35 | 36 | return out_series # Expect maximum value 4 37 | 38 | 39 | print(series_max()) 40 | -------------------------------------------------------------------------------- /examples/series/series_mean.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_mean(): 34 | series = pd.Series([3.2, -10, np.nan, 0.23, 9.2]) 35 | 36 | return series.mean() # Expect value: 0.6575 37 | 38 | 39 | print(series_mean()) 40 | -------------------------------------------------------------------------------- /examples/series/series_median.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_median(): 33 | series = pd.Series([1, 2, 3, 4]) 34 | 35 | return series.median() # Expect value: 2.5 36 | 37 | 38 | print(series_median()) 39 | -------------------------------------------------------------------------------- /examples/series/series_min.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_min(): 34 | series = pd.Series([4, np.nan, 2, 1]) 35 | 36 | return series.min() # Expect minimum value 1.0 37 | 38 | 39 | print(series_min()) 40 | -------------------------------------------------------------------------------- /examples/series/series_mod.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_mod(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.mod(s2) # Expect series of 0, 0, 0, 2, 1 37 | 38 | 39 | print(series_mod()) 40 | -------------------------------------------------------------------------------- /examples/series/series_mul.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_mul(): 33 | s1 = pd.Series([1, 3, 100]) 34 | s2 = pd.Series([0, 1, 2]) 35 | out_series = s1.mul(s2) 36 | 37 | return out_series # Expect series of 0, 3, 200 38 | 39 | 40 | print(series_mul()) 41 | -------------------------------------------------------------------------------- /examples/series/series_ndim.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_ndim(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.ndim # Expect value: 1 37 | 38 | 39 | print(series_ndim()) 40 | -------------------------------------------------------------------------------- /examples/series/series_ne.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_ne(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.ne(s2) # Expect series of True, True, False, True, True 37 | 38 | 39 | print(series_ne()) 40 | -------------------------------------------------------------------------------- /examples/series/series_nlargest.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_nlargest(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.nlargest(4) # Expect series of 9, 8, 7, 6 37 | 38 | 39 | print(series_nlargest()) 40 | -------------------------------------------------------------------------------- /examples/series/series_notna.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_notna(): 34 | series = pd.Series([4, np.nan, 2, 1]) 35 | 36 | return series.notna() # Expect series of True, False, True, True 37 | 38 | 39 | print(series_notna()) 40 | -------------------------------------------------------------------------------- /examples/series/series_nsmallest.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_nsmallest(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.nsmallest(4) # Expect series of 0, 1, 2, 3 37 | 38 | 39 | print(series_nsmallest()) 40 | -------------------------------------------------------------------------------- /examples/series/series_nunique.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_nunique(): 33 | series = pd.Series([2, 8, 2, 1]) 34 | 35 | return series.nunique() # Expect value: 3 36 | 37 | 38 | print(series_nunique()) 39 | -------------------------------------------------------------------------------- /examples/series/series_pow.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_pow(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.pow(s2) # Expect series of 1, 16, 27, 64, 1 37 | 38 | 39 | print(series_pow()) 40 | -------------------------------------------------------------------------------- /examples/series/series_prod.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_prod(): 34 | series = pd.Series([3.2, -10, np.nan, 0.23, 9.2]) 35 | 36 | return series.prod() # Expect value: -67.712 37 | 38 | 39 | print(series_prod()) 40 | -------------------------------------------------------------------------------- /examples/series/series_quantile.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_quantile(): 33 | s = pd.Series([1, 2, 3, 4]) 34 | median = .5 # compute median 35 | out_series = s.quantile(median) 36 | 37 | return out_series # Expect median value == 2.5 38 | 39 | 40 | print(series_quantile()) 41 | -------------------------------------------------------------------------------- /examples/series/series_shape.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_shape(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.shape # Expect (10,) 37 | 38 | 39 | print(series_shape()) 40 | -------------------------------------------------------------------------------- /examples/series/series_size.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_size(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.size # Expect value: 10 37 | 38 | 39 | print(series_size()) 40 | -------------------------------------------------------------------------------- /examples/series/series_skew.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | import numpy as np 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_skew(): 34 | s = pd.Series([np.nan, -2., 3., 5.0]) 35 | 36 | return s.skew() # Expect -1.1520696383139375 37 | 38 | 39 | print(series_skew()) 40 | -------------------------------------------------------------------------------- /examples/series/series_std.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_std(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.std() # Expect value: 3.0276503540974917 37 | 38 | 39 | print(series_std()) 40 | -------------------------------------------------------------------------------- /examples/series/series_sub.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_sub(): 33 | s1 = pd.Series([5, 4, 3, 2, 1]) 34 | s2 = pd.Series([0, 2, 3, 6, 8]) 35 | 36 | return s1.sub(s2) # Expect series of 5, 2, 0, -4, -7 37 | 38 | 39 | print(series_sub()) 40 | -------------------------------------------------------------------------------- /examples/series/series_sum.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_sum(): 33 | series = pd.Series([5, 4, 3, 2, 1]) 34 | 35 | return series.sum() # Expect value: 15 36 | 37 | 38 | print(series_sum()) 39 | -------------------------------------------------------------------------------- /examples/series/series_take.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_take(): 33 | series = pd.Series([5, 4, 3, 2, 1]) 34 | 35 | return series.take([4, 1]) # Expect series of 4, 1 36 | 37 | 38 | print(series_take()) 39 | -------------------------------------------------------------------------------- /examples/series/series_truediv.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_truediv(): 33 | s1 = pd.Series([1, 2, 4]) 34 | s2 = pd.Series([4, 4, 16]) 35 | out_series = s1.truediv(s2) 36 | 37 | return out_series # Expect series of 0.25, 0.50, 0.25 38 | 39 | 40 | print(series_truediv()) 41 | -------------------------------------------------------------------------------- /examples/series/series_unique.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_unique(): 33 | s = pd.Series([2, 1, 3, 3]) 34 | out_series = s.unique() 35 | 36 | return out_series # Expect array of unique values [1, 2, 3] 37 | 38 | 39 | print(series_unique()) 40 | -------------------------------------------------------------------------------- /examples/series/series_values.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_values(): 34 | series = pd.Series(np.arange(5)) 35 | 36 | return series.values # Expect array of 0, 1, 2, 3, 4 37 | 38 | 39 | print(series_values()) 40 | -------------------------------------------------------------------------------- /examples/series/series_var.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import numpy as np 28 | import pandas as pd 29 | from numba import njit 30 | 31 | 32 | @njit 33 | def series_var(): 34 | series = pd.Series(np.arange(10)) 35 | 36 | return series.var() # Expect value: 9.16666... 37 | 38 | 39 | print(series_var()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_contains.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_contains(): 33 | series = pd.Series(['dog', 'foo', 'bar']) 34 | 35 | return series.str.contains('o') # Expect series of True, True, False 36 | 37 | 38 | print(series_str_contains()) 39 | -------------------------------------------------------------------------------- /examples/series/str/series_str_find.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_find(): 33 | series = pd.Series(['foo', 'bar', 'foobar']) # Series of 'foo', 'bar', 'foobar' 34 | out_series = series.str.find('bar') 35 | 36 | return out_series # Expect series of -1, 0, 3 37 | 38 | 39 | print(series_str_find()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isalnum.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isalnum(): 33 | series = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', '']) 34 | out_series = series.str.isalnum() 35 | 36 | return out_series # Expect series of True, False, True, False 37 | 38 | 39 | print(series_str_isalnum()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isalpha.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isalpha(): 33 | series = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', '']) 34 | out_series = series.str.isalpha() 35 | 36 | return out_series # Expect series of True, False, True, False 37 | 38 | 39 | print(series_str_isalpha()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isdecimal.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isdecimal(): 33 | series = pd.Series(['23', '³', '⅕', '']) 34 | out_series = series.str.isdecimal() 35 | 36 | return out_series # Expect series of True, False, False, False 37 | 38 | 39 | print(series_str_isdecimal()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isdigit.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isdigit(): 33 | series = pd.Series(['23', '³', '⅕', '']) 34 | out_series = series.str.isdigit() 35 | 36 | return out_series # Expect series of True, True, False, False 37 | 38 | 39 | print(series_str_isdigit()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isnumeric.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isnumeric(): 33 | series = pd.Series(['one', 'one1', '1', '']) 34 | out_series = series.str.isnumeric() 35 | 36 | return out_series # Expect series of False, False, True, False 37 | 38 | 39 | print(series_str_isnumeric()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_isspace.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_isspace(): 33 | series = pd.Series([' ', ' c ', ' b ', ' a ']) 34 | out_series = series.str.isspace() 35 | 36 | return out_series # Expect series of True, False, False, False 37 | 38 | 39 | print(series_str_isspace()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_istitle.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_istitle(): 33 | series = pd.Series(['Cat', 'dog', 'Bird']) 34 | out_series = series.str.istitle() 35 | 36 | return out_series # Expect series of True, False, True 37 | 38 | 39 | print(series_str_istitle()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_len.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_len(): 33 | series = pd.Series(['foo', 'bar', 'foobar']) # Series of 'foo', 'bar', 'foobar' 34 | out_series = series.str.len() 35 | 36 | return out_series # Expect series of 3, 3, 6 37 | 38 | 39 | print(series_str_len()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_lower.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_lower(): 33 | series = pd.Series(['DOG', 'foo', 'BaR']) 34 | out_series = series.str.lower() 35 | 36 | return out_series 37 | 38 | 39 | print(series_str_lower()) 40 | -------------------------------------------------------------------------------- /examples/series/str/series_str_lstrip.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_lstrip(): 33 | series = pd.Series(['1. Ant. ', '2. Bee!\n', '3. Cat?\t']) 34 | 35 | return series.str.lstrip('123.') 36 | 37 | 38 | print(series_str_lstrip()) 39 | -------------------------------------------------------------------------------- /examples/series/str/series_str_rstrip.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_rstrip(): 33 | series = pd.Series(['1. Ant. ', '2. Bee!\n', '3. Cat?\t']) 34 | 35 | return series.str.rstrip('.!? \n\t') 36 | 37 | 38 | print(series_str_rstrip()) 39 | -------------------------------------------------------------------------------- /examples/series/str/series_str_strip.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_strip(): 33 | series = pd.Series(['1. Ant. ', '2. Bee!\n', '3. Cat?\t']) 34 | 35 | return series.str.strip('123.!? \n\t') 36 | 37 | 38 | print(series_str_strip()) 39 | -------------------------------------------------------------------------------- /examples/series/str/series_str_upper.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from numba import njit 29 | 30 | 31 | @njit 32 | def series_str_upper(): 33 | series = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']) 34 | 35 | return series.str.upper() 36 | 37 | 38 | print(series_str_upper()) 39 | -------------------------------------------------------------------------------- /parquet_reader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | 3 | project(hpat_parquet_reader) 4 | 5 | set(CMAKE_CXX_STANDARD 11) 6 | 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | 9 | include(GNUInstallDirs) 10 | 11 | #string(REPLACE "\\" "/" PQ_PREFIX ${PQ_PREFIX}) 12 | 13 | include_directories("${PQ_PREFIX}/include") 14 | link_directories("${PQ_PREFIX}/lib") 15 | 16 | # set(HEADER_FILES ${PQ_PREFIX}/include/parquet/api/reader.h 17 | # ${PQ_PREFIX}/include/parquet/arrow/reader.h 18 | # ${PQ_PREFIX}/include/arrow/table.h 19 | # ${PQ_PREFIX}/include/arrow/io/hdfs.h) 20 | 21 | 22 | add_library(${PROJECT_NAME} SHARED hpat_parquet_reader.cpp) # ${HEADER_FILES}) 23 | target_compile_options(${PROJECT_NAME} PRIVATE -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11) 24 | SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11") 25 | 26 | target_link_libraries(${PROJECT_NAME} arrow) 27 | target_link_libraries(${PROJECT_NAME} parquet) 28 | 29 | install(TARGETS ${PROJECT_NAME} DESTINATION lib/) 30 | -------------------------------------------------------------------------------- /parquet_reader/Makefile: -------------------------------------------------------------------------------- 1 | libhpat_parquet_reader.so: hpat_parquet_reader.o 2 | ${CXX} ${LDFLAGS} -shared -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 hpat_parquet_reader.o -L${PREFIX}/lib -lparquet -larrow -o libhpat_parquet_reader.so 3 | 4 | hpat_parquet_reader.o: hpat_parquet_reader.cpp 5 | ${CXX} ${CPPFLAGS} -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -I${PREFIX}/include -c hpat_parquet_reader.cpp -o hpat_parquet_reader.o 6 | 7 | install: libhpat_parquet_reader.so 8 | install libhpat_parquet_reader.so ${PREFIX}/lib/ 9 | 10 | clean: 11 | rm -f *.o *~ libhpat_parquet_reader.so 12 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.16 2 | pandas==1.3.4 3 | pyarrow==4.0.1 4 | numba==0.54.1 5 | tbb 6 | tbb-devel 7 | -------------------------------------------------------------------------------- /sdc/datatypes/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/datatypes/categorical/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/datatypes/categorical/models.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | from numba.extending import models 28 | from numba.extending import register_model 29 | 30 | from .types import ( 31 | CategoricalDtypeType, 32 | Categorical, 33 | ) 34 | 35 | 36 | register_model(CategoricalDtypeType)(models.OpaqueModel) 37 | register_model(Categorical)(models.ArrayModel) 38 | -------------------------------------------------------------------------------- /sdc/datatypes/categorical/rewrites.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | import pandas as pd 28 | from sdc.datatypes.common.rewriteutils import register_tuplify 29 | 30 | 31 | register_tuplify(pd.CategoricalDtype, 'categories') 32 | register_tuplify(pd.Categorical, 'values') 33 | -------------------------------------------------------------------------------- /sdc/datatypes/common/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/datatypes/pandas_series_functions/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/datatypes/series/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/datatypes/series/init.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """ 28 | Init Numba extension for Pandas Series. 29 | """ 30 | 31 | from . import types 32 | from . import boxing 33 | from . import pdimpl 34 | from . import rewrites 35 | 36 | import numba 37 | 38 | 39 | # register Series in numba.types for using in objmode 40 | setattr(numba.types, 'series', types.SeriesType) 41 | -------------------------------------------------------------------------------- /sdc/datatypes/series/types.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | """ 28 | Numba types for support pandas Series. 29 | """ 30 | 31 | __all__ = [ 32 | 'SeriesType', 33 | ] 34 | 35 | from sdc.hiframes.pd_series_type import SeriesType 36 | -------------------------------------------------------------------------------- /sdc/extensions/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/extensions/indexes/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/functions/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/hiframes/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/io/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/native/stringlib/undef.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // Copyright (c) 2019-2020, Intel Corporation All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | //***************************************************************************** 26 | 27 | #undef FASTSEARCH 28 | #undef STRINGLIB 29 | #undef STRINGLIB_SIZEOF_CHAR 30 | #undef STRINGLIB_MAX_CHAR 31 | #undef STRINGLIB_CHAR 32 | #undef STRINGLIB_STR 33 | #undef STRINGLIB_LEN 34 | #undef STRINGLIB_NEW 35 | #undef _Py_InsertThousandsGrouping 36 | #undef STRINGLIB_IS_UNICODE 37 | -------------------------------------------------------------------------------- /sdc/rewrites/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /sdc/tests/categorical/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | from .test_categorical import * 28 | from .test_categoricaldtype import * 29 | from .test_series_category import * 30 | from .test_df_category import * 31 | -------------------------------------------------------------------------------- /sdc/tests/sdf_dt.pq.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelPython/sdc/eb5efbad9bfec67db88b52474c4bd00238b61283/sdc/tests/sdf_dt.pq.bz2 -------------------------------------------------------------------------------- /sdc/tests/test_base.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | import unittest 3 | 4 | 5 | class TestCase(unittest.TestCase): 6 | """Base class for all tests""" 7 | 8 | def numba_jit(self, *args, **kwargs): 9 | import numba 10 | if 'nopython' in kwargs: 11 | warnings.warn('nopython is set to True and is ignored', RuntimeWarning) 12 | if 'parallel' in kwargs: 13 | warnings.warn('parallel is set to True and is ignored', RuntimeWarning) 14 | kwargs.update({'nopython': True, 'parallel': True}) 15 | return numba.jit(*args, **kwargs) 16 | 17 | def sdc_jit(self, *args, **kwargs): 18 | import sdc 19 | return sdc.jit(*args, **kwargs) 20 | 21 | def jit(self, *args, **kwargs): 22 | return self.numba_jit(*args, **kwargs) 23 | 24 | def setUp(self): 25 | print("Running:", self._testMethodName) 26 | unittest.TestCase.setUp(self) 27 | -------------------------------------------------------------------------------- /sdc/tests/tests_perf/__init__.py: -------------------------------------------------------------------------------- 1 | from sdc.tests.tests_perf.test_perf_df import * 2 | from sdc.tests.tests_perf.test_perf_df_rolling import * 3 | from sdc.tests.tests_perf.test_perf_df_groupby import * 4 | from sdc.tests.tests_perf.test_perf_numpy import * 5 | from sdc.tests.tests_perf.test_perf_read_csv import * 6 | from sdc.tests.tests_perf.test_perf_series import * 7 | from sdc.tests.tests_perf.test_perf_series_operators import * 8 | from sdc.tests.tests_perf.test_perf_series_rolling import * 9 | from sdc.tests.tests_perf.test_perf_series_str import * 10 | from sdc.tests.tests_perf.test_perf_unicode import * 11 | -------------------------------------------------------------------------------- /sdc/types.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | 27 | from .datatypes.categorical.types import * 28 | from .datatypes.series.types import * 29 | -------------------------------------------------------------------------------- /sdc/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # Copyright (c) 2020, Intel Corporation All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ***************************************************************************** 26 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [versioneer] 2 | VCS = git 3 | style = pep440 4 | versionfile_source = sdc/_version.py 5 | versionfile_build = sdc/_version.py 6 | tag_prefix = 7 | parentdir_prefix = sdc- 8 | 9 | [pycodestyle] 10 | max_line_length = 120 11 | --------------------------------------------------------------------------------