1
0
forked from Alsan/Post_finder
This commit is contained in:
2024-12-04 13:35:57 +05:00
parent d346bf4b2a
commit 73ce681a55
7059 changed files with 1196501 additions and 0 deletions
venv
bin
lib
python3.12
site-packages
MarkupSafe-3.0.2.dist-info
__pycache__
blinker-1.9.0.dist-info
blinker
click-8.1.7.dist-info
click
dateutil
et_xmlfile-2.0.0.dist-info
et_xmlfile
flask-3.0.3.dist-info
flask
itsdangerous-2.2.0.dist-info
itsdangerous
jinja2-3.1.4.dist-info
jinja2
markupsafe
numpy-2.1.3.dist-info
numpy.libs
numpy
__config__.py__init__.cython-30.pxd__init__.pxd__init__.py__init__.pyi
__pycache__
_array_api_info.py_array_api_info.pyi_configtool.py
_core
__init__.py__init__.pyi
__pycache__
_add_newdocs.py_add_newdocs_scalars.py_asarray.py_asarray.pyi_dtype.py_dtype_ctypes.py_exceptions.py_internal.py_internal.pyi_machar.py_methods.py_multiarray_tests.cpython-312-x86_64-linux-gnu.so_multiarray_umath.cpython-312-x86_64-linux-gnu.so_operand_flag_tests.cpython-312-x86_64-linux-gnu.so_rational_tests.cpython-312-x86_64-linux-gnu.so_simd.cpython-312-x86_64-linux-gnu.so_string_helpers.py_struct_ufunc_tests.cpython-312-x86_64-linux-gnu.so_type_aliases.py_type_aliases.pyi_ufunc_config.py_ufunc_config.pyi_umath_tests.cpython-312-x86_64-linux-gnu.soarrayprint.pyarrayprint.pyicversions.pydefchararray.pydefchararray.pyieinsumfunc.pyeinsumfunc.pyifromnumeric.pyfromnumeric.pyifunction_base.pyfunction_base.pyigetlimits.pygetlimits.pyi
include
lib
memmap.pymemmap.pyimultiarray.pymultiarray.pyinumeric.pynumeric.pyinumerictypes.pynumerictypes.pyioverrides.pyprintoptions.pyrecords.pyrecords.pyishape_base.pyshape_base.pyistrings.pystrings.pyi
tests
__pycache__
_locales.cpython-312.pyc_natype.cpython-312.pyctest__exceptions.cpython-312.pyctest_abc.cpython-312.pyctest_api.cpython-312.pyctest_argparse.cpython-312.pyctest_array_api_info.cpython-312.pyctest_array_coercion.cpython-312.pyctest_array_interface.cpython-312.pyctest_arraymethod.cpython-312.pyctest_arrayobject.cpython-312.pyctest_arrayprint.cpython-312.pyctest_casting_floatingpoint_errors.cpython-312.pyctest_casting_unittests.cpython-312.pyctest_conversion_utils.cpython-312.pyctest_cpu_dispatcher.cpython-312.pyctest_cpu_features.cpython-312.pyctest_custom_dtypes.cpython-312.pyctest_cython.cpython-312.pyctest_datetime.cpython-312.pyctest_defchararray.cpython-312.pyctest_deprecations.cpython-312.pyctest_dlpack.cpython-312.pyctest_dtype.cpython-312.pyctest_einsum.cpython-312.pyctest_errstate.cpython-312.pyctest_extint128.cpython-312.pyctest_function_base.cpython-312.pyctest_getlimits.cpython-312.pyctest_half.cpython-312.pyctest_hashtable.cpython-312.pyctest_indexerrors.cpython-312.pyctest_indexing.cpython-312.pyctest_item_selection.cpython-312.pyctest_limited_api.cpython-312.pyctest_longdouble.cpython-312.pyctest_machar.cpython-312.pyctest_mem_overlap.cpython-312.pyctest_mem_policy.cpython-312.pyctest_memmap.cpython-312.pyctest_multiarray.cpython-312.pyctest_multithreading.cpython-312.pyctest_nditer.cpython-312.pyctest_nep50_promotions.cpython-312.pyctest_numeric.cpython-312.pyctest_numerictypes.cpython-312.pyctest_overrides.cpython-312.pyctest_print.cpython-312.pyctest_protocols.cpython-312.pyctest_records.cpython-312.pyctest_regression.cpython-312.pyctest_scalar_ctors.cpython-312.pyctest_scalar_methods.cpython-312.pyctest_scalarbuffer.cpython-312.pyctest_scalarinherit.cpython-312.pyctest_scalarmath.cpython-312.pyctest_scalarprint.cpython-312.pyctest_shape_base.cpython-312.pyctest_simd.cpython-312.pyctest_simd_module.cpython-312.pyctest_stringdtype.cpython-312.pyctest_strings.cpython-312.pyctest_ufunc.cpython-312.pyctest_umath.cpython-312.pyctest_umath_accuracy.cpython-312.pyctest_umath_complex.cpython-312.pyctest_unicode.cpython-312.pyc
_locales.py_natype.py
data
examples
test__exceptions.pytest_abc.pytest_api.pytest_argparse.pytest_array_api_info.pytest_array_coercion.pytest_array_interface.pytest_arraymethod.pytest_arrayobject.pytest_arrayprint.pytest_casting_floatingpoint_errors.pytest_casting_unittests.pytest_conversion_utils.pytest_cpu_dispatcher.pytest_cpu_features.pytest_custom_dtypes.pytest_cython.pytest_datetime.pytest_defchararray.pytest_deprecations.pytest_dlpack.pytest_dtype.pytest_einsum.pytest_errstate.pytest_extint128.pytest_function_base.pytest_getlimits.pytest_half.pytest_hashtable.pytest_indexerrors.pytest_indexing.pytest_item_selection.pytest_limited_api.pytest_longdouble.pytest_machar.pytest_mem_overlap.pytest_mem_policy.pytest_memmap.pytest_multiarray.pytest_multithreading.pytest_nditer.pytest_nep50_promotions.pytest_numeric.pytest_numerictypes.pytest_overrides.pytest_print.pytest_protocols.pytest_records.pytest_regression.pytest_scalar_ctors.pytest_scalar_methods.pytest_scalarbuffer.pytest_scalarinherit.pytest_scalarmath.pytest_scalarprint.pytest_shape_base.pytest_simd.pytest_simd_module.pytest_stringdtype.pytest_strings.pytest_ufunc.pytest_umath.pytest_umath_accuracy.pytest_umath_complex.pytest_unicode.py
umath.py
_distributor_init.py_expired_attrs_2_0.py_globals.py
_pyinstaller
_pytesttester.py_pytesttester.pyi
_typing
_utils
char
compat
conftest.py
core
ctypeslib.pyctypeslib.pyi
doc
dtypes.pydtypes.pyiexceptions.pyexceptions.pyi
f2py
__init__.py__init__.pyi__main__.py
__pycache__
__version__.py
_backends
_isocbind.py_src_pyf.pyauxfuncs.pycapi_maps.pycb_rules.pycfuncs.pycommon_rules.pycrackfortran.pydiagnose.pyf2py2e.pyf90mod_rules.pyfunc2subr.pyrules.pysetup.cfg
src
symbolic.py
tests
__init__.py
__pycache__
src
test_abstract_interface.pytest_array_from_pyobj.pytest_assumed_shape.pytest_block_docstring.pytest_callback.pytest_character.pytest_common.pytest_crackfortran.pytest_data.pytest_docs.pytest_f2cmap.pytest_f2py2e.pytest_isoc.pytest_kind.pytest_mixed.pytest_modules.pytest_parameter.pytest_pyf_src.pytest_quoted_character.pytest_regression.pytest_return_character.pytest_return_complex.pytest_return_integer.pytest_return_logical.pytest_return_real.pytest_semicolon_split.pytest_size.pytest_string.pytest_symbolic.pytest_value_attrspec.pyutil.py
use_rules.py
fft
lib
__init__.py__init__.pyi
__pycache__
_array_utils_impl.py_array_utils_impl.pyi_arraypad_impl.py_arraypad_impl.pyi_arraysetops_impl.py_arraysetops_impl.pyi_arrayterator_impl.py_arrayterator_impl.pyi_datasource.py_function_base_impl.py_function_base_impl.pyi_histograms_impl.py_histograms_impl.pyi_index_tricks_impl.py_index_tricks_impl.pyi_iotools.py_nanfunctions_impl.py_nanfunctions_impl.pyi_npyio_impl.py_npyio_impl.pyi_polynomial_impl.py_polynomial_impl.pyi_scimath_impl.py_scimath_impl.pyi_shape_base_impl.py_shape_base_impl.pyi_stride_tricks_impl.py_stride_tricks_impl.pyi_twodim_base_impl.py_twodim_base_impl.pyi_type_check_impl.py_type_check_impl.pyi_ufunclike_impl.py_ufunclike_impl.pyi_user_array_impl.py_utils_impl.py_utils_impl.pyi_version.py_version.pyiarray_utils.pyarray_utils.pyiformat.pyformat.pyiintrospect.pymixins.pymixins.pyinpyio.pynpyio.pyirecfunctions.pyscimath.pyscimath.pyistride_tricks.pystride_tricks.pyi
tests
user_array.py
linalg
ma
matlib.py
matrixlib
polynomial
py.typed
random
LICENSE.md__init__.pxd__init__.py__init__.pyi
__pycache__
_bounded_integers.cpython-312-x86_64-linux-gnu.so_bounded_integers.pxd_common.cpython-312-x86_64-linux-gnu.so_common.pxd
_examples
_generator.cpython-312-x86_64-linux-gnu.so_generator.pyi_mt19937.cpython-312-x86_64-linux-gnu.so_mt19937.pyi_pcg64.cpython-312-x86_64-linux-gnu.so_pcg64.pyi_philox.cpython-312-x86_64-linux-gnu.so_philox.pyi_pickle.py_sfc64.cpython-312-x86_64-linux-gnu.so_sfc64.pyibit_generator.cpython-312-x86_64-linux-gnu.sobit_generator.pxdbit_generator.pyic_distributions.pxd
lib
mtrand.cpython-312-x86_64-linux-gnu.somtrand.pyi
tests
rec
strings
testing
tests
typing
__init__.py
__pycache__
mypy_plugin.py
tests
__init__.py
__pycache__
data
fail
misc
mypy.ini
pass
reveal
test_isfile.pytest_runtime.pytest_typing.py
version.pyversion.pyi
openpyxl-3.1.5.dist-info
openpyxl
__init__.py
__pycache__
_constants.py
cell
chart
chartsheet
comments
compat
descriptors
drawing
formatting
formula
packaging
pivot
reader
styles
utils
workbook
worksheet
writer
xml
pandas-2.2.3.dist-info
pandas
__init__.py
__pycache__
_config
_libs
__init__.py
__pycache__
algos.cpython-312-x86_64-linux-gnu.soalgos.pyiarrays.cpython-312-x86_64-linux-gnu.soarrays.pyibyteswap.cpython-312-x86_64-linux-gnu.sobyteswap.pyigroupby.cpython-312-x86_64-linux-gnu.sogroupby.pyihashing.cpython-312-x86_64-linux-gnu.sohashing.pyihashtable.cpython-312-x86_64-linux-gnu.sohashtable.pyiindex.cpython-312-x86_64-linux-gnu.soindex.pyiindexing.cpython-312-x86_64-linux-gnu.soindexing.pyiinternals.cpython-312-x86_64-linux-gnu.sointernals.pyiinterval.cpython-312-x86_64-linux-gnu.sointerval.pyijoin.cpython-312-x86_64-linux-gnu.sojoin.pyijson.cpython-312-x86_64-linux-gnu.sojson.pyilib.cpython-312-x86_64-linux-gnu.solib.pyimissing.cpython-312-x86_64-linux-gnu.somissing.pyiops.cpython-312-x86_64-linux-gnu.soops.pyiops_dispatch.cpython-312-x86_64-linux-gnu.soops_dispatch.pyipandas_datetime.cpython-312-x86_64-linux-gnu.sopandas_parser.cpython-312-x86_64-linux-gnu.soparsers.cpython-312-x86_64-linux-gnu.soparsers.pyiproperties.cpython-312-x86_64-linux-gnu.soproperties.pyireshape.cpython-312-x86_64-linux-gnu.soreshape.pyisas.cpython-312-x86_64-linux-gnu.sosas.pyisparse.cpython-312-x86_64-linux-gnu.sosparse.pyitesting.cpython-312-x86_64-linux-gnu.sotesting.pyitslib.cpython-312-x86_64-linux-gnu.sotslib.pyi
tslibs
window
writers.cpython-312-x86_64-linux-gnu.sowriters.pyi
_testing
_typing.py_version.py_version_meson.py
api
arrays
compat
conftest.py
core
__init__.py
__pycache__
_numba
accessor.pyalgorithms.pyapi.pyapply.py
array_algos
arraylike.py
arrays
base.pycommon.py
computation
config_init.pyconstruction.py
dtypes
flags.pyframe.pygeneric.py
groupby
indexers
indexes
indexing.py
interchange
internals
methods
missing.pynanops.py
ops
resample.py
reshape
roperator.pysample.pyseries.pyshared_docs.pysorting.py
sparse
strings
tools
util
window
errors
io
__init__.py
__pycache__
_util.pyapi.py
clipboard
clipboards.pycommon.py
excel
feather_format.py
formats
gbq.pyhtml.py
json
orc.pyparquet.py
parsers
pickle.pypytables.py
sas
spss.pysql.pystata.pyxml.py
plotting
pyproject.tomltesting.py
tests
__init__.py
__pycache__
api
apply
arithmetic
arrays
__init__.py
__pycache__
boolean
categorical
datetimes
floating
integer
interval
masked
masked_shared.py
numpy_
period
sparse
string_
test_array.pytest_datetimelike.pytest_datetimes.pytest_ndarray_backed.pytest_period.pytest_timedeltas.py
timedeltas
base
computation
config
construction
copy_view
dtypes
extension
__init__.py
__pycache__
array_with_attr
base
conftest.py
date
decimal
json
list
test_arrow.pytest_categorical.pytest_common.pytest_datetime.pytest_extension.pytest_interval.pytest_masked.pytest_numpy.pytest_period.pytest_sparse.pytest_string.py
frame
__init__.py
__pycache__
common.pyconftest.py
constructors
indexing
methods
__init__.py
__pycache__
__init__.cpython-312.pyctest_add_prefix_suffix.cpython-312.pyctest_align.cpython-312.pyctest_asfreq.cpython-312.pyctest_asof.cpython-312.pyctest_assign.cpython-312.pyctest_astype.cpython-312.pyctest_at_time.cpython-312.pyctest_between_time.cpython-312.pyctest_clip.cpython-312.pyctest_combine.cpython-312.pyctest_combine_first.cpython-312.pyctest_compare.cpython-312.pyctest_convert_dtypes.cpython-312.pyctest_copy.cpython-312.pyctest_count.cpython-312.pyctest_cov_corr.cpython-312.pyctest_describe.cpython-312.pyctest_diff.cpython-312.pyctest_dot.cpython-312.pyctest_drop.cpython-312.pyctest_drop_duplicates.cpython-312.pyctest_droplevel.cpython-312.pyctest_dropna.cpython-312.pyctest_dtypes.cpython-312.pyctest_duplicated.cpython-312.pyctest_equals.cpython-312.pyctest_explode.cpython-312.pyctest_fillna.cpython-312.pyctest_filter.cpython-312.pyctest_first_and_last.cpython-312.pyctest_first_valid_index.cpython-312.pyctest_get_numeric_data.cpython-312.pyctest_head_tail.cpython-312.pyctest_infer_objects.cpython-312.pyctest_info.cpython-312.pyctest_interpolate.cpython-312.pyctest_is_homogeneous_dtype.cpython-312.pyctest_isetitem.cpython-312.pyctest_isin.cpython-312.pyctest_iterrows.cpython-312.pyctest_join.cpython-312.pyctest_map.cpython-312.pyctest_matmul.cpython-312.pyctest_nlargest.cpython-312.pyctest_pct_change.cpython-312.pyctest_pipe.cpython-312.pyctest_pop.cpython-312.pyctest_quantile.cpython-312.pyctest_rank.cpython-312.pyctest_reindex.cpython-312.pyctest_reindex_like.cpython-312.pyctest_rename.cpython-312.pyctest_rename_axis.cpython-312.pyctest_reorder_levels.cpython-312.pyctest_replace.cpython-312.pyctest_reset_index.cpython-312.pyctest_round.cpython-312.pyctest_sample.cpython-312.pyctest_select_dtypes.cpython-312.pyctest_set_axis.cpython-312.pyctest_set_index.cpython-312.pyctest_shift.cpython-312.pyctest_size.cpython-312.pyctest_sort_index.cpython-312.pyctest_sort_values.cpython-312.pyctest_swapaxes.cpython-312.pyctest_swaplevel.cpython-312.pyctest_to_csv.cpython-312.pyctest_to_dict.cpython-312.pyctest_to_dict_of_blocks.cpython-312.pyctest_to_numpy.cpython-312.pyctest_to_period.cpython-312.pyctest_to_records.cpython-312.pyctest_to_timestamp.cpython-312.pyctest_transpose.cpython-312.pyctest_truncate.cpython-312.pyctest_tz_convert.cpython-312.pyctest_tz_localize.cpython-312.pyctest_update.cpython-312.pyctest_value_counts.cpython-312.pyctest_values.cpython-312.pyc
test_add_prefix_suffix.pytest_align.pytest_asfreq.pytest_asof.pytest_assign.pytest_astype.pytest_at_time.pytest_between_time.pytest_clip.pytest_combine.pytest_combine_first.pytest_compare.pytest_convert_dtypes.pytest_copy.pytest_count.pytest_cov_corr.pytest_describe.pytest_diff.pytest_dot.pytest_drop.pytest_drop_duplicates.pytest_droplevel.pytest_dropna.pytest_dtypes.pytest_duplicated.pytest_equals.pytest_explode.pytest_fillna.pytest_filter.pytest_first_and_last.pytest_first_valid_index.pytest_get_numeric_data.pytest_head_tail.pytest_infer_objects.pytest_info.pytest_interpolate.pytest_is_homogeneous_dtype.pytest_isetitem.pytest_isin.pytest_iterrows.pytest_join.pytest_map.pytest_matmul.pytest_nlargest.pytest_pct_change.pytest_pipe.pytest_pop.pytest_quantile.pytest_rank.pytest_reindex.pytest_reindex_like.pytest_rename.pytest_rename_axis.pytest_reorder_levels.pytest_replace.pytest_reset_index.pytest_round.pytest_sample.pytest_select_dtypes.pytest_set_axis.pytest_set_index.pytest_shift.pytest_size.pytest_sort_index.pytest_sort_values.pytest_swapaxes.pytest_swaplevel.pytest_to_csv.pytest_to_dict.pytest_to_dict_of_blocks.pytest_to_numpy.pytest_to_period.pytest_to_records.pytest_to_timestamp.pytest_transpose.pytest_truncate.pytest_tz_convert.pytest_tz_localize.pytest_update.pytest_value_counts.pytest_values.py
test_alter_axes.pytest_api.pytest_arithmetic.pytest_arrow_interface.pytest_block_internals.pytest_constructors.pytest_cumulative.pytest_iteration.pytest_logical_ops.pytest_nonunique_indexes.pytest_npfuncs.pytest_query_eval.pytest_reductions.pytest_repr.pytest_stack_unstack.pytest_subclass.pytest_ufunc.pytest_unary.pytest_validate.py
generic
groupby
__init__.py
__pycache__
aggregate
conftest.py
methods
test_all_methods.pytest_api.pytest_apply.pytest_apply_mutate.pytest_bin_groupby.pytest_categorical.pytest_counting.pytest_cumulative.pytest_filters.pytest_groupby.pytest_groupby_dropna.pytest_groupby_subclass.pytest_grouping.pytest_index_as_string.pytest_indexing.pytest_libgroupby.pytest_missing.pytest_numba.pytest_numeric_only.pytest_pipe.pytest_raises.pytest_reductions.pytest_timegrouper.py
transform
indexes
__init__.py
__pycache__
base_class
categorical
conftest.py
datetimelike_
datetimes
__init__.py
__pycache__
methods
test_arithmetic.pytest_constructors.pytest_date_range.pytest_datetime.pytest_formats.pytest_freq_attr.pytest_indexing.pytest_iter.pytest_join.pytest_npfuncs.pytest_ops.pytest_partial_slicing.pytest_pickle.pytest_reindex.pytest_scalar_compat.pytest_setops.pytest_timezones.py
interval
multi
numeric
object
period
ranges
test_any_index.pytest_base.pytest_common.pytest_datetimelike.pytest_engines.pytest_frozen.pytest_index_new.pytest_indexing.pytest_numpy_compat.pytest_old_base.pytest_setops.pytest_subclass.py
timedeltas
indexing
interchange
internals
io
__init__.py
__pycache__
conftest.py
excel
formats
generate_legacy_storage_files.py
json
parser
__init__.py
__pycache__
common
conftest.py
dtypes
test_c_parser_only.pytest_comment.pytest_compression.pytest_concatenate_chunks.pytest_converters.pytest_dialect.pytest_encoding.pytest_header.pytest_index_col.pytest_mangle_dupes.pytest_multi_thread.pytest_na_values.pytest_network.pytest_parse_dates.pytest_python_parser_only.pytest_quoting.pytest_read_fwf.pytest_skiprows.pytest_textreader.pytest_unsupported.pytest_upcast.py
usecols
pytables
sas
test_clipboard.pytest_common.pytest_compression.pytest_feather.pytest_fsspec.pytest_gbq.pytest_gcs.pytest_html.pytest_http_headers.pytest_orc.pytest_parquet.pytest_pickle.pytest_s3.pytest_spss.pytest_sql.pytest_stata.py
xml
libs
plotting
reductions
resample
reshape
scalar
__init__.py
__pycache__
interval
period
test_na_scalar.pytest_nat.py
timedelta
timestamp
series
__init__.py
__pycache__
accessors
indexing
methods
__init__.py
__pycache__
__init__.cpython-312.pyctest_add_prefix_suffix.cpython-312.pyctest_align.cpython-312.pyctest_argsort.cpython-312.pyctest_asof.cpython-312.pyctest_astype.cpython-312.pyctest_autocorr.cpython-312.pyctest_between.cpython-312.pyctest_case_when.cpython-312.pyctest_clip.cpython-312.pyctest_combine.cpython-312.pyctest_combine_first.cpython-312.pyctest_compare.cpython-312.pyctest_convert_dtypes.cpython-312.pyctest_copy.cpython-312.pyctest_count.cpython-312.pyctest_cov_corr.cpython-312.pyctest_describe.cpython-312.pyctest_diff.cpython-312.pyctest_drop.cpython-312.pyctest_drop_duplicates.cpython-312.pyctest_dropna.cpython-312.pyctest_dtypes.cpython-312.pyctest_duplicated.cpython-312.pyctest_equals.cpython-312.pyctest_explode.cpython-312.pyctest_fillna.cpython-312.pyctest_get_numeric_data.cpython-312.pyctest_head_tail.cpython-312.pyctest_infer_objects.cpython-312.pyctest_info.cpython-312.pyctest_interpolate.cpython-312.pyctest_is_monotonic.cpython-312.pyctest_is_unique.cpython-312.pyctest_isin.cpython-312.pyctest_isna.cpython-312.pyctest_item.cpython-312.pyctest_map.cpython-312.pyctest_matmul.cpython-312.pyctest_nlargest.cpython-312.pyctest_nunique.cpython-312.pyctest_pct_change.cpython-312.pyctest_pop.cpython-312.pyctest_quantile.cpython-312.pyctest_rank.cpython-312.pyctest_reindex.cpython-312.pyctest_reindex_like.cpython-312.pyctest_rename.cpython-312.pyctest_rename_axis.cpython-312.pyctest_repeat.cpython-312.pyctest_replace.cpython-312.pyctest_reset_index.cpython-312.pyctest_round.cpython-312.pyctest_searchsorted.cpython-312.pyctest_set_name.cpython-312.pyctest_size.cpython-312.pyctest_sort_index.cpython-312.pyctest_sort_values.cpython-312.pyctest_to_csv.cpython-312.pyctest_to_dict.cpython-312.pyctest_to_frame.cpython-312.pyctest_to_numpy.cpython-312.pyctest_tolist.cpython-312.pyctest_truncate.cpython-312.pyctest_tz_localize.cpython-312.pyctest_unique.cpython-312.pyctest_unstack.cpython-312.pyctest_update.cpython-312.pyctest_value_counts.cpython-312.pyctest_values.cpython-312.pyctest_view.cpython-312.pyc
test_add_prefix_suffix.pytest_align.pytest_argsort.pytest_asof.pytest_astype.pytest_autocorr.pytest_between.pytest_case_when.pytest_clip.pytest_combine.pytest_combine_first.pytest_compare.pytest_convert_dtypes.pytest_copy.pytest_count.pytest_cov_corr.pytest_describe.pytest_diff.pytest_drop.pytest_drop_duplicates.pytest_dropna.pytest_dtypes.pytest_duplicated.pytest_equals.pytest_explode.pytest_fillna.pytest_get_numeric_data.pytest_head_tail.pytest_infer_objects.pytest_info.pytest_interpolate.pytest_is_monotonic.pytest_is_unique.pytest_isin.pytest_isna.pytest_item.pytest_map.pytest_matmul.pytest_nlargest.pytest_nunique.pytest_pct_change.pytest_pop.pytest_quantile.pytest_rank.pytest_reindex.pytest_reindex_like.pytest_rename.pytest_rename_axis.pytest_repeat.pytest_replace.pytest_reset_index.pytest_round.pytest_searchsorted.pytest_set_name.pytest_size.pytest_sort_index.pytest_sort_values.pytest_to_csv.pytest_to_dict.pytest_to_frame.pytest_to_numpy.pytest_tolist.pytest_truncate.pytest_tz_localize.pytest_unique.pytest_unstack.pytest_update.pytest_value_counts.pytest_values.pytest_view.py
test_api.pytest_arithmetic.pytest_constructors.pytest_cumulative.pytest_formats.pytest_iteration.pytest_logical_ops.pytest_missing.pytest_npfuncs.pytest_reductions.pytest_subclass.pytest_ufunc.pytest_unary.pytest_validate.py
strings
test_aggregation.pytest_algos.pytest_common.pytest_downstream.pytest_errors.pytest_expressions.pytest_flags.pytest_multilevel.pytest_nanops.pytest_optional_dependency.pytest_register_accessor.pytest_sorting.pytest_take.py
tools
tseries
__init__.py
__pycache__
frequencies
holiday
offsets
tslibs
util
__init__.py
__pycache__
conftest.pytest_assert_almost_equal.pytest_assert_attr_equal.pytest_assert_categorical_equal.pytest_assert_extension_array_equal.pytest_assert_frame_equal.pytest_assert_index_equal.pytest_assert_interval_array_equal.pytest_assert_numpy_array_equal.pytest_assert_produces_warning.pytest_assert_series_equal.pytest_deprecate.pytest_deprecate_kwarg.pytest_deprecate_nonkeyword_arguments.pytest_doc.pytest_hashing.pytest_numba.pytest_rewrite_warning.pytest_shares_memory.pytest_show_versions.pytest_util.pytest_validate_args.pytest_validate_args_and_kwargs.pytest_validate_inclusive.pytest_validate_kwargs.py
window
tseries
util
pip-24.3.1.dist-info
pip
__init__.py__main__.py__pip-runner__.py
__pycache__
_internal
__init__.py
__pycache__
build_env.pycache.py
cli
commands
configuration.py
distributions
exceptions.py
index
locations
main.py
metadata
models
network
operations
pyproject.py
req
resolution
self_outdated_check.py
utils
vcs
wheel_builder.py
_vendor
__init__.py
__pycache__
cachecontrol
certifi
distlib
distro
idna
msgpack
packaging
pkg_resources
platformdirs
pygments
pyproject_hooks
requests
resolvelib
rich
__init__.py__main__.py
__pycache__
__init__.cpython-312.pyc__main__.cpython-312.pyc_cell_widths.cpython-312.pyc_emoji_codes.cpython-312.pyc_emoji_replace.cpython-312.pyc_export_format.cpython-312.pyc_extension.cpython-312.pyc_fileno.cpython-312.pyc_inspect.cpython-312.pyc_log_render.cpython-312.pyc_loop.cpython-312.pyc_null_file.cpython-312.pyc_palettes.cpython-312.pyc_pick.cpython-312.pyc_ratio.cpython-312.pyc_spinners.cpython-312.pyc_stack.cpython-312.pyc_timer.cpython-312.pyc_win32_console.cpython-312.pyc_windows.cpython-312.pyc_windows_renderer.cpython-312.pyc_wrap.cpython-312.pycabc.cpython-312.pycalign.cpython-312.pycansi.cpython-312.pycbar.cpython-312.pycbox.cpython-312.pyccells.cpython-312.pyccolor.cpython-312.pyccolor_triplet.cpython-312.pyccolumns.cpython-312.pycconsole.cpython-312.pycconstrain.cpython-312.pyccontainers.cpython-312.pyccontrol.cpython-312.pycdefault_styles.cpython-312.pycdiagnose.cpython-312.pycemoji.cpython-312.pycerrors.cpython-312.pycfile_proxy.cpython-312.pycfilesize.cpython-312.pychighlighter.cpython-312.pycjson.cpython-312.pycjupyter.cpython-312.pyclayout.cpython-312.pyclive.cpython-312.pyclive_render.cpython-312.pyclogging.cpython-312.pycmarkup.cpython-312.pycmeasure.cpython-312.pycpadding.cpython-312.pycpager.cpython-312.pycpalette.cpython-312.pycpanel.cpython-312.pycpretty.cpython-312.pycprogress.cpython-312.pycprogress_bar.cpython-312.pycprompt.cpython-312.pycprotocol.cpython-312.pycregion.cpython-312.pycrepr.cpython-312.pycrule.cpython-312.pycscope.cpython-312.pycscreen.cpython-312.pycsegment.cpython-312.pycspinner.cpython-312.pycstatus.cpython-312.pycstyle.cpython-312.pycstyled.cpython-312.pycsyntax.cpython-312.pyctable.cpython-312.pycterminal_theme.cpython-312.pyctext.cpython-312.pyctheme.cpython-312.pycthemes.cpython-312.pyctraceback.cpython-312.pyctree.cpython-312.pyc
_cell_widths.py_emoji_codes.py_emoji_replace.py_export_format.py_extension.py_fileno.py_inspect.py_log_render.py_loop.py_null_file.py_palettes.py_pick.py_ratio.py_spinners.py_stack.py_timer.py_win32_console.py_windows.py_windows_renderer.py_wrap.pyabc.pyalign.pyansi.pybar.pybox.pycells.pycolor.pycolor_triplet.pycolumns.pyconsole.pyconstrain.pycontainers.pycontrol.pydefault_styles.pydiagnose.pyemoji.pyerrors.pyfile_proxy.pyfilesize.pyhighlighter.pyjson.pyjupyter.pylayout.pylive.pylive_render.pylogging.pymarkup.pymeasure.pypadding.pypager.pypalette.pypanel.pypretty.pyprogress.pyprogress_bar.pyprompt.pyprotocol.pypy.typedregion.pyrepr.pyrule.pyscope.pyscreen.pysegment.pyspinner.pystatus.pystyle.pystyled.pysyntax.pytable.pyterminal_theme.pytext.pytheme.pythemes.pytraceback.pytree.py
tomli
truststore
typing_extensions.py
urllib3
__init__.py
__pycache__
_collections.py_version.pyconnection.pyconnectionpool.py
contrib
exceptions.pyfields.pyfilepost.py
packages
poolmanager.pyrequest.pyresponse.py
util
vendor.txt
py.typed
python_dateutil-2.9.0.post0.dist-info
pytz-2024.2.dist-info
pytz
__init__.py
__pycache__
exceptions.pylazy.pyreference.pytzfile.pytzinfo.py
zoneinfo
Africa
America
Antarctica
Arctic
Asia
Atlantic
Australia
Brazil
CETCST6CDT
Canada
Chile
CubaEETESTEST5EDTEgyptEire
Etc
Europe
FactoryGBGB-EireGMTGMT+0GMT-0GMT0GreenwichHSTHongkongIceland
Indian
IranIsraelJamaicaJapanKwajaleinLibyaMETMSTMST7MDT
Mexico
NZNZ-CHATNavajoPRCPST8PDT
Pacific
PolandPortugalROCROKSingaporeTurkeyUCT
US
UTCUniversalW-SUWETZuluiso3166.tableapsecondstzdata.zizone.tabzone1970.tabzonenow.tab
six-1.16.0.dist-info
six.py
tzdata-2024.2.dist-info
tzdata
__init__.py
__pycache__
zoneinfo
Africa
America
AdakAnchorageAnguillaAntiguaAraguaina
Argentina
ArubaAsuncionAtikokanAtkaBahiaBahia_BanderasBarbadosBelemBelizeBlanc-SablonBoa_VistaBogotaBoiseBuenos_AiresCambridge_BayCampo_GrandeCancunCaracasCatamarcaCayenneCaymanChicagoChihuahuaCiudad_JuarezCoral_HarbourCordobaCosta_RicaCrestonCuiabaCuracaoDanmarkshavnDawsonDawson_CreekDenverDetroitDominicaEdmontonEirunepeEl_SalvadorEnsenadaFort_NelsonFort_WayneFortalezaGlace_BayGodthabGoose_BayGrand_TurkGrenadaGuadeloupeGuatemalaGuayaquilGuyanaHalifaxHavanaHermosillo
Indiana
IndianapolisInuvikIqaluitJamaicaJujuyJuneau
Kentucky
Knox_INKralendijkLa_PazLimaLos_AngelesLouisvilleLower_PrincesMaceioManaguaManausMarigotMartiniqueMatamorosMazatlanMendozaMenomineeMeridaMetlakatlaMexico_CityMiquelonMonctonMonterreyMontevideoMontrealMontserratNassauNew_YorkNipigonNomeNoronha
North_Dakota
NuukOjinagaPanamaPangnirtungParamariboPhoenixPort-au-PrincePort_of_SpainPorto_AcrePorto_VelhoPuerto_RicoPunta_ArenasRainy_RiverRankin_InletRecifeReginaResoluteRio_BrancoRosarioSanta_IsabelSantaremSantiagoSanto_DomingoSao_PauloScoresbysundShiprockSitkaSt_BarthelemySt_JohnsSt_KittsSt_LuciaSt_ThomasSt_VincentSwift_CurrentTegucigalpaThuleThunder_BayTijuanaTorontoTortolaVancouverVirginWhitehorseWinnipegYakutatYellowknife__init__.py
__pycache__
Antarctica
Arctic
Asia
Atlantic
Australia
Brazil
CETCST6CDT
Canada
Chile
CubaEETESTEST5EDTEgyptEire
Etc
Europe
FactoryGBGB-EireGMTGMT+0GMT-0GMT0GreenwichHSTHongkongIceland
Indian
IranIsraelJamaicaJapanKwajaleinLibyaMETMSTMST7MDT
Mexico
NZNZ-CHATNavajoPRCPST8PDT
Pacific
PolandPortugalROCROKSingaporeTurkeyUCT
US
UTCUniversalW-SUWETZulu__init__.py
__pycache__
iso3166.tableapsecondstzdata.zizone.tabzone1970.tabzonenow.tab
zones
werkzeug-3.1.3.dist-info
werkzeug
__init__.py
__pycache__
_internal.py_reloader.py
datastructures
debug
exceptions.pyformparser.pyhttp.pylocal.py
middleware
py.typed
routing
sansio
security.pyserving.pytest.pytestapp.pyurls.pyuser_agent.pyutils.py
wrappers
wsgi.py
lib64pyvenv.cfg

@ -0,0 +1,28 @@
import pytest
from pandas import (
Categorical,
CategoricalDtype,
Index,
IntervalIndex,
)
import pandas._testing as tm
class TestAstype:
@pytest.mark.parametrize("ordered", [True, False])
def test_astype_categorical_retains_ordered(self, ordered):
index = IntervalIndex.from_breaks(range(5))
arr = index._data
dtype = CategoricalDtype(None, ordered=ordered)
expected = Categorical(list(arr), ordered=ordered)
result = arr.astype(dtype)
assert result.ordered is ordered
tm.assert_categorical_equal(result, expected)
# test IntervalIndex.astype while we're at it.
result = index.astype(dtype)
expected = Index(expected)
tm.assert_index_equal(result, expected)

@ -0,0 +1,13 @@
from pandas.core.arrays import IntervalArray
def test_repr():
# GH#25022
arr = IntervalArray.from_tuples([(0, 1), (1, 2)])
result = repr(arr)
expected = (
"<IntervalArray>\n"
"[(0, 1], (1, 2]]\n"
"Length: 2, dtype: interval[int64, right]"
)
assert result == expected

@ -0,0 +1,231 @@
import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
Interval,
IntervalIndex,
Timedelta,
Timestamp,
date_range,
timedelta_range,
)
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
@pytest.fixture(
params=[
(Index([0, 2, 4]), Index([1, 3, 5])),
(Index([0.0, 1.0, 2.0]), Index([1.0, 2.0, 3.0])),
(timedelta_range("0 days", periods=3), timedelta_range("1 day", periods=3)),
(date_range("20170101", periods=3), date_range("20170102", periods=3)),
(
date_range("20170101", periods=3, tz="US/Eastern"),
date_range("20170102", periods=3, tz="US/Eastern"),
),
],
ids=lambda x: str(x[0].dtype),
)
def left_right_dtypes(request):
"""
Fixture for building an IntervalArray from various dtypes
"""
return request.param
class TestAttributes:
@pytest.mark.parametrize(
"left, right",
[
(0, 1),
(Timedelta("0 days"), Timedelta("1 day")),
(Timestamp("2018-01-01"), Timestamp("2018-01-02")),
(
Timestamp("2018-01-01", tz="US/Eastern"),
Timestamp("2018-01-02", tz="US/Eastern"),
),
],
)
@pytest.mark.parametrize("constructor", [IntervalArray, IntervalIndex])
def test_is_empty(self, constructor, left, right, closed):
# GH27219
tuples = [(left, left), (left, right), np.nan]
expected = np.array([closed != "both", False, False])
result = constructor.from_tuples(tuples, closed=closed).is_empty
tm.assert_numpy_array_equal(result, expected)
class TestMethods:
@pytest.mark.parametrize("new_closed", ["left", "right", "both", "neither"])
def test_set_closed(self, closed, new_closed):
# GH 21670
array = IntervalArray.from_breaks(range(10), closed=closed)
result = array.set_closed(new_closed)
expected = IntervalArray.from_breaks(range(10), closed=new_closed)
tm.assert_extension_array_equal(result, expected)
@pytest.mark.parametrize(
"other",
[
Interval(0, 1, closed="right"),
IntervalArray.from_breaks([1, 2, 3, 4], closed="right"),
],
)
def test_where_raises(self, other):
# GH#45768 The IntervalArray methods raises; the Series method coerces
ser = pd.Series(IntervalArray.from_breaks([1, 2, 3, 4], closed="left"))
mask = np.array([True, False, True])
match = "'value.closed' is 'right', expected 'left'."
with pytest.raises(ValueError, match=match):
ser.array._where(mask, other)
res = ser.where(mask, other=other)
expected = ser.astype(object).where(mask, other)
tm.assert_series_equal(res, expected)
def test_shift(self):
# https://github.com/pandas-dev/pandas/issues/31495, GH#22428, GH#31502
a = IntervalArray.from_breaks([1, 2, 3])
result = a.shift()
# int -> float
expected = IntervalArray.from_tuples([(np.nan, np.nan), (1.0, 2.0)])
tm.assert_interval_array_equal(result, expected)
msg = "can only insert Interval objects and NA into an IntervalArray"
with pytest.raises(TypeError, match=msg):
a.shift(1, fill_value=pd.NaT)
def test_shift_datetime(self):
# GH#31502, GH#31504
a = IntervalArray.from_breaks(date_range("2000", periods=4))
result = a.shift(2)
expected = a.take([-1, -1, 0], allow_fill=True)
tm.assert_interval_array_equal(result, expected)
result = a.shift(-1)
expected = a.take([1, 2, -1], allow_fill=True)
tm.assert_interval_array_equal(result, expected)
msg = "can only insert Interval objects and NA into an IntervalArray"
with pytest.raises(TypeError, match=msg):
a.shift(1, fill_value=np.timedelta64("NaT", "ns"))
class TestSetitem:
def test_set_na(self, left_right_dtypes):
left, right = left_right_dtypes
left = left.copy(deep=True)
right = right.copy(deep=True)
result = IntervalArray.from_arrays(left, right)
if result.dtype.subtype.kind not in ["m", "M"]:
msg = "'value' should be an interval type, got <.*NaTType'> instead."
with pytest.raises(TypeError, match=msg):
result[0] = pd.NaT
if result.dtype.subtype.kind in ["i", "u"]:
msg = "Cannot set float NaN to integer-backed IntervalArray"
# GH#45484 TypeError, not ValueError, matches what we get with
# non-NA un-holdable value.
with pytest.raises(TypeError, match=msg):
result[0] = np.nan
return
result[0] = np.nan
expected_left = Index([left._na_value] + list(left[1:]))
expected_right = Index([right._na_value] + list(right[1:]))
expected = IntervalArray.from_arrays(expected_left, expected_right)
tm.assert_extension_array_equal(result, expected)
def test_setitem_mismatched_closed(self):
arr = IntervalArray.from_breaks(range(4))
orig = arr.copy()
other = arr.set_closed("both")
msg = "'value.closed' is 'both', expected 'right'"
with pytest.raises(ValueError, match=msg):
arr[0] = other[0]
with pytest.raises(ValueError, match=msg):
arr[:1] = other[:1]
with pytest.raises(ValueError, match=msg):
arr[:0] = other[:0]
with pytest.raises(ValueError, match=msg):
arr[:] = other[::-1]
with pytest.raises(ValueError, match=msg):
arr[:] = list(other[::-1])
with pytest.raises(ValueError, match=msg):
arr[:] = other[::-1].astype(object)
with pytest.raises(ValueError, match=msg):
arr[:] = other[::-1].astype("category")
# empty list should be no-op
arr[:0] = []
tm.assert_interval_array_equal(arr, orig)
class TestReductions:
def test_min_max_invalid_axis(self, left_right_dtypes):
left, right = left_right_dtypes
left = left.copy(deep=True)
right = right.copy(deep=True)
arr = IntervalArray.from_arrays(left, right)
msg = "`axis` must be fewer than the number of dimensions"
for axis in [-2, 1]:
with pytest.raises(ValueError, match=msg):
arr.min(axis=axis)
with pytest.raises(ValueError, match=msg):
arr.max(axis=axis)
msg = "'>=' not supported between"
with pytest.raises(TypeError, match=msg):
arr.min(axis="foo")
with pytest.raises(TypeError, match=msg):
arr.max(axis="foo")
def test_min_max(self, left_right_dtypes, index_or_series_or_array):
# GH#44746
left, right = left_right_dtypes
left = left.copy(deep=True)
right = right.copy(deep=True)
arr = IntervalArray.from_arrays(left, right)
# The expected results below are only valid if monotonic
assert left.is_monotonic_increasing
assert Index(arr).is_monotonic_increasing
MIN = arr[0]
MAX = arr[-1]
indexer = np.arange(len(arr))
np.random.default_rng(2).shuffle(indexer)
arr = arr.take(indexer)
arr_na = arr.insert(2, np.nan)
arr = index_or_series_or_array(arr)
arr_na = index_or_series_or_array(arr_na)
for skipna in [True, False]:
res = arr.min(skipna=skipna)
assert res == MIN
assert type(res) == type(MIN)
res = arr.max(skipna=skipna)
assert res == MAX
assert type(res) == type(MAX)
res = arr_na.min(skipna=False)
assert np.isnan(res)
res = arr_na.max(skipna=False)
assert np.isnan(res)
res = arr_na.min(skipna=True)
assert res == MIN
assert type(res) == type(MIN)
res = arr_na.max(skipna=True)
assert res == MAX
assert type(res) == type(MAX)

@ -0,0 +1,160 @@
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
def test_arrow_extension_type():
pa = pytest.importorskip("pyarrow")
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType
p1 = ArrowIntervalType(pa.int64(), "left")
p2 = ArrowIntervalType(pa.int64(), "left")
p3 = ArrowIntervalType(pa.int64(), "right")
assert p1.closed == "left"
assert p1 == p2
assert p1 != p3
assert hash(p1) == hash(p2)
assert hash(p1) != hash(p3)
def test_arrow_array():
pa = pytest.importorskip("pyarrow")
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType
intervals = pd.interval_range(1, 5, freq=1).array
result = pa.array(intervals)
assert isinstance(result.type, ArrowIntervalType)
assert result.type.closed == intervals.closed
assert result.type.subtype == pa.int64()
assert result.storage.field("left").equals(pa.array([1, 2, 3, 4], type="int64"))
assert result.storage.field("right").equals(pa.array([2, 3, 4, 5], type="int64"))
expected = pa.array([{"left": i, "right": i + 1} for i in range(1, 5)])
assert result.storage.equals(expected)
# convert to its storage type
result = pa.array(intervals, type=expected.type)
assert result.equals(expected)
# unsupported conversions
with pytest.raises(TypeError, match="Not supported to convert IntervalArray"):
pa.array(intervals, type="float64")
with pytest.raises(TypeError, match="Not supported to convert IntervalArray"):
pa.array(intervals, type=ArrowIntervalType(pa.float64(), "left"))
def test_arrow_array_missing():
pa = pytest.importorskip("pyarrow")
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType
arr = IntervalArray.from_breaks([0.0, 1.0, 2.0, 3.0])
arr[1] = None
result = pa.array(arr)
assert isinstance(result.type, ArrowIntervalType)
assert result.type.closed == arr.closed
assert result.type.subtype == pa.float64()
# fields have missing values (not NaN)
left = pa.array([0.0, None, 2.0], type="float64")
right = pa.array([1.0, None, 3.0], type="float64")
assert result.storage.field("left").equals(left)
assert result.storage.field("right").equals(right)
# structarray itself also has missing values on the array level
vals = [
{"left": 0.0, "right": 1.0},
{"left": None, "right": None},
{"left": 2.0, "right": 3.0},
]
expected = pa.StructArray.from_pandas(vals, mask=np.array([False, True, False]))
assert result.storage.equals(expected)
@pytest.mark.filterwarnings(
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
)
@pytest.mark.parametrize(
"breaks",
[[0.0, 1.0, 2.0, 3.0], pd.date_range("2017", periods=4, freq="D")],
ids=["float", "datetime64[ns]"],
)
def test_arrow_table_roundtrip(breaks):
pa = pytest.importorskip("pyarrow")
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType
arr = IntervalArray.from_breaks(breaks)
arr[1] = None
df = pd.DataFrame({"a": arr})
table = pa.table(df)
assert isinstance(table.field("a").type, ArrowIntervalType)
result = table.to_pandas()
assert isinstance(result["a"].dtype, pd.IntervalDtype)
tm.assert_frame_equal(result, df)
table2 = pa.concat_tables([table, table])
result = table2.to_pandas()
expected = pd.concat([df, df], ignore_index=True)
tm.assert_frame_equal(result, expected)
# GH#41040
table = pa.table(
[pa.chunked_array([], type=table.column(0).type)], schema=table.schema
)
result = table.to_pandas()
tm.assert_frame_equal(result, expected[0:0])
@pytest.mark.filterwarnings(
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
)
@pytest.mark.parametrize(
"breaks",
[[0.0, 1.0, 2.0, 3.0], pd.date_range("2017", periods=4, freq="D")],
ids=["float", "datetime64[ns]"],
)
def test_arrow_table_roundtrip_without_metadata(breaks):
pa = pytest.importorskip("pyarrow")
arr = IntervalArray.from_breaks(breaks)
arr[1] = None
df = pd.DataFrame({"a": arr})
table = pa.table(df)
# remove the metadata
table = table.replace_schema_metadata()
assert table.schema.metadata is None
result = table.to_pandas()
assert isinstance(result["a"].dtype, pd.IntervalDtype)
tm.assert_frame_equal(result, df)
def test_from_arrow_from_raw_struct_array():
# in case pyarrow lost the Interval extension type (eg on parquet roundtrip
# with datetime64[ns] subtype, see GH-45881), still allow conversion
# from arrow to IntervalArray
pa = pytest.importorskip("pyarrow")
arr = pa.array([{"left": 0, "right": 1}, {"left": 1, "right": 2}])
dtype = pd.IntervalDtype(np.dtype("int64"), closed="neither")
result = dtype.__from_arrow__(arr)
expected = IntervalArray.from_breaks(
np.array([0, 1, 2], dtype="int64"), closed="neither"
)
tm.assert_extension_array_equal(result, expected)
result = dtype.__from_arrow__(pa.chunked_array([arr]))
tm.assert_extension_array_equal(result, expected)

@ -0,0 +1,93 @@
"""Tests for Interval-Interval operations, such as overlaps, contains, etc."""
import numpy as np
import pytest
from pandas import (
Interval,
IntervalIndex,
Timedelta,
Timestamp,
)
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
@pytest.fixture(params=[IntervalArray, IntervalIndex])
def constructor(request):
"""
Fixture for testing both interval container classes.
"""
return request.param
@pytest.fixture(
params=[
(Timedelta("0 days"), Timedelta("1 day")),
(Timestamp("2018-01-01"), Timedelta("1 day")),
(0, 1),
],
ids=lambda x: type(x[0]).__name__,
)
def start_shift(request):
"""
Fixture for generating intervals of different types from a start value
and a shift value that can be added to start to generate an endpoint.
"""
return request.param
class TestOverlaps:
def test_overlaps_interval(self, constructor, start_shift, closed, other_closed):
start, shift = start_shift
interval = Interval(start, start + 3 * shift, other_closed)
# intervals: identical, nested, spanning, partial, adjacent, disjoint
tuples = [
(start, start + 3 * shift),
(start + shift, start + 2 * shift),
(start - shift, start + 4 * shift),
(start + 2 * shift, start + 4 * shift),
(start + 3 * shift, start + 4 * shift),
(start + 4 * shift, start + 5 * shift),
]
interval_container = constructor.from_tuples(tuples, closed)
adjacent = interval.closed_right and interval_container.closed_left
expected = np.array([True, True, True, True, adjacent, False])
result = interval_container.overlaps(interval)
tm.assert_numpy_array_equal(result, expected)
@pytest.mark.parametrize("other_constructor", [IntervalArray, IntervalIndex])
def test_overlaps_interval_container(self, constructor, other_constructor):
# TODO: modify this test when implemented
interval_container = constructor.from_breaks(range(5))
other_container = other_constructor.from_breaks(range(5))
with pytest.raises(NotImplementedError, match="^$"):
interval_container.overlaps(other_container)
def test_overlaps_na(self, constructor, start_shift):
"""NA values are marked as False"""
start, shift = start_shift
interval = Interval(start, start + shift)
tuples = [
(start, start + shift),
np.nan,
(start + 2 * shift, start + 3 * shift),
]
interval_container = constructor.from_tuples(tuples)
expected = np.array([True, False, False])
result = interval_container.overlaps(interval)
tm.assert_numpy_array_equal(result, expected)
@pytest.mark.parametrize(
"other",
[10, True, "foo", Timedelta("1 day"), Timestamp("2018-01-01")],
ids=lambda x: type(x).__name__,
)
def test_overlaps_invalid_type(self, constructor, other):
interval_container = constructor.from_breaks(range(5))
msg = f"`other` must be Interval-like, got {type(other).__name__}"
with pytest.raises(TypeError, match=msg):
interval_container.overlaps(other)