Top-Level Functions =================== .. cpp:namespace:: pandas These functions are available directly in the ``pandas`` namespace. .. code-block:: cpp #include using namespace pandas; auto df = read_csv("data.csv"); auto merged = merge(df1, df2, "key"); auto concatenated = concat({df1, df2}); I/O --- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void to_clipboard( bool excel = true, char sep = '\\t', bool index = true, bool header = true, const std::string& na_rep = "") const`` - void - pd_dataframe.h:33155 - :ref:`View ` * - ``DatetimeArray to_datetime( const std::vector& values, const std::string& format = "", bool dayfirst = false, bool yearfirst = false, bool utc = false, const std::string& errors = "raise", bool exact = true, bool infer_datetime_format = false, const std::string& origin = "unix", const std::string& unit = "ns", bool cache = true)`` - DatetimeArray - pd_dataframe.h:44668 - :ref:`View ` * - ``inline DatetimeArray to_datetime( const std::vector& values, const std::string& format, bool dayfirst, bool yearfirst, bool utc, const std::string& errors, bool exact, bool infer_datetime_format, const std::string& origin, const std::string& unit, bool cache)`` - DatetimeArray - pd_top_level.h:2292 - :ref:`View ` * - ``inline DatetimeArray to_datetime_from_columns( const std::vector& year, const std::vector& month, const std::vector& day, const std::vector& hour = {}, const std::vector& minute = {}, const std::vector& second = {})`` - DatetimeArray - pd_top_level.h:2585 - :ref:`View ` * - ``inline DatetimeArray to_datetime_mixed( const std::vector& values, bool utc = false)`` - DatetimeArray - pd_top_level.h:2517 - :ref:`View ` * - ``inline DatetimeArray to_datetime_numeric( const std::vector& values, const std::string& unit = "ns", int64_t origin_ns = 0)`` - DatetimeArray - pd_top_level.h:2450 - :ref:`View ` * - ``inline DatetimeArray to_datetime_numeric( const std::vector& values, const std::string& unit = "ns", int64_t origin_ns = 0)`` - DatetimeArray - pd_top_level.h:2480 - :ref:`View ` * - ``inline pandas::Timestamp to_datetime_scalar(double value, const std::string& unit = "ns", int64_t origin_ns = 0)`` - pandas::Timestamp - pd_top_level.h:2503 - :ref:`View ` * - ``inline pandas::Timestamp to_datetime_scalar(int64_t value, const std::string& unit = "ns", int64_t origin_ns = 0)`` - pandas::Timestamp - pd_top_level.h:2509 - :ref:`View ` * - ``std::map> to_dict( const std::string& orient = "list", bool index = true, [[maybe_unused]] const std::string& into = "dict") const`` - std::map> - pd_dataframe.h:28173 - :ref:`View ` * - ``std::map> to_dict_orient_dict( bool index = true) const`` - std::map> - pd_dataframe.h:28223 - :ref:`View ` * - ``std::map> to_dict_orient_index() const`` - std::map> - pd_dataframe.h:28309 - :ref:`View ` * - ``std::vector> to_dict_orient_records( bool index = false) const`` - std::vector> - pd_dataframe.h:28262 - :ref:`View ` * - ``std::map> to_dict_orient_series() const`` - std::map> - pd_dataframe.h:28463 - :ref:`View ` * - ``DictSplitResult to_dict_orient_split(bool index = true) const`` - DictSplitResult - pd_dataframe.h:28349 - :ref:`View ` * - ``DictTightResult to_dict_orient_tight(bool index = true) const`` - DictTightResult - pd_dataframe.h:28408 - :ref:`View ` * - ``void to_excel( const std::string& excel_writer, const std::string& sheet_name = "Sheet1", const std::string& na_rep = "", const std::string& float_format = "", const std::vector& columns = {}, bool header = true, bool index = true, const std::string& index_label = "", size_t startrow = 0, size_t startcol = 0, [[maybe_unused]] bool merge_cells = true, const std::string& inf_rep = "inf", std::optional> freeze_panes = std::nullopt, [[maybe_unused]] const std::string& engine = "openpyxl", [[maybe_unused]] const std::map& engine_kwargs = {}, [[maybe_unused]] const std::string& storage_options = "") const`` - void - pd_dataframe.h:30540 - :ref:`View ` * - ``void to_excel( ExcelWriter& writer, const std::string& sheet_name = "Sheet1", const std::string& na_rep = "", const std::string& float_format = "", const std::vector& columns = {}, bool header = true, bool index = true, const std::string& index_label = "", size_t startrow = 0, size_t startcol = 0) const`` - void - pd_dataframe.h:31058 - :ref:`View ` * - ``std::vector to_feather( const std::string& path = "", const std::string& compression = "uncompressed", [[maybe_unused]] int compression_level = -1, [[maybe_unused]] int64_t chunksize = -1, int version = 2) const`` - std::vector - pd_dataframe.h:39326 - :ref:`View ` * - ``void to_hdf( const std::string& path_or_buf, const std::string& key = "df", const std::string& mode = "a", [[maybe_unused]] std::optional complevel = std::nullopt, [[maybe_unused]] const std::string& complib = "zlib", [[maybe_unused]] bool append = false, const std::string& format = "fixed", bool index = true, [[maybe_unused]] const std::map& min_itemsize = {}, [[maybe_unused]] const std::string& nan_rep = "", [[maybe_unused]] bool dropna = false, [[maybe_unused]] const std::vector& data_columns = {}, [[maybe_unused]] const std::string& errors = "strict", [[maybe_unused]] const std::string& encoding = "UTF-8") const`` - void - pd_dataframe.h:29916 - :ref:`View ` * - ``std::string to_html( std::ostream\* buf = nullptr, const std::vector& columns = {}, const std::vector& col_space = {}, bool header = true, bool index = true, const std::string& na_rep = "NaN", const std::string& float_format = "", [[maybe_unused]] bool sparsify = true, bool index_names = true, const std::string& justify = "", size_t max_rows = 0, size_t max_cols = 0, bool show_dimensions = false, char decimal = '.', bool bold_rows = true, const std::string& classes = "", bool escape = true, bool notebook = false, int border = -1, const std::string& table_id = "", bool render_links = false, [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::vector& formatters = {}) const`` - std::string - pd_dataframe.h:31162 - :ref:`View ` * - ``std::string to_latex( std::ostream\* buf = nullptr, const std::vector& columns = {}, bool header = true, bool index = true, const std::string& na_rep = "NaN", const std::string& float_format = "", [[maybe_unused]] bool sparsify = true, bool index_names = true, bool bold_rows = false, const std::string& column_format = "", bool longtable = false, bool escape = true, char decimal = '.', [[maybe_unused]] bool multicolumn = true, [[maybe_unused]] const std::string& multicolumn_format = "r", [[maybe_unused]] bool multirow = true, const std::string& caption = "", const std::string& caption_short = "", const std::string& label = "", const std::string& position = "", [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::vector& formatters = {}) const`` - std::string - pd_dataframe.h:31544 - :ref:`View ` * - ``std::string to_markdown( std::ostream\* buf = nullptr, [[maybe_unused]] const std::string& mode = "wt", bool index = true, const std::string& tablefmt = "pipe", const std::vector& colalign = {}, std::optional showindex = std::nullopt, const std::string& na_rep = "", const std::string& float_format = "", [[maybe_unused]] const std::string& storage_options = "") const`` - std::string - pd_dataframe.h:33363 - :ref:`View ` * - ``inline Series to_numeric(const NDFrameBase& arg, const std::string& errors = "raise")`` - Series - pd_top_level.h:2738 - :ref:`View ` * - ``inline Series to_numeric(const Series& arg, const std::string& errors = "raise")`` - Series - pd_top_level.h:2781 - :ref:`View ` * - ``std::vector to_orc( const std::string& path = "", const std::string& engine = "pyarrow", std::optional index = std::nullopt, [[maybe_unused]] const std::map& engine_kwargs = {}) const`` - std::vector - pd_dataframe.h:28514 - :ref:`View ` * - ``std::vector to_parquet( const std::string& path = "", const std::string& engine = "pyarrow", [[maybe_unused]] const std::string& compression = "snappy", std::optional index = std::nullopt, const std::vector& partition_cols = {}, [[maybe_unused]] const std::string& storage_options = "") const`` - std::vector - pd_dataframe.h:29077 - :ref:`View ` * - ``std::vector to_pickle( const std::string& path = "", [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] int protocol = 5, [[maybe_unused]] const std::string& storage_options = "") const`` - std::vector - pd_dataframe.h:29723 - :ref:`View ` * - ``inline std::vector to_pickle( const DataFrame& obj, const std::string& filepath_or_buffer = "", const std::string& compression = "infer", int protocol = 5, const std::string& storage_options = "")`` - std::vector - pd_dataframe.h:43178 - :ref:`View ` * - ``inline std::vector to_postfix(const std::vector& tokens)`` - std::vector - pd_dataframe.h:577 - * - ``numpy::RecordArray to_records( bool index = true, const std::map& column_dtypes = {}, const std::map& index_dtypes = {}) const`` - numpy::RecordArray - pd_dataframe.h:31910 - :ref:`View ` * - ``std::vector> to_records_dict() const`` - std::vector> - pd_dataframe.h:39259 - :ref:`View ` * - ``std::optional to_sql( const std::string& name, const std::string& con_path, const std::string& schema = "", const std::string& if_exists = "fail", bool index = true, const std::string& index_label = "", std::optional chunksize = std::nullopt, const std::map& dtype = {}, const std::string& method = "") const`` - std::optional - pd_dataframe.h:30146 - :ref:`View ` * - ``std::optional to_sql_con( const std::string& name, const std::string& con, const std::string& schema = "", const std::string& if_exists = "fail", bool index = true, const std::string& index_label = "", std::optional chunksize = std::nullopt, const std::map& dtype = {}, const std::string& method = "") const`` - std::optional - pd_dataframe.h:30464 - :ref:`View ` * - ``std::vector to_stata( const std::string& path = "", const std::map& convert_dates = {}, bool write_index = true, const std::string& byteorder = "", const std::string& time_stamp = "", const std::string& data_label = "", const std::map& variable_labels = {}, int version = 114, const std::vector& convert_strl = {}, [[maybe_unused]] const std::string& compression = "infer", const std::map>& value_labels = {}, [[maybe_unused]] const std::string& storage_options = "") const`` - std::vector - pd_dataframe.h:32183 - :ref:`View ` * - ``std::string to_string( std::ostream\* buf, const std::vector& columns = {}, size_t col_space = 0, bool header = true, bool index = true, const std::string& na_rep = "NaN", [[maybe_unused]] const std::string& float_format = "", [[maybe_unused]] bool sparsify = true, [[maybe_unused]] bool index_names = true, [[maybe_unused]] const std::string& justify = "", size_t max_rows = 10, size_t max_cols = 10, bool show_dimensions = true, [[maybe_unused]] char decimal = '.', [[maybe_unused]] size_t line_width = 0, size_t min_rows = 0, [[maybe_unused]] size_t max_colwidth = 0, [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::vector& formatters = {}) const`` - std::string - pd_dataframe.h:40588 - :ref:`View ` * - ``std::string to_string() const override`` - std::string - pd_dataframe.h:41010 - :ref:`View ` * - ``to_string(oss, sparse_index, sparse_columns)`` - - pd_styler.h:2048 - :ref:`View ` * - ``std::string to_string_multiindex() const`` - std::string - pd_dataframe.h:42071 - * - ``std::string to_string_multiindex_with_levels() const`` - std::string - pd_dataframe.h:41786 - * - ``std::string to_string_multilevel_columns() const`` - std::string - pd_dataframe.h:41505 - * - ``std::vector to_string_vector() const override`` - std::vector - pd_dataframe.h:40555 - :ref:`View ` * - ``inline TimedeltaArray to_timedelta( const std::vector& values, const std::string& unit = "ns", const std::string& errors = "raise")`` - TimedeltaArray - pd_top_level.h:2621 - :ref:`View ` * - ``TimedeltaArray to_timedelta( const std::vector& values, const std::string& unit = "ns")`` - TimedeltaArray - pd_top_level.h:2692 - :ref:`View ` * - ``Dataset to_xarray() const`` - Dataset - pd_dataframe.h:40375 - :ref:`View ` Combining --------- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``inline AlignedResult align_empty_series_to_index(size_t target_size)`` - AlignedResult - pd_dataframe_construct.h:949 - :ref:`View ` * - ``AlignmentResult align_series_to_dataframe( const Series& value, const IndexBase& df_index, bool preserve_dtype)`` - AlignmentResult - pd_dataframe_setitem.h:117 - :ref:`View ` * - ``inline AlignedResult align_series_to_index( const pandas::Series& series, const std::vector& target_index)`` - AlignedResult - pd_dataframe_construct.h:917 - :ref:`View ` * - ``inline Series aligned_string_concat( const Series& s, const Series& o)`` - Series - pd_series.h:16930 - * - ``inline DataFrame concat( const std::vector& objs, int axis = 0, const std::string& join = "outer", bool ignore_index = false, const std::vector& keys = {}, const std::vector>& levels = {}, const std::vector& names = {}, bool verify_integrity = false, bool sort = false, bool copy = true)`` - DataFrame - pd_dataframe.h:42991 - :ref:`View ` * - ``inline DataFrame concat(const std::vector& frames, bool ignore_index)`` - DataFrame - pd_dataframe.h:43008 - :ref:`View ` * - ``inline bool concat_bool_partner_kind(const std::vector& canon_dtypes)`` - bool - pd_concat_series.h:46 - :ref:`View ` * - ``inline bool concat_bool_partner_kind(const std::vector& canon_dtypes)`` - bool - pd_promote.h:1010 - :ref:`View ` * - ``PANDASCORE_API Result concat_dispatch( const std::vector& inputs, int axis = 0, bool ignore_index = false, bool sort = false, const std::optional>& keys = std::nullopt )`` - PANDASCORE_API Result - pd_concat.h:37 - :ref:`View ` * - ``inline pandas::Result concat_dispatch_series_mixed( const std::vector>& inputs, const std::vector& dtype_names_full, bool ignore_index = false)`` - pandas::Result - pd_concat_series.h:66 - :ref:`View ` * - ``inline std::string join_must_be_inner_or_outer_got(const std::string& join)`` - std::string - pd_exceptions.h:217 - :ref:`View ` * - ``inline DataFrame merge( const DataFrame& left, const DataFrame& right, OnT on_column, HowT how, const std::pair& suffixes = {"_x", "_y"})`` - DataFrame - pd_dataframe.h:43128 - :ref:`View ` * - ``inline DataFrame merge( const DataFrame& left, const DataFrame& right, const std::string& how = "inner", const std::vector& on = {}, const std::vector& left_on = {}, const std::vector& right_on = {}, bool left_index = false, bool right_index = false, bool sort = false, const std::pair& suffixes = {"_x", "_y"}, bool copy = true, const std::string& indicator = "", const std::string& validate = "")`` - DataFrame - pd_dataframe.h:43137 - :ref:`View ` * - ``inline DataFrame merge_asof( const DataFrame& left, const DataFrame& right, const std::string& on = "", const std::string& by = "", const std::string& left_on = "", const std::string& right_on = "", const std::pair& suffixes = {"_x", "_y"}, const std::string& direction = "backward", std::optional tolerance = std::nullopt, bool allow_exact_matches = true, const std::optional& left_by = std::nullopt, bool left_index = false, const std::optional& right_by = std::nullopt, bool right_index = false)`` - DataFrame - pd_top_level.h:1930 - :ref:`View ` * - ``inline DataFrame merge_ordered( const DataFrame& left, const DataFrame& right, const std::string& on, const std::string& fill_method = "", const std::pair& suffixes = {"_x", "_y"}, const std::string& how = "outer", const std::optional& left_by = std::nullopt, const std::optional& left_on = std::nullopt, const std::optional& right_by = std::nullopt, const std::optional& right_on = std::nullopt)`` - DataFrame - pd_top_level.h:2065 - :ref:`View ` Reshaping --------- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``inline DataFrame melt( const DataFrame& frame, std::initializer_list id_vars, std::initializer_list value_vars, const std::string& var_name = "variable", const std::string& value_name = "value", std::optional col_level = std::nullopt, bool ignore_index = true)`` - DataFrame - pd_dataframe.h:43048 - :ref:`View ` * - ``inline DataFrame melt( const DataFrame& frame, const std::vector& id_vars = {}, const std::vector& value_vars = {}, const std::string& var_name = "variable", const std::string& value_name = "value", std::optional col_level = std::nullopt, bool ignore_index = true)`` - DataFrame - pd_dataframe.h:43061 - :ref:`View ` * - ``inline DataFrame melt( const DataFrame& frame, const std::string& var_name, const std::string& value_name)`` - DataFrame - pd_dataframe.h:43073 - :ref:`View ` * - ``inline DataFrame pivot_table_with_grouper( const DataFrame& df, const std::vector& values, const std::vector>& index_groupers, const std::vector>& column_groupers, const std::string& aggfunc = "mean", double fill_value = std::numeric_limits::quiet_NaN())`` - DataFrame - pd_groupby.h:3840 - :ref:`View ` Statistics ---------- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``std::vector> counts(nrows, std::vector(ncols, 0))`` - std::vector> - pd_top_level.h:414 - :ref:`View ` * - ``inline std::string describe_option(const std::string& pattern = "")`` - std::string - pd_top_level.h:326 - :ref:`View ` * - ``std::vector> maxs(nrows, std::vector(ncols, -std::numeric_limits::infinity()))`` - std::vector> - pd_top_level.h:416 - * - ``std::vector> mins(nrows, std::vector(ncols, std::numeric_limits::infinity()))`` - std::vector> - pd_top_level.h:415 - Conversion ---------- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``copy_to_clipboard_impl(text)`` - - pd_dataframe.h:33203 - * - ``static void copy_to_clipboard_impl(const std::string& text)`` - static void - pd_dataframe.h:33212 - Other ----- .. list-table:: :widths: 45 25 15 15 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``DataFrameGroupByColumn(const DataFrameGroupBy& parent, const std::string& col)`` - class DataFrameGroupByColumn { public: - pd_groupby.h:696 - * - ``throw DuplicateLabelError(pandas::format_duplicate_label_error(idx))`` - throw - pd_index.h:3515 - :ref:`View ` * - ``GlobalFree(hMem)`` - - pd_dataframe.h:33236 - * - ``GlobalFree(hMem)`` - - pd_dataframe.h:33246 - * - ``GlobalUnlock(hMem)`` - - pd_dataframe.h:33242 - :ref:`View ` * - ``throw IncompatibleDataArgError( "make_series_from_data_arg: unsupported DataArg::kind=" + std::to_string(static_cast(data.kind)))`` - throw - pd_series_apply_dispatch.h:815 - :ref:`View ` * - ``throw IncompatibleFuncArgError( "Series::apply_dispatch: StringName arm is not " "supported for string-typed source (no numeric agg path).")`` - throw - pd_series_apply_dispatch.h:55 - :ref:`View ` * - ``throw IncompatibleFuncArgError( "Series::apply_dispatch: unsupported StringName '" + name + "'")`` - throw - pd_series_apply_dispatch.h:107 - :ref:`View ` * - ``IndexDtype() = default`` - class IndexDtype : public ExtensionDtype { public: using scalar_type = T; - pd_index_dtype.h:32 - * - ``Series(std::initializer_list, std::initializer_list) -> Series`` - - pd_series.h:16351 - :ref:`View ` * - ``std::string acc(non_bool[0])`` - std::string - pd_promote.h:646 - * - ``inline std::string adjoin( int space, const std::vector>& columns, std::string_view justify_mode = "left")`` - std::string - pd_display_formats.h:38 - :ref:`View ` * - ``inline void advance_month(int& year, int& month, int n)`` - void - pd_groupby.h:3416 - * - ``advance_month(ny, nm, 1)`` - - pd_groupby.h:3598 - * - ``inline void advance_months(int& year, int& month, int months_to_add)`` - inline void - pd_dateoffset.h:56 - * - ``inline bool all_whole_numbers(const std::vector& data)`` - bool - pd_value_classify.h:83 - :ref:`View ` * - ``DatetimeArray arr(values)`` - DatetimeArray - pd_datetime_index.h:4380 - :ref:`View ` * - ``DatetimeArray arr(results)`` - DatetimeArray - pd_datetime_index.h:4573 - :ref:`View ` * - ``DatetimeArray arr(business_days)`` - DatetimeArray - pd_datetime_index.h:4597 - :ref:`View ` * - ``DatetimeArray arr(business_days)`` - DatetimeArray - pd_datetime_index.h:4626 - :ref:`View ` * - ``DatetimeArray arr(business_days)`` - DatetimeArray - pd_datetime_index.h:4645 - :ref:`View ` * - ``TimedeltaArray arr(values)`` - TimedeltaArray - pd_timedelta_index.h:3388 - :ref:`View ` * - ``inline BooleanArray array(const numpy::NDArray& data, const std::string& dtype = "", bool copy = false)`` - BooleanArray - pd_boolean_array.h:1012 - :ref:`View ` * - ``inline BooleanArray array(const numpy::NDArray& data, const numpy::NDArray& mask, const std::string& dtype = "", bool copy = false)`` - BooleanArray - pd_boolean_array.h:1029 - :ref:`View ` * - ``inline DatetimeArray array(const numpy::NDArray& data, std::shared_ptr tz = nullptr)`` - DatetimeArray - pd_datetime_array.h:1547 - :ref:`View ` * - ``FloatingArray array(const numpy::NDArray& data, typename std::enable_if>::type\* = nullptr)`` - FloatingArray - pd_floating_array.h:1113 - :ref:`View ` * - ``FloatingArray array(const numpy::NDArray& data, const numpy::NDArray& mask, typename std::enable_if>::type\* = nullptr)`` - FloatingArray - pd_floating_array.h:1122 - :ref:`View ` * - ``IntegerArray array(const numpy::NDArray& data)`` - IntegerArray - pd_integer_array.h:990 - :ref:`View ` * - ``IntegerArray array(const numpy::NDArray& data, const numpy::NDArray& mask)`` - IntegerArray - pd_integer_array.h:998 - :ref:`View ` * - ``inline StringArray array(const numpy::NDArray& data)`` - StringArray - pd_string_array.h:1194 - :ref:`View ` * - ``inline StringArray array(const numpy::NDArray& data, const numpy::NDArray& mask)`` - StringArray - pd_string_array.h:1201 - :ref:`View ` * - ``inline TimedeltaArray array(const numpy::NDArray& data)`` - TimedeltaArray - pd_timedelta_array.h:1581 - :ref:`View ` * - ``std::vector> arrays(nlevels)`` - std::vector> - pd_groupby.h:1039 - :ref:`View ` * - ``std::vector> arrays(nlevels)`` - std::vector> - pd_groupby.h:2841 - :ref:`View ` * - ``std::vector> arrays(n_lvl)`` - std::vector> - pd_rename_spec_impl.h:169 - :ref:`View ` * - ``as_row(v, cols, vals)`` - - pd_apply_visitor.h:96 - * - ``inline std::string axis_must_be_0_or_1_got(long long got)`` - std::string - pd_exceptions.h:169 - :ref:`View ` * - ``inline DatetimeIndex bdate_range( const std::optional& start = std::nullopt, const std::optional& end = std::nullopt, std::optional periods = std::nullopt, const std::string& freq = "B", const std::optional& tz = std::nullopt, bool normalize = true, const std::optional& name = std::nullopt, const std::string& weekmask = "Mon Tue Wed Thu Fri", const std::vector& holidays = {}, const std::string& inclusive = "both")`` - DatetimeIndex - pd_datetime_index.h:4437 - :ref:`View ` * - ``inline std::vector bin_datetime_column_by_freq( const DataFrame& df, const std::string& col_name, const std::string& freq)`` - std::vector - pd_groupby.h:3760 - * - ``inline std::vector bin_datetime_strings_by_freq( const std::vector& date_strings, const std::string& freq)`` - std::vector - pd_groupby.h:3539 - * - ``DataFrame binary_op(const DataFrame& other, BinaryOp op) const`` - DataFrame - pd_dataframe.h:42367 - * - ``DataFrame binary_op_fill(const DataFrame& other, double fill_value, BinaryOp op) const`` - DataFrame - pd_dataframe.h:42633 - * - ``static const char\* build_date()`` - static const char\* - pd_config.h:10 - * - ``inline pandas::MultiIndex build_multiindex_from_string_arrays( const std::vector>& arrays, const std::vector>& names = {})`` - pandas::MultiIndex - pd_dataframe_construct.h:403 - :ref:`View ` * - ``inline std::string c26l_cell_label(const pandas::MapCellInput& in)`` - std::string - pd_series_apply_dispatch.h:1282 - * - ``inline std::optional c26l_cell_to_key(const pandas::MapCellInput& in)`` - std::optional - pd_series_apply_dispatch.h:1304 - * - ``inline void c26l_observe_na( pandas::ApplyResultInference::ScalarKindHistogram& hist)`` - void - pd_series_apply_dispatch.h:1239 - * - ``inline void c26l_observe_value( pandas::ApplyResultInference::ScalarKindHistogram& hist, const V& v)`` - void - pd_series_apply_dispatch.h:1211 - * - ``inline pandas::ApplyCellResult c26l_value_to_cell(const Value& v)`` - pandas::ApplyCellResult - pd_series_apply_dispatch.h:1249 - * - ``inline std::string cannot_astype_convert(const std::string& from_dt, const std::string& to_dt)`` - std::string - pd_exceptions.h:372 - :ref:`View ` * - ``inline std::string cannot_cast(const std::string& from_dt, const std::string& to_dt)`` - std::string - pd_exceptions.h:349 - :ref:`View ` * - ``inline std::string cannot_coerce_index(const std::string& from_index_kind, const std::string& to_value_type)`` - std::string - pd_exceptions.h:306 - :ref:`View ` * - ``inline std::string cannot_compare_types(const std::string& lhs, const std::string& rhs)`` - std::string - pd_exceptions.h:338 - :ref:`View ` * - ``inline std::string cannot_convert_index_to_dtype(const std::string& index_kind, const std::string& dt)`` - std::string - pd_exceptions.h:375 - :ref:`View ` * - ``inline std::string cannot_convert_value_in_column( const std::string& value, const std::string& target_dtype /\*int64\|float64\|bool\*/, const std::string& col_name, std::size_t row_idx, const std::string& reason)`` - std::string - pd_exceptions.h:382 - :ref:`View ` * - ``inline std::string canonical_dtype_name()`` - std::string - pd_dataframe_setitem.h:64 - :ref:`View ` * - ``inline int canonicalise_axis(const std::string& s)`` - int - pd_where.h:82 - :ref:`View ` * - ``inline int canonicalise_axis(int i)`` - int - pd_where.h:92 - :ref:`View ` * - ``inline std::string canonicalize_dtype_for_promote(std::string_view dt)`` - std::string - pd_promote.h:532 - :ref:`View ` * - ``inline std::string categorical_categories_dtype_from_np_dtype(std::string_view np_dt)`` - std::string - pd_categorical_array.h:2276 - :ref:`View ` * - ``std::vector> cats(nlevels)`` - std::vector> - pd_dataframe_construct.h:469 - * - ``inline char cell_to_dtype_kind(const ApplyCellResult& r)`` - char - pd_apply_result.h:153 - :ref:`View ` * - ``std::ifstream check_file(path_or_buf)`` - std::ifstream - pd_dataframe.h:29960 - * - ``std::ifstream check_file(con_path)`` - std::ifstream - pd_dataframe.h:30178 - * - ``std::regex check_re(normalized)`` - std::regex - pd_dataframe.h:44586 - * - ``inline void civil_from_days(std::int64_t z, int& y, unsigned& m, unsigned& d)`` - void - pd_period_formatter.h:44 - * - ``civil_from_days(ord, y, m, d)`` - - pd_period_formatter.h:90 - * - ``inline DTypeInfo classify_dtype(const std::string& dt)`` - DTypeInfo - pd_dtype_classify.h:56 - :ref:`View ` * - ``inline ValueClassification classify_value_dtype(const std::string& dt_full)`` - ValueClassification - pd_value_classify.h:25 - :ref:`View ` * - ``void clear_cache() const override`` - void - pd_dataframe.h:42338 - :ref:`View ` * - ``std::vector> col_data(col_values.size(), std::vector(row_keys.size(), default_fill))`` - std::vector> - pd_dataframe.h:43921 - :ref:`View ` * - ``std::vector> col_data(n_cols)`` - std::vector> - pd_top_level.h:3081 - :ref:`View ` * - ``std::vector> col_mask( col_values.size(), std::vector(row_keys.size(), numpy::bool_(combo_miss_mask_bit)))`` - std::vector> - pd_dataframe.h:43929 - * - ``std::vector> col_val_strs(ncols())`` - std::vector> - pd_dataframe.h:41118 - * - ``std::vector> col_val_strs(ncols())`` - std::vector> - pd_dataframe.h:41564 - * - ``std::vector> col_val_strs(ncols())`` - std::vector> - pd_dataframe.h:41846 - * - ``std::vector> col_val_strs(ncols())`` - std::vector> - pd_dataframe.h:42123 - * - ``inline CollectIndexUnionResult collect_index_union(const std::vector& infos)`` - CollectIndexUnionResult - pd_dataframe_construct.h:880 - :ref:`View ` * - ``std::istringstream cols_stream(cols_def)`` - std::istringstream - pd_dataframe.h:38591 - * - ``std::vector> columns(col_names.size())`` - std::vector> - pd_dataframe.h:35025 - :ref:`View ` * - ``std::vector> columns(col_indices.size())`` - std::vector> - pd_dataframe.h:37355 - :ref:`View ` * - ``std::vector> columns_data(col_names.size())`` - std::vector> - pd_dataframe.h:38683 - * - ``std::vector> columns_data(group_names.size())`` - std::vector> - pd_dataframe.h:44596 - * - ``std::regex compact_day_re(R"(^(\\d{4})(\\d{2})(\\d{2})$)")`` - std::regex - pd_period_ordinal_utils.h:534 - * - ``inline std::string compose_override(std::string_view src_full, std::string_view op, std::string_view result_dtype)`` - std::string - pd_dtype_override.h:241 - :ref:`View ` * - ``static size_t compute_column_width_mi_col( size_t header_len, size_t max_data_len, size_t max_positive_len, bool has_negative, bool is_numeric, bool is_bool, bool is_datetime, bool is_timedelta, bool all_nan)`` - static size_t - pd_dataframe.h:40975 - * - ``static size_t compute_column_width_plain( size_t header_len, size_t max_data_len, size_t max_positive_len, bool has_negative, bool is_numeric, bool is_bool, bool is_datetime, bool is_timedelta, bool all_nan, bool is_sparse)`` - static size_t - pd_dataframe.h:40923 - * - ``inline std::vector compute_holidays(const std::vector& rules, DateYMD start, DateYMD end)`` - std::vector - pd_holiday.h:204 - * - ``inline TimedeltaComponents compute_timedelta_components(const TimedeltaArray& arr)`` - TimedeltaComponents - pd_timedelta_array.h:138 - * - ``inline TimedeltaComponents compute_timedelta_components(const TimedeltaArray& arr)`` - TimedeltaComponents - pd_timedelta_array.h:1592 - * - ``inline int64_t compute_weekly_origin(int64_t first_midnight_ns, int freq_mult, bool closed_right)`` - int64_t - pd_resampler.h:49 - * - ``inline std::vector convert_ns_strings_to_dates(const std::vector& vals)`` - std::vector - pd_groupby.h:3256 - * - ``inline std::string cum_widen_dtype_from_name(const std::string& src)`` - std::string - pd_series.h:125 - * - ``inline std::string cumaxis1_widen_dtype( const std::vector& src_dtypes, bool empty_frame )`` - std::string - pd_dataframe.h:107 - * - ``numpy::datetime64 current(start)`` - numpy::datetime64 - pd_datetime_index.h:4665 - :ref:`View ` * - ``inline DisplayConfig current_display_config()`` - DisplayConfig - pd_display_config.h:37 - * - ``CutResult cut( const std::vector& x, const std::variant>& bins, bool right = true, const std::vector& labels = {}, bool include_lowest = false, const std::string& duplicates = "raise", bool ordered = true, int precision = 3, bool retbins = false)`` - CutResult - pd_top_level.h:718 - :ref:`View ` * - ``inline std::string dataframe_block_common_type( const std::vector& src_dtypes, bool any_na_introduction)`` - std::string - pd_promote.h:595 - * - ``inline DatetimeIndex date_range( const std::optional& start = std::nullopt, const std::optional& end = std::nullopt, std::optional periods = std::nullopt, const std::string& freq = "D", const std::optional& tz = std::nullopt, bool normalize = false, const std::optional& name = std::nullopt, const std::string& inclusive = "both", const std::string& unit = "ns", const std::string& tz_display = "")`` - DatetimeIndex - pd_datetime_index.h:3801 - :ref:`View ` * - ``inline DatetimeIndex date_range(const std::string& start, int periods, const std::string& freq = "D")`` - DatetimeIndex - pd_datetime_index.h:4412 - :ref:`View ` * - ``inline DatetimeIndex date_range_with_offset( const DateOffset& offset, const std::string& start, const std::optional& end = std::nullopt, std::optional periods = std::nullopt, const std::optional& name = std::nullopt)`` - DatetimeIndex - pd_datetime_index.h:4658 - :ref:`View ` * - ``inline int64_t date_to_days_since_epoch(int year, int month, int day)`` - int64_t - pd_period_ordinal_utils.h:69 - * - ``inline int64_t date_to_ordinal(int year, int month, int day, int hour, int minute, int second, PeriodFrequency freq)`` - int64_t - pd_period_ordinal_utils.h:481 - * - ``inline int64_t datetime64_to_ns(const numpy::datetime64& dt)`` - int64_t - pd_dataframe_construct.h:57 - :ref:`View ` * - ``inline std::vector> datetime_index_to_ns_values(const DatetimeIndexT& dti)`` - std::vector> - pd_dataframe_construct.h:75 - * - ``std::regex datetime_nosec_re(R"(^(\\d{4})-(\\d{1,2})-(\\d{1,2})[T ](\\d{1,2}):(\\d{1,2})$)")`` - std::regex - pd_period_ordinal_utils.h:538 - * - ``std::regex datetime_re(R"(^(\\d{4})-(\\d{1,2})-(\\d{1,2})[T ](\\d{1,2}):(\\d{1,2}):(\\d{1,2}).\*$)")`` - std::regex - pd_period_ordinal_utils.h:536 - * - ``inline int64_t datetime_to_period_ordinal(int64_t ns, const std::string& freq)`` - int64_t - pd_period_ordinal_utils.h:166 - * - ``inline int64_t datetime_unit_to_ns_multiplier(const std::string& u)`` - int64_t - pd_top_level.h:2407 - :ref:`View ` * - ``inline int day_of_week(int y, int m, int d)`` - int - pd_holiday.h:47 - :ref:`View ` * - ``inline int day_of_week_monday0(int64_t day_ord)`` - int - pd_groupby.h:3290 - * - ``inline int64_t day_of_week_sunday0(int64_t midnight_ns)`` - int64_t - pd_resampler.h:39 - * - ``inline void day_ord_to_ymd(int64_t z, int& y, int& m, int& d)`` - void - pd_groupby.h:3276 - * - ``day_ord_to_ymd(day_ord, y, m, d)`` - - pd_groupby.h:3338 - * - ``day_ord_to_ymd(label_ord, y, m, d)`` - - pd_groupby.h:3721 - * - ``day_ord_to_ymd(day_ord, y, m, d)`` - - pd_groupby.h:3738 - * - ``std::regex day_re(R"(^(\\d{4})-(\\d{1,2})-(\\d{1,2})$)")`` - std::regex - pd_period_ordinal_utils.h:532 - * - ``inline std::int64_t days_from_civil(int y, unsigned m, unsigned d)`` - std::int64_t - pd_period_formatter.h:57 - * - ``inline int days_in_month(int year, int month)`` - inline int - pd_dateoffset.h:30 - :ref:`View ` * - ``inline int days_in_month(int y, int m)`` - int - pd_holiday.h:37 - :ref:`View ` * - ``inline int days_in_month_helper(int year, int month)`` - int - pd_period_ordinal_utils.h:58 - * - ``inline void days_since_epoch_to_date(int64_t days, int& year, int& month, int& day)`` - void - pd_period_ordinal_utils.h:87 - * - ``days_since_epoch_to_date(days, year, month, day)`` - - pd_period_ordinal_utils.h:183 - * - ``days_since_epoch_to_date(days, year, month, day)`` - - pd_period_ordinal_utils.h:215 - * - ``days_since_epoch_to_date(days, year, month, day)`` - - pd_period_ordinal_utils.h:248 - * - ``days_since_epoch_to_date(days, year, month, day)`` - - pd_period_ordinal_utils.h:283 - * - ``inline std::string detail_float_to_python_str(double v)`` - std::string - pd_categorical_array.h:2297 - * - ``inline void detect_int_columns(std::vector& columns)`` - void - pd_dataframe_construct.h:266 - :ref:`View ` * - ``inline TupleKeyInfo detect_tuple_key_levels( const std::vector>& key_components)`` - TupleKeyInfo - pd_dataframe_construct.h:322 - :ref:`View ` * - ``inline std::pair detect_tz_uniformity(const std::vector& tz_strings)`` - std::pair - pd_value_classify.h:72 - :ref:`View ` * - ``numpy::datetime64 dt(sv)`` - numpy::datetime64 - pd_dataframe.h:35373 - :ref:`View ` * - ``numpy::datetime64 dt(lbl)`` - numpy::datetime64 - pd_dataframe.h:35402 - :ref:`View ` * - ``inline int dt64_fractional_digits(Datetime64Resolution r)`` - int - pd_datetime64_formatter.h:50 - * - ``inline void dt64_split(std::int64_t ticks, Datetime64Resolution r, std::int64_t& epoch_s, std::int64_t& sub)`` - void - pd_datetime64_formatter.h:76 - * - ``inline std::int64_t dt64_ticks_per_second(Datetime64Resolution r)`` - std::int64_t - pd_datetime64_formatter.h:39 - * - ``DatetimeIndex dt_idx(std::move(dt_arr), period_idx->name())`` - DatetimeIndex - pd_resampler.h:1741 - :ref:`View ` * - ``DatetimeIndex dt_idx(std::move(dt_arr), period_idx->name())`` - DatetimeIndex - pd_resampler.h:3892 - :ref:`View ` * - ``inline std::string dtype_category_to_canonical_string(DTypeCategory cat, const DTypeInfo& info)`` - std::string - pd_dtype_classify.h:154 - :ref:`View ` * - ``emit_mi_row(r, r, r == 0)`` - - pd_dataframe.h:42034 - * - ``emit_mi_row(nrows() - tail_n_mil + r, head_n_mil + r, false)`` - - pd_dataframe.h:42057 - * - ``emit_mi_row_simple(r, r, r == 0)`` - - pd_dataframe.h:42288 - * - ``emit_mi_row_simple(nrows() - tail_n_mi + r, head_n_mi + r, false)`` - - pd_dataframe.h:42309 - * - ``emit_param_row(r)`` - - pd_dataframe.h:40887 - * - ``emit_param_row(nrows() - p_tail_n + r)`` - - pd_dataframe.h:40904 - * - ``inline std::string ensure_dtype_can_hold_na(std::string_view src)`` - std::string - pd_promote.h:63 - :ref:`View ` * - ``inline std::string epoch_ms_to_iso(int64_t ms)`` - std::string - json.h:258 - * - ``escape_html(url) + ""`` - - pd_dataframe.h:31286 - * - ``oss << escape_latex(index_->name().value())`` - oss << - pd_dataframe.h:31753 - * - ``oss << escape_latex(col_name)`` - oss << - pd_dataframe.h:31765 - * - ``oss << escape_latex(index_->name().value())`` - oss << - pd_dataframe.h:31783 - * - ``oss << escape_latex(col_name)`` - oss << - pd_dataframe.h:31793 - * - ``oss << escape_latex(idx_val)`` - oss << - pd_dataframe.h:31817 - * - ``inline std::string extract_date_if_midnight(const std::string& s)`` - std::string - pd_datetime_utils.h:73 - :ref:`View ` * - ``inline std::vector extract_epoch_seconds(const DatetimeIndex& dti)`` - std::vector - pd_rolling.h:583 - :ref:`View ` * - ``std::ofstream file(path, std::ios::binary)`` - std::ofstream - pd_dataframe.h:29015 - :ref:`View ` * - ``std::ofstream file(path, std::ios::binary)`` - std::ofstream - pd_dataframe.h:29659 - :ref:`View ` * - ``std::ofstream file(path, std::ios::binary)`` - std::ofstream - pd_dataframe.h:29839 - :ref:`View ` * - ``std::ofstream file(excel_writer, std::ios::binary)`` - std::ofstream - pd_dataframe.h:31023 - :ref:`View ` * - ``std::ofstream file(path, std::ios::binary)`` - std::ofstream - pd_dataframe.h:33085 - :ref:`View ` * - ``std::ifstream file(filepath_or_buffer)`` - std::ifstream - pd_dataframe.h:34680 - :ref:`View ` * - ``std::ifstream file(path_or_buf)`` - std::ifstream - pd_dataframe.h:35826 - :ref:`View ` * - ``std::ifstream file(io, std::ios::binary \| std::ios::ate)`` - std::ifstream - pd_dataframe.h:36852 - :ref:`View ` * - ``std::ifstream file(path, std::ios::binary \| std::ios::ate)`` - std::ifstream - pd_dataframe.h:37827 - :ref:`View ` * - ``std::ifstream file(con)`` - std::ifstream - pd_dataframe.h:38567 - :ref:`View ` * - ``std::ifstream file(path, std::ios::binary \| std::ios::ate)`` - std::ifstream - pd_dataframe.h:38788 - :ref:`View ` * - ``std::ifstream file(path, std::ios::binary \| std::ios::ate)`` - std::ifstream - pd_dataframe.h:39181 - :ref:`View ` * - ``std::ofstream file(path, std::ios::binary)`` - std::ofstream - pd_dataframe.h:40327 - :ref:`View ` * - ``std::ofstream file(path_, std::ios::binary)`` - std::ofstream - pd_excel.h:607 - :ref:`View ` * - ``std::ifstream file(path_, std::ios::binary \| std::ios::ate)`` - std::ifstream - pd_excel.h:976 - :ref:`View ` * - ``std::ifstream file(filepath_or_buffer)`` - std::ifstream - pd_top_level.h:2978 - :ref:`View ` * - ``fill_slot(slot_idx, tmp)`` - - pd_apply_visitor.h:432 - * - ``inline Series finalize_transform_callable( const Series& s, TransformCallableResult&& r)`` - Series - pd_apply_visitor.h:451 - * - ``inline std::string find_common_type(const std::vector& src_dtypes)`` - std::string - pd_promote.h:568 - :ref:`View ` * - ``inline void flatten_dict(const JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out)`` - void - json.h:108 - :ref:`View ` * - ``flatten_dict(child, full_key, sep, max_level, level + 1, out)`` - - json.h:118 - :ref:`View ` * - ``flatten_dict(rec, "", params.sep, params.max_level, 0, flat)`` - - json_impl.h:405 - :ref:`View ` * - ``inline std::string float_to_python_str(double v)`` - std::string - pd_series.h:166 - * - ``inline std::int64_t floor_div(std::int64_t a, std::int64_t b)`` - std::int64_t - pd_datetime64_formatter.h:60 - * - ``inline int64_t floor_div(int64_t a, int64_t b)`` - int64_t - pd_resampler.h:33 - * - ``inline std::int64_t floor_mod(std::int64_t a, std::int64_t b)`` - std::int64_t - pd_datetime64_formatter.h:67 - * - ``format_array(const ArrayT& arr, const FormatOptions& opts = {})`` - inline std::vector - pd_format_array.h:239 - * - ``inline std::string format_bin_label_from_ns(int64_t bin_ns, char cat)`` - std::string - pd_groupby.h:3331 - * - ``inline std::string format_date(int year, int month, int day)`` - std::string - pd_groupby.h:3223 - * - ``inline std::string format_datetime_to_sec(int y, int m, int d, int hh, int mi, int ss)`` - std::string - pd_groupby.h:3296 - * - ``inline std::string format_datetime_with_frac(int y, int m, int d, int hh, int mi, int ss, int64_t sub_ns, int frac_digits)`` - std::string - pd_groupby.h:3301 - * - ``inline std::string format_duplicate_label_error(const IndexBase& idx)`` - std::string - pd_index.h:3454 - :ref:`View ` * - ``inline std::string format_epoch_date_only(std::int64_t epoch_s)`` - std::string - pd_datetime64_formatter.h:114 - * - ``inline std::string format_epoch_second(std::int64_t epoch_s)`` - std::string - pd_datetime64_formatter.h:98 - * - ``inline std::string format_float(double v, int precision)`` - std::string - pd_format_helpers.h:96 - :ref:`View ` * - ``inline std::string format_fractional(std::int64_t sub, int digits)`` - std::string - pd_datetime64_formatter.h:88 - * - ``inline std::string format_period_ordinal(std::int64_t ord, PeriodFreq freq)`` - std::string - pd_period_formatter.h:66 - * - ``inline std::string format_pivot_cell_value( double val, const std::string& val_str, const std::string& aggfunc)`` - std::string - pd_display_formats.h:216 - :ref:`View ` * - ``inline std::string format_pivot_multi_aggfunc( const std::vector>& index_level_values, const std::vector>& index_level_names, const std::string& col_level_name, const std::vector& aggfuncs, const std::vector& sub_columns, const std::vector>& str_data)`` - std::string - pd_display_formats.h:150 - :ref:`View ` * - ``inline std::string format_quantile_label(double q)`` - std::string - pd_display_formats.h:230 - :ref:`View ` * - ``insert_sql << format_sql_value(index_->get_value_str(r), col_types[col_idx])`` - insert_sql << - pd_dataframe.h:30365 - * - ``insert_sql << format_sql_value(columns_[c]->get_value_str(r), col_types[col_idx])`` - insert_sql << - pd_dataframe.h:30372 - * - ``insert_sql << format_sql_value(index_->get_value_str(r), col_types[col_idx])`` - insert_sql << - pd_dataframe.h:30395 - * - ``insert_sql << format_sql_value(columns_[c]->get_value_str(r), col_types[col_idx])`` - insert_sql << - pd_dataframe.h:30402 - * - ``inline std::string format_td64_human(std::int64_t ticks, Timedelta64Resolution r)`` - std::string - pd_timedelta64_formatter.h:54 - * - ``inline std::string format_utc_offset_minutes(int offset_minutes)`` - std::string - pd_datetime64_formatter.h:128 - * - ``oss << format_value(c, r)`` - oss << - pd_dataframe.h:31828 - * - ``std::string found(reinterpret_cast(&buffer[pos]), expected_start.size())`` - std::string - pd_dataframe.h:38807 - :ref:`View ` * - ``std::string found(reinterpret_cast(&buffer[pos]), tag.size())`` - std::string - pd_dataframe.h:38817 - :ref:`View ` * - ``inline int64_t freq_base_nanos(ResampleFreq freq)`` - int64_t - pd_resampler.h:218 - * - ``inline int64_t freq_base_seconds(ResampleFreq freq)`` - int64_t - pd_resampler.h:191 - * - ``inline char freq_category(const std::string& freq)`` - char - pd_groupby.h:3531 - * - ``inline int64_t freq_to_seconds(ResampleFreq freq)`` - int64_t - pd_resampler.h:211 - :ref:`View ` * - ``inline std::vector full_bin_labels_for_freq( const std::string& min_label, const std::string& max_label, const std::string& freq)`` - std::vector - pd_groupby.h:3793 - * - ``gmtime_r(&secs, &tm_buf)`` - - json.h:264 - * - ``gmtime_r(&t, &tm)`` - - pd_datetime64_formatter.h:104 - * - ``gmtime_r(&t, &tm)`` - - pd_datetime64_formatter.h:120 - * - ``gmtime_s(&tm_buf, &secs)`` - - json.h:262 - * - ``gmtime_s(&tm, &t)`` - - pd_datetime64_formatter.h:102 - * - ``gmtime_s(&tm, &t)`` - - pd_datetime64_formatter.h:118 - * - ``pandas::Series gs(std::move(gvals))`` - pandas::Series - pd_groupby.h:1624 - * - ``bool has_cached_values() const override`` - bool - pd_dataframe.h:42342 - :ref:`View ` * - ``, hide_columns_(false)`` - , - pd_styler.h:777 - * - ``, hide_columns_(other.hide_columns_)`` - , - pd_styler.h:798 - * - ``inline std::string infer_column_dtype(const std::vector& vals, bool /\*has_nan_token\*/ = true)`` - std::string - json.h:168 - :ref:`View ` * - ``inline std::string infer_dtype_override(const Container& values, bool has_nan, bool bool_hint = false)`` - std::string - pd_dataframe_construct.h:126 - :ref:`View ` * - ``inline std::string infer_dtype_override_from_kinds(const ValueKindRange& kinds)`` - std::string - pd_dataframe_construct.h:168 - :ref:`View ` * - ``inline int infer_float_repr_precision(std::span vals, int min_precision = 1, int max_precision = 15)`` - int - pd_format_helpers.h:47 - :ref:`View ` * - ``inline std::string infer_freq(const DatetimeIndex& index)`` - std::string - pd_top_level.h:1383 - :ref:`View ` * - ``inline std::string infer_freq_from_string(const std::string& value)`` - std::string - pd_period_ordinal_utils.h:112 - * - ``inline SeriesDtypeInferenceResult infer_from_timestamps( const std::vector>& vec)`` - SeriesDtypeInferenceResult - pd_series.h:450 - * - ``void infer_json_column_dtypes(DataFrame& df, bool convert_dates, bool convert_axes, const std::vector& convert_dates_explicit = {})`` - void - json.h:321 - * - ``inline void infer_json_column_dtypes(DataFrame& result, bool convert_dates, bool convert_axes, const std::vector& convert_dates_explicit)`` - void - json_impl.h:111 - * - ``void info(std::ostream& buf = std::cout, bool verbose = true, size_t max_cols = 0, bool memory_usage = true, bool show_counts = true) const`` - void - pd_dataframe.h:27822 - :ref:`View ` * - ``std::vector> int_results_per_col(value_cols.size())`` - std::vector> - pd_groupby.h:5166 - * - ``inline std::string interval_closed_to_string(IntervalClosed closed)`` - std::string - pd_interval_dtype.h:42 - * - ``IntervalArray interval_range( std::optional start = std::nullopt, std::optional end = std::nullopt, std::optional periods = std::nullopt, std::optional freq = std::nullopt, const std::string& closed = "right", const std::optional& name = std::nullopt)`` - IntervalArray - pd_top_level.h:1484 - :ref:`View ` * - ``inline std::string invalid_freq_string(const std::string& freq)`` - std::string - pd_exceptions.h:280 - * - ``inline std::string invalid_join_type(const std::string& how)`` - std::string - pd_exceptions.h:207 - :ref:`View ` * - ``inline std::string invalid_join_type_with_valid_set(const std::string& how)`` - std::string - pd_exceptions.h:212 - :ref:`View ` * - ``void invalidate_caches() const`` - void - pd_dataframe.h:42351 - * - ``std::istringstream iss(s)`` - std::istringstream - pd_top_level.h:2362 - :ref:`View ` * - ``std::istringstream iss(s)`` - std::istringstream - pd_top_level.h:2549 - :ref:`View ` * - ``std::istringstream iss(s)`` - std::istringstream - pd_top_level.h:2652 - :ref:`View ` * - ``inline bool json_name_is_datelike(const std::string& col_name)`` - bool - json.h:275 - * - ``inline DataFrame json_normalize(const std::vector& records, const NormalizeParams& params)`` - DataFrame - json_impl.h:318 - :ref:`View ` * - ``inline DataFrame json_normalize( const std::vector>>>& data, const std::string& record_path = "", const std::vector& meta = {}, const std::string& meta_prefix = "", const std::string& sep = ".", const std::string& errors = "raise", std::optional max_level = std::nullopt, const std::string& record_prefix = "")`` - DataFrame - pd_top_level.h:2210 - :ref:`View ` * - ``inline std::string json_tz_suffix(const std::string& iso)`` - std::string - json.h:297 - * - ``inline std::string json_value_to_string(const JsonValue& v)`` - std::string - json.h:71 - :ref:`View ` * - ``omap_set(out, full_key, json_value_to_string(val))`` - omap_set(out, full_key, - json.h:124 - :ref:`View ` * - ``std::vector> kept_levels(header_levels.size())`` - std::vector> - pd_dataframe.h:37592 - * - ``inline bool label_is_bool(const std::string& l)`` - bool - pd_dtype_classify.h:248 - * - ``inline bool label_is_complex(const std::string& l)`` - bool - pd_dtype_classify.h:238 - * - ``inline bool label_is_string_family(const std::string& l)`` - bool - pd_dtype_classify.h:241 - * - ``inline bool label_is_temporal(const std::string& l)`` - bool - pd_dtype_classify.h:234 - * - ``inline std::string label_not_found(const std::string& label)`` - std::string - pd_exceptions.h:154 - :ref:`View ` * - ``inline bool labels_match_normalized(std::string_view a, std::string_view b)`` - bool - pd_datetime_utils.h:53 - * - ``load_sheet_data(target_sheet)`` - - pd_excel.h:1262 - * - ``inline bool looks_like_iso_date(const std::string& s)`` - bool - json.h:244 - * - ``inline DataFrame lreshape( const DataFrame& df, const std::map>& groups, bool dropna = false)`` - DataFrame - pd_top_level.h:1563 - :ref:`View ` * - ``std::istringstream lstream(data)`` - std::istringstream - pd_dataframe.h:35858 - * - ``make_array_formatter(const ArrayT& arr, const FormatOptions& opts = {})`` - inline std::unique_ptr - pd_format_array.h:207 - * - ``inline numpy::datetime64 make_datetime(int year, int month, int day, int hour, int min, int sec, const numpy::datetime64& ref)`` - inline numpy::datetime64 - pd_dateoffset.h:63 - * - ``inline std::pair, size_t> make_fixed_width( const std::vector& strings, std::string_view justify = "right", size_t minimum = 0, std::optional max_colwidth = std::nullopt, std::shared_ptr adj = nullptr)`` - std::pair, size_t> - pd_display_formats.h:86 - * - ``oss << make_hsep('+', '-', '+') << "\\n"`` - oss << - pd_dataframe.h:33682 - * - ``oss << make_hsep('+', '=', '+') << "\\n"`` - oss << - pd_dataframe.h:33697 - * - ``oss << make_hsep('+', '-', '+') << "\\n"`` - oss << - pd_dataframe.h:33713 - * - ``make_json_tz_array(ns_vals, tz_suffix))`` - - json_impl.h:211 - * - ``inline std::unique_ptr make_offset_from_string( const std::string& freq_str, int periods)`` - std::unique_ptr - pd_series_shift.h:15 - :ref:`View ` * - ``inline std::shared_ptr make_series_from_data_arg( const DataArg& data, const DTypeHint& /\*dtype_hint\*/, const IndexHint& /\*index_hint\*/, const NameHint& name_hint )`` - std::shared_ptr - pd_series_apply_dispatch.h:760 - :ref:`View ` * - ``inline void materialise_column_from_kinds( DataFrameT& df, const std::string& name, const ValueKindRange& kinds, const std::string& target_dtype)`` - void - pd_dataframe_construct.h:510 - * - ``inline std::string maybe_promote( std::string_view effective_dtype, FillKind fill_kind, bool has_missing, double float_fill_value = std::numeric_limits::quiet_NaN() )`` - std::string - pd_promote.h:89 - :ref:`View ` * - ``Series memory_usage(bool index = true, bool deep = false) const`` - Series - pd_dataframe.h:27992 - :ref:`View ` * - ``size_t memory_usage_total(bool deep = false) const`` - size_t - pd_dataframe.h:28096 - :ref:`View ` * - ``MultiIndex mi(std::move(levels), std::move(codes))`` - MultiIndex - pd_series.h:16453 - :ref:`View ` * - ``MultiIndex mi(std::move(levels), std::move(codes))`` - MultiIndex - pd_series.h:16501 - :ref:`View ` * - ``std::vector> mi_arrays(row_levels.size())`` - std::vector> - pd_dataframe.h:44001 - * - ``inline const char\* month_abbr(int m)`` - inline const char\* - pd_dateoffset.h:46 - * - ``inline int month_abbr_to_num(const std::string& abbr)`` - int - pd_groupby.h:3424 - * - ``inline int month_index(const std::string& abbr)`` - int - pd_dateoffset_freq_parse.h:78 - * - ``std::regex month_re(R"(^(\\d{4})-(\\d{1,2})$)")`` - std::regex - pd_period_ordinal_utils.h:530 - * - ``std::vector> na_assignments(x.size(), std::nullopt)`` - std::vector> - pd_top_level.h:1047 - * - ``std::vector> na_assignments(x.size(), std::nullopt)`` - std::vector> - pd_top_level.h:1144 - * - ``DatetimeArray naive_arr(arr.data().copydeepArray(), arr.mask().copydeepArray(), arr.unit(), nullptr)`` - DatetimeArray - pd_resampler.h:1843 - * - ``DatetimeIndex naive_idx(std::move(naive_arr), dt_idx->name())`` - DatetimeIndex - pd_resampler.h:1844 - * - ``std::string name(reinterpret_cast(&buffer[pos + 30]), name_len)`` - std::string - pd_dataframe.h:36907 - :ref:`View ` * - ``std::string name(reinterpret_cast(&file_buffer_[pos + 30]), name_len)`` - std::string - pd_excel.h:1027 - :ref:`View ` * - ``inline std::string nanos_to_timedelta_string(int64_t nanos)`` - std::string - pd_interval_dtype.h:234 - * - ``inline std::string nanos_to_timedelta_string(int64_t nanos)`` - std::string - pd_interval_dtype.h:589 - * - ``inline std::string nanos_to_timestamp_str(int64_t nanos)`` - std::string - pd_datetime_utils.h:26 - :ref:`View ` * - ``inline std::string nanos_to_timestamp_string(int64_t nanos)`` - std::string - pd_interval_dtype.h:236 - * - ``inline std::string nanos_to_timestamp_string(int64_t nanos)`` - std::string - pd_interval_dtype.h:616 - * - ``inline std::string normalize_date_string(const std::string& s)`` - std::string - pd_period_ordinal_utils.h:584 - :ref:`View ` * - ``inline std::string normalize_freq_str(const std::string& freq)`` - std::string - pd_resampler.h:161 - * - ``inline std::string normalize_tz_display(const std::string& tz_name, const std::string& iana_fallback)`` - std::string - pd_tz_format.h:23 - * - ``inline std::string ns_string_to_date_string(const std::string& val)`` - std::string - pd_groupby.h:3233 - * - ``inline DateYMD nth_weekday_of_month(int year, int month, int weekday, int n)`` - DateYMD - pd_holiday.h:126 - * - ``inline std::string numeric_only_false(const std::string& op)`` - std::string - pd_exceptions.h:331 - :ref:`View ` * - ``inline std::string numeric_only_false_sum_hint(const std::string& op)`` - std::string - pd_exceptions.h:334 - :ref:`View ` * - ``inline void omap_set(std::vector>& out, const std::string& key, std::string value)`` - void - json.h:96 - * - ``omap_set(out, full_key, "")`` - - json.h:120 - * - ``omap_set(out, full_key, "[]")`` - - json.h:122 - * - ``inline int ordinal_to_day(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:273 - * - ``inline int ordinal_to_dayofweek(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:300 - * - ``inline int ordinal_to_dayofyear(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:345 - * - ``inline int ordinal_to_hour(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:376 - * - ``inline int ordinal_to_minute(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:392 - * - ``inline int ordinal_to_month(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:232 - * - ``inline int ordinal_to_quarter(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:265 - * - ``inline int ordinal_to_second(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:406 - * - ``inline std::string ordinal_to_string(int64_t ordinal, PeriodFrequency freq)`` - std::string - pd_period_ordinal_utils.h:603 - :ref:`View ` * - ``inline int64_t ordinal_to_timestamp_ns(int64_t ordinal, PeriodFrequency freq, const std::string& how)`` - int64_t - pd_period_ordinal_utils.h:416 - * - ``inline int ordinal_to_week(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:361 - * - ``inline int ordinal_to_year(int64_t ordinal, PeriodFrequency freq)`` - int - pd_period_ordinal_utils.h:203 - * - ``std::string out(main_)`` - std::string - pd_period_formatter.h:166 - :ref:`View ` * - ``std::string out(buf)`` - std::string - pd_timedelta64_formatter.h:92 - :ref:`View ` * - ``std::vector> out_cx(this->size())`` - std::vector> - pd_series_apply_dispatch.h:124 - * - ``pack_idx_and_name(\*f)`` - - pd_concat_series.h:251 - * - ``pack_idx_and_name(\*f)`` - - pd_concat_series.h:276 - * - ``inline std::string pairwise_common_type(std::string_view a_sv, std::string_view b_sv)`` - std::string - pd_promote.h:254 - :ref:`View ` * - ``inline ResampleFreq parse_base_freq(const std::string& unit)`` - ResampleFreq - pd_resampler.h:115 - :ref:`View ` * - ``inline int parse_closed_param(const std::string& closed_str)`` - int - pd_rolling.h:571 - :ref:`View ` * - ``inline void parse_date_components(const std::string& val_str, int& year, int& month, int& day)`` - void - pd_groupby.h:3200 - * - ``parse_date_components(date_strings[i], dates[i].year, dates[i].month, dates[i].day)`` - - pd_groupby.h:3561 - * - ``parse_date_components(date_strings[i], y, m, d)`` - - pd_groupby.h:3747 - * - ``inline int64_t parse_datetime_to_epoch_seconds(const std::string& datetime_str)`` - int64_t - pd_resampler.h:2125 - * - ``inline int64_t parse_datetime_to_ns(const std::string& s)`` - int64_t - pd_groupby.h:3362 - * - ``inline DtypeOverride parse_dtype_override_keep_spelling(std::string_view label)`` - DtypeOverride - pd_dtype_override.h:213 - * - ``parse_frac(time_part, colon_pos + 6)`` - - pd_datetime_index.h:4023 - * - ``parse_frac(time_part, c1 + 6)`` - - pd_datetime_index.h:4048 - * - ``parse_frac(time_part, c1 + 6)`` - - pd_datetime_index.h:4074 - * - ``inline ResampleFreq parse_freq(const std::string& freq)`` - ResampleFreq - pd_resampler.h:183 - * - ``inline int parse_freq_multiplier(const std::string& freq)`` - int - pd_groupby.h:3527 - * - ``inline FreqSpec parse_freq_spec(const std::string& freq)`` - FreqSpec - pd_groupby.h:3461 - * - ``inline std::pair parse_freq_with_multiplier(const std::string& freq)`` - std::pair - pd_resampler.h:136 - * - ``inline IntervalClosed parse_interval_closed(const std::string& s)`` - IntervalClosed - pd_interval_dtype.h:58 - :ref:`View ` * - ``inline int64_t parse_offset_str_to_nanos(const std::string& offset_str)`` - int64_t - pd_resampler.h:241 - * - ``inline int64_t parse_offset_to_seconds(const std::string& offset)`` - int64_t - pd_offset_utils.h:27 - :ref:`View ` * - ``inline PeriodFrequency parse_period_freq(const std::string& freq_str)`` - PeriodFrequency - pd_period_freq.h:45 - :ref:`View ` * - ``inline int64_t parse_period_string(const std::string& str, PeriodFrequency freq)`` - int64_t - pd_period_ordinal_utils.h:517 - * - ``inline PartialDateResult partial_string_getitem( const pandas::Series& s, const pandas::DatetimeIndex& dti, const std::string& label)`` - PartialDateResult - pd_datetime_utils.h:137 - :ref:`View ` * - ``inline PeriodArray period_array(const numpy::NDArray& data, const std::string& freq)`` - PeriodArray - pd_period_array.h:1141 - * - ``inline std::string period_freq_to_string(PeriodFrequency freq)`` - std::string - pd_period_freq.h:89 - * - ``PeriodIndex period_idx(std::move(period_arr), dt_idx->name())`` - PeriodIndex - pd_resampler.h:1689 - :ref:`View ` * - ``PeriodIndex period_idx(std::move(period_arr), dt_idx->name())`` - PeriodIndex - pd_resampler.h:3840 - :ref:`View ` * - ``inline std::string pluralize_offset_name(const std::string& singular, int64_t n)`` - std::string - pd_dateoffset.h:142 - :ref:`View ` * - ``std::vector> preformatted(ncols())`` - std::vector> - pd_dataframe.h:33471 - * - ``inline std::string promote_for_fill(std::string_view src_dtype, const pandas::FillValue& fv, bool has_missing)`` - std::string - pd_func_dispatch.h:344 - :ref:`View ` * - ``inline void propagate_aligned_dtype(DataFrame& df, const std::string& col, const AlignmentResult& aligned, const std::string& source_dtype_full)`` - void - pd_dataframe_setitem.h:293 - :ref:`View ` * - ``put(key, value, format, index, false)`` - - pd_dataframe.h:44275 - * - ``put(key, combined, format, index, false)`` - - pd_dataframe.h:44287 - * - ``CutResult qcut( const std::vector& x, int q, const std::vector& labels = {}, const std::string& duplicates = "raise", int precision = 3, bool retbins = false)`` - CutResult - pd_top_level.h:979 - :ref:`View ` * - ``CutResult qcut( const std::vector& x, const std::vector& q_list, const std::vector& labels = {}, const std::string& duplicates = "raise", int precision = 3)`` - CutResult - pd_top_level.h:1072 - :ref:`View ` * - ``std::regex quarter_re(R"(^(\\d{4})-?Q([1-4])$)")`` - std::regex - pd_period_ordinal_utils.h:528 - * - ``std::string r(sv)`` - std::string - pd_datetime_utils.h:55 - :ref:`View ` * - ``std::regex re(pattern)`` - std::regex - pd_top_level.h:1668 - * - ``inline DataFrame read_clipboard()`` - DataFrame - pd_top_level.h:2872 - :ref:`View ` * - ``static DataFrame read_csv( const std::string& filepath_or_buffer, char sep = ',', bool header = true, const std::string& index_col = "", int index_col_pos = -1, [[maybe_unused]] bool cache_dates = true, [[maybe_unused]] std::optional chunksize = std::nullopt, const std::string& comment = "", [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function& date_parser = nullptr, bool dayfirst = false, const std::string& decimal = ".", [[maybe_unused]] bool delim_whitespace = false, [[maybe_unused]] const std::string& dialect = "", [[maybe_unused]] bool doublequote = true, const std::string& dtype = "", [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::string& encoding_errors = "strict", [[maybe_unused]] const std::string& engine = "", [[maybe_unused]] bool error_bad_lines = true, const std::string& escapechar = "", const std::vector& false_values = {}, [[maybe_unused]] bool float_precision = true, [[maybe_unused]] bool infer_datetime_format = false, [[maybe_unused]] bool iterator = false, [[maybe_unused]] bool keep_date_col = false, bool keep_default_na = true, const std::string& lineterminator = "", [[maybe_unused]] bool low_memory = true, [[maybe_unused]] bool memory_map = false, bool na_filter = true, const std::vector& na_values = {}, const std::vector& names = {}, std::optional nrows = std::nullopt, const std::string& on_bad_lines = "error", const std::vector& parse_dates = {}, const std::string& quotechar = "\\"", int quoting = 0, bool skip_blank_lines = true, [[maybe_unused]] std::optional skipfooter = std::nullopt, bool skipinitialspace = false, std::optional skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector& true_values = {}, const std::vector& usecols = {}, [[maybe_unused]] bool verbose = false, // Extended parameters (for migration from binding) const std::set& skiprows_set = {}, const std::map& dtype_map = {}, bool parse_dates_bool = false, const std::vector& usecols_positions = {}, const std::vector& header_rows = {}, const std::vector& index_col_list = {}, const std::vector& index_col_pos_list = {})`` - static DataFrame - pd_dataframe.h:34617 - :ref:`View ` * - ``static DataFrame read_csv(const std::string& filepath, const std::map& options)`` - static DataFrame - pd_dataframe.h:35505 - :ref:`View ` * - ``static DataFrame read_csv(const std::string& source, const std::map& options, bool source_is_content)`` - static DataFrame - pd_dataframe.h:35514 - :ref:`View ` * - ``static DataFrame read_csv(const std::string& filepath, std::initializer_list> options)`` - static DataFrame - pd_dataframe.h:35521 - :ref:`View ` * - ``static DataFrame read_csv_options_impl(const std::string& filepath, const std::map& options, bool source_is_content)`` - static DataFrame - pd_dataframe.h:35531 - * - ``static DataFrame read_excel( const std::string& io, const std::string& sheet_name = "Sheet1", int header = 0, const std::vector& names = {}, const std::vector& usecols = {}, const std::string& dtype = "", const std::string& comment = "", [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function& date_parser = nullptr, const std::string& decimal = ".", [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& engine = "", [[maybe_unused]] const std::map& engine_kwargs = {}, const std::vector& false_values = {}, const std::string& index_col = "", bool keep_default_na = true, const std::vector& na_filter = {}, const std::vector& na_values = {}, std::optional nrows = std::nullopt, const std::vector& parse_dates = {}, std::optional skipfooter = std::nullopt, std::optional skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector& true_values = {}, [[maybe_unused]] bool verbose = false, // plan_09b: dispatcher-only extension parameters. const std::vector& header_rows = {}, const std::vector& usecols_positions = {}, const std::set& skiprows_set = {}, std::optional index_col_position = std::nullopt, std::optional sheet_index = std::nullopt)`` - static DataFrame - pd_dataframe.h:36816 - :ref:`View ` * - ``static DataFrame read_excel(const std::string& io, const std::map& options)`` - static DataFrame - pd_dataframe.h:37627 - :ref:`View ` * - ``static DataFrame read_excel(const std::string& io, std::initializer_list> options)`` - static DataFrame - pd_dataframe.h:37781 - :ref:`View ` * - ``inline DataFrame read_excel( const std::string& io, [[maybe_unused]] const std::variant& sheet_name = 0, [[maybe_unused]] int header = 0, [[maybe_unused]] const std::vector& names = {}, [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector& usecols = {}, [[maybe_unused]] const std::string& dtype = "", [[maybe_unused]] const std::string& engine = "", [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::vector& true_values = {}, [[maybe_unused]] const std::vector& false_values = {}, [[maybe_unused]] std::optional skiprows = std::nullopt, [[maybe_unused]] std::optional nrows = std::nullopt, [[maybe_unused]] const std::vector& na_values = {}, [[maybe_unused]] bool keep_default_na = true, [[maybe_unused]] bool na_filter = true, [[maybe_unused]] bool verbose = false, [[maybe_unused]] const std::vector& parse_dates = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::string& thousands = "", [[maybe_unused]] const std::string& decimal = ".", [[maybe_unused]] const std::string& comment = "", [[maybe_unused]] std::optional skipfooter = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& dtype_backend = "")`` - DataFrame - pd_top_level.h:2911 - :ref:`View ` * - ``static DataFrame read_feather( const std::string& path, [[maybe_unused]] const std::vector& columns = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] bool use_threads = true)`` - static DataFrame - pd_dataframe.h:39173 - :ref:`View ` * - ``inline DataFrame read_feather(const std::string& path)`` - DataFrame - pd_top_level.h:2946 - :ref:`View ` * - ``inline DataFrame read_fwf( const std::string& filepath_or_buffer, [[maybe_unused]] std::optional chunksize = std::nullopt, const std::vector>& colspecs = {}, [[maybe_unused]] const std::string& dtype_backend = "", int infer_nrows = 100, [[maybe_unused]] bool iterator = false, const std::vector& widths = {})`` - DataFrame - pd_top_level.h:2968 - * - ``inline DataFrame read_gbq( const std::string& query, [[maybe_unused]] const std::string& project_id = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector& col_order = {}, [[maybe_unused]] bool reauth = false, [[maybe_unused]] bool auth_local_webserver = true, [[maybe_unused]] const std::string& dialect = "standard", [[maybe_unused]] const std::string& location = "", [[maybe_unused]] const std::map& configuration = {}, [[maybe_unused]] const std::string& credentials = "", [[maybe_unused]] bool use_bqstorage_api = false, [[maybe_unused]] std::optional max_results = std::nullopt, [[maybe_unused]] const std::string& progress_bar_type = "")`` - DataFrame - pd_top_level.h:3185 - * - ``static DataFrame read_hdf( const std::string& path, const std::string& key = "", std::optional chunksize = std::nullopt, const std::vector& columns = {}, [[maybe_unused]] const std::string& errors = "strict", bool iterator = false, [[maybe_unused]] const std::string& mode = "r", std::optional start = std::nullopt, std::optional stop = std::nullopt, [[maybe_unused]] const std::string& where = "")`` - static DataFrame - pd_dataframe.h:38277 - :ref:`View ` * - ``inline DataFrame read_hdf( const std::string& path_or_buf, const std::string& key = "", const std::string& mode = "r", const std::string& errors = "strict", [[maybe_unused]] const std::string& where = "", std::optional start = std::nullopt, std::optional stop = std::nullopt, const std::vector& columns = {}, bool iterator = false, std::optional chunksize = std::nullopt)`` - DataFrame - pd_top_level.h:3223 - :ref:`View ` * - ``inline std::vector read_html( const std::string& io, [[maybe_unused]] const std::map& attrs = {}, [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::string& decimal = ".", [[maybe_unused]] bool displayed_only = true, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& encoding = "", [[maybe_unused]] const std::string& extract_links = "", [[maybe_unused]] const std::string& flavor = "", [[maybe_unused]] int header = 0, [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] bool keep_default_na = true, [[maybe_unused]] const std::string& match = "", [[maybe_unused]] const std::vector& na_values = {}, [[maybe_unused]] bool parse_dates = false, [[maybe_unused]] std::optional skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& thousands = "")`` - std::vector - pd_top_level.h:3265 - * - ``static DataFrame read_json(const std::string& source, const std::map& options)`` - static DataFrame - pd_dataframe.h:35749 - :ref:`View ` * - ``static DataFrame read_json(const std::string& source, const std::map& options, bool source_is_content)`` - static DataFrame - pd_dataframe.h:35758 - :ref:`View ` * - ``static DataFrame read_json(const std::string& source, std::initializer_list> options)`` - static DataFrame - pd_dataframe.h:35765 - :ref:`View ` * - ``static DataFrame read_json( const std::string& path_or_buf, const std::string& orient = "columns", [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] bool convert_axes = true, const std::vector& convert_dates = {}, [[maybe_unused]] const std::string& date_unit = "ms", [[maybe_unused]] const std::string& dtype = "", [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::string& encoding_errors = "strict", [[maybe_unused]] const std::string& engine = "", [[maybe_unused]] bool keep_default_dates = true, [[maybe_unused]] bool lines = false, [[maybe_unused]] std::optional nrows = std::nullopt, [[maybe_unused]] bool precise_float = false, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& typ = "frame", bool source_is_content = false)`` - static DataFrame - pd_dataframe.h:35797 - :ref:`View ` * - ``static DataFrame read_json_options_impl(const std::string& source, const std::map& options, bool source_is_content)`` - static DataFrame - pd_dataframe.h:36604 - * - ``inline DataFrame read_orc( const std::string& path, std::optional> columns = std::nullopt, const std::string& dtype_backend = "", const std::string& filesystem = "")`` - DataFrame - pd_top_level.h:3296 - * - ``static DataFrame read_parquet( const std::string& path, const std::vector& columns = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& engine = "pyarrow", [[maybe_unused]] const std::string& filesystem = "", [[maybe_unused]] const std::vector>& filters = {}, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] bool use_nullable_dtypes = false)`` - static DataFrame - pd_dataframe.h:37816 - :ref:`View ` * - ``inline DataFrame read_parquet(const std::string& path)`` - DataFrame - pd_top_level.h:3313 - :ref:`View ` * - ``inline DataFrame read_pickle( const std::string& path, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::string& storage_options = "")`` - DataFrame - pd_top_level.h:3325 - :ref:`View ` * - ``inline DataFrame read_sas( const std::string& filepath_or_buffer, [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::string& encoding = "", [[maybe_unused]] const std::string& format = "", [[maybe_unused]] const std::string& index = "", [[maybe_unused]] bool iterator = false)`` - DataFrame - pd_top_level.h:3350 - :ref:`View ` * - ``inline DataFrame read_spss( const std::string& path, std::optional> usecols = std::nullopt, bool convert_categoricals = true, const std::string& dtype_backend = "")`` - DataFrame - pd_top_level.h:3370 - :ref:`View ` * - ``static DataFrame read_sql( [[maybe_unused]] const std::string& sql, const std::string& con, [[maybe_unused]] const std::vector& columns = {}, [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::map& dtype = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector& params = {}, [[maybe_unused]] const std::vector& parse_dates = {})`` - static DataFrame - pd_dataframe.h:38554 - :ref:`View ` * - ``inline DataFrame read_sql(const std::string& sql, const std::string& con)`` - DataFrame - pd_top_level.h:3388 - :ref:`View ` * - ``inline DataFrame read_sql_query( const std::string& sql, const std::string& con, [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::map& dtype = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector& params = {}, [[maybe_unused]] const std::vector& parse_dates = {})`` - DataFrame - pd_top_level.h:3407 - * - ``inline DataFrame read_sql_table( const std::string& table_name, const std::string& con, [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::vector& columns = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector& parse_dates = {}, [[maybe_unused]] const std::string& schema = "")`` - DataFrame - pd_top_level.h:3435 - * - ``static DataFrame read_stata( const std::string& path, [[maybe_unused]] bool convert_dates = true, [[maybe_unused]] std::optional chunksize = std::nullopt, [[maybe_unused]] const std::vector& columns = {}, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] bool convert_categoricals = true, [[maybe_unused]] bool convert_missing = false, [[maybe_unused]] bool index_col = false, [[maybe_unused]] bool order_categoricals = true, [[maybe_unused]] bool preserve_dtypes = true, [[maybe_unused]] const std::string& storage_options = "")`` - static DataFrame - pd_dataframe.h:38774 - :ref:`View ` * - ``inline DataFrame read_stata( const std::string& filepath_or_buffer, [[maybe_unused]] bool iterator = false)`` - DataFrame - pd_top_level.h:3462 - :ref:`View ` * - ``inline DataFrame read_table( const std::string& filepath_or_buffer, const std::string& sep = "\\t", [[maybe_unused]] bool cache_dates = true, [[maybe_unused]] std::optional chunksize = std::nullopt, const std::string& comment = "", [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function& date_parser = nullptr, bool dayfirst = false, const std::string& decimal = ".", [[maybe_unused]] const std::string& delimiter = "", [[maybe_unused]] bool delim_whitespace = false, [[maybe_unused]] const std::string& dialect = "", bool doublequote = true, const std::string& dtype = "", [[maybe_unused]] const std::string& dtype_backend = "", const std::string& encoding = "utf-8", [[maybe_unused]] const std::string& encoding_errors = "strict", const std::string& escapechar = "", const std::vector& false_values = {}, [[maybe_unused]] bool float_precision = true, int header = 0, const std::string& index_col = "", [[maybe_unused]] bool infer_datetime_format = false, [[maybe_unused]] bool iterator = false, [[maybe_unused]] bool keep_date_col = false, bool keep_default_na = true, const std::string& lineterminator = "", [[maybe_unused]] bool low_memory = true, [[maybe_unused]] bool memory_map = false, bool na_filter = true, const std::vector& names = {}, const std::vector& na_values = {}, std::optional nrows = std::nullopt, const std::string& on_bad_lines = "error", const std::vector& parse_dates = {}, const std::string& quotechar = "\\"", int quoting = 0, bool skip_blank_lines = true, [[maybe_unused]] std::optional skipfooter = std::nullopt, bool skipinitialspace = false, std::optional skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector& true_values = {}, const std::vector& usecols = {}, [[maybe_unused]] bool verbose = false)`` - DataFrame - pd_top_level.h:3542 - :ref:`View ` * - ``inline DataFrame read_table(const std::string& filepath_or_buffer, const std::map& options, bool source_is_content = false)`` - DataFrame - pd_top_level.h:3636 - :ref:`View ` * - ``inline DataFrame read_xml( const std::string& path_or_buffer, [[maybe_unused]] bool attrs_only = false, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::map>& converters = {}, [[maybe_unused]] const std::string& dtype = "", [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] bool elems_only = false, [[maybe_unused]] const std::string& encoding = "utf-8", [[maybe_unused]] const std::vector& iterparse = {}, [[maybe_unused]] const std::vector& names = {}, [[maybe_unused]] const std::map& namespaces = {}, [[maybe_unused]] const std::vector& parse_dates = {}, [[maybe_unused]] const std::string& parser = "lxml", [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& stylesheet = "", [[maybe_unused]] const std::string& xpath = "")`` - DataFrame - pd_top_level.h:3675 - :ref:`View ` * - ``inline pandas::MultiIndex reconstruct_multiindex_from_levels_codes( const std::vector>& levels, const std::vector>& codes, std::vector> names = {})`` - pandas::MultiIndex - pd_dataframe_construct.h:379 - :ref:`View ` * - ``inline DataFrameT records_to_dataframe(const std::vector& columns)`` - DataFrameT - pd_dataframe_construct.h:288 - :ref:`View ` * - ``std::string repr() const override`` - std::string - pd_dataframe.h:42323 - :ref:`View ` * - ``inline void reset_option(const std::string& key)`` - void - pd_top_level.h:317 - :ref:`View ` * - ``inline std::string resolve_grouper_level( const Grouper& g, const DataFrame& df, std::shared_ptr& df_ptr)`` - std::string - pd_groupby.h:3967 - * - ``inline std::size_t resolve_level_idx_(const RenameLevelMapper& lm, const std::vector& names)`` - std::size_t - pd_rename_spec_impl.h:79 - * - ``inline std::string resolve_result_dtype( const std::vector& input_dtypes, const std::string& op, bool na_present)`` - std::string - pd_promote.h:920 - :ref:`View ` * - ``inline std::string resolve_series_ctor_target_dtype( const pandas::ApplyResultInference::ScalarKindHistogram& hist, const std::string& src_dtype)`` - std::string - pd_apply_result.h:917 - :ref:`View ` * - ``inline int64_t resolve_string_endpoint_ns(const std::string& date_str, const std::string& side)`` - int64_t - pd_datetime_utils.h:87 - :ref:`View ` * - ``inline std::string resolve_target_dtype( const ValueKindRange& kinds, const pandas::DtypeOverride& override_)`` - std::string - pd_dataframe_construct.h:694 - * - ``numpy::RecordArray result(struct_dtype, {nrows()})`` - numpy::RecordArray - pd_dataframe.h:32017 - :ref:`View ` * - ``Timestamp result(result_utc, "")`` - Timestamp - pd_dateoffset_apply.h:49 - :ref:`View ` * - ``DatetimeIndex result(out, this->name())`` - DatetimeIndex - pd_datetime_index.h:3767 - :ref:`View ` * - ``DatetimeIndex result(std::move(arr), name)`` - DatetimeIndex - pd_datetime_index.h:4387 - :ref:`View ` * - ``DatetimeIndex result(std::move(arr), name)`` - DatetimeIndex - pd_datetime_index.h:4574 - :ref:`View ` * - ``DatetimeIndex result(std::move(arr), name)`` - DatetimeIndex - pd_datetime_index.h:4598 - :ref:`View ` * - ``DatetimeIndex result(std::move(arr), name)`` - DatetimeIndex - pd_datetime_index.h:4627 - :ref:`View ` * - ``DatetimeIndex result(std::move(arr), name)`` - DatetimeIndex - pd_datetime_index.h:4646 - :ref:`View ` * - ``pandas::Series result(result_vals, s.name())`` - pandas::Series - pd_datetime_utils.h:114 - :ref:`View ` * - ``DataFrameGroupBy result(\*df_ptr, col_name, as_index, actual_sort, actual_dropna, actual_observed, group_keys)`` - DataFrameGroupBy - pd_groupby.h:4116 - :ref:`View ` * - ``DataFrameGroupBy result(\*df_ptr, col_name, as_index, actual_sort, actual_dropna, actual_observed, group_keys)`` - DataFrameGroupBy - pd_groupby.h:4128 - :ref:`View ` * - ``DataFrameGroupBy result(\*df_ptr, keys, as_index, sort, dropna, actual_observed, group_keys)`` - DataFrameGroupBy - pd_groupby.h:4232 - :ref:`View ` * - ``std::vector> result(nrows, std::vector(ncols, 0.0))`` - std::vector> - pd_top_level.h:413 - :ref:`View ` * - ``std::vector> results_per_col(value_cols.size())`` - std::vector> - pd_groupby.h:5165 - * - ``std::vector> right_matches(left_n)`` - std::vector> - pd_top_level.h:1965 - * - ``inline int64_t round_ns_1000(double val)`` - int64_t - pd_value_classify.h:66 - :ref:`View ` * - ``inline ExtensionDtypeRouteResult route_extension_dtype(const std::string& dtype_label)`` - ExtensionDtypeRouteResult - pd_extension_dtype_router.h:75 - :ref:`View ` * - ``std::string s(suf)`` - std::string - json.h:279 - :ref:`View ` * - ``std::string s(buf, ptr)`` - std::string - pd_categorical_array.h:2302 - :ref:`View ` * - ``std::string_view s(dtype_label)`` - std::string_view - pd_extension_dtype_router.h:77 - :ref:`View ` * - ``std::string s(buf, ptr)`` - std::string - pd_series.h:172 - :ref:`View ` * - ``DataFrame scalar_op(double scalar, BinaryOp op) const`` - DataFrame - pd_dataframe.h:42492 - * - ``DataFrame scalar_op_with_fill(double scalar, double fill_value, BinaryOp op) const`` - DataFrame - pd_dataframe.h:42516 - * - ``inline PartialKeyResult select_by_first_level(const MultiIndex& mi, const std::string& key)`` - PartialKeyResult - pd_multiindex.h:3282 - :ref:`View ` * - ``DataFrame series_broadcast_op( const Series& other, int axis, std::optional fill_value, Op op, std::optional level = std::nullopt ) const`` - DataFrame - pd_dataframe.h:42757 - * - ``DataFrame series_compare_op( const Series& other, int axis, CompOp op ) const`` - DataFrame - pd_dataframe.h:42861 - * - ``inline Series series_from_coo( const std::vector& data, const std::vector& row_idx, const std::vector& col_idx, int64_t nrows, int64_t ncols, bool dense_index = false)`` - Series - pd_series.h:16394 - :ref:`View ` * - ``inline std::vector> series_to_optional_string_vector(const Series& s)`` - std::vector> - pd_categorical_constructors.h:14 - :ref:`View ` * - ``inline void set_column_resolved( DataFrameT& df, const std::string& name, const ValueKindRange& kinds, const pandas::DtypeOverride& override_ = {})`` - void - pd_dataframe_construct.h:834 - :ref:`View ` * - ``inline void set_eng_float_format(int accuracy = 3, bool use_eng_prefix = true)`` - void - pd_top_level.h:2851 - :ref:`View ` * - ``set_field_value(r, field.first, field.second, index_->get_value_str(r))`` - - pd_dataframe.h:32093 - * - ``set_field_value(r, field.first, field.second, columns_[c]->get_value_str(r))`` - - pd_dataframe.h:32100 - * - ``static void set_max_cols(size_t cols)`` - static void - pd_config.h:26 - :ref:`View ` * - ``static void set_max_rows(size_t rows)`` - static void - pd_config.h:22 - :ref:`View ` * - ``inline void set_multiindex_with_tuple_labels(DataFrameT& df, pandas::MultiIndex mi)`` - void - pd_dataframe_construct.h:419 - :ref:`View ` * - ``static void set_na_repr(const char\* repr)`` - static void - pd_config.h:18 - :ref:`View ` * - ``inline void set_option(const std::string& key, const T& value)`` - void - pd_top_level.h:309 - :ref:`View ` * - ``set_option("display.precision", static_cast(accuracy))`` - - pd_top_level.h:2853 - :ref:`View ` * - ``set_option("display.float_format", std::string("eng"))`` - - pd_top_level.h:2856 - :ref:`View ` * - ``set_option("display.float_format", std::string(""))`` - - pd_top_level.h:2858 - :ref:`View ` * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3018 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3048 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3068 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3088 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3119 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3150 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3185 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3211 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3237 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3263 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3516 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3682 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3695 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3703 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3715 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3723 - * - ``set_result_datetime_index(s)`` - - pd_resampler.h:3732 - * - ``set_result_index(result)`` - - pd_groupby.h:1450 - * - ``set_result_index(result)`` - - pd_groupby.h:1708 - * - ``set_result_index(result)`` - - pd_groupby.h:1876 - * - ``set_result_index(result)`` - - pd_groupby.h:2119 - * - ``set_result_index(result)`` - - pd_groupby.h:2160 - * - ``set_result_index(result)`` - - pd_groupby.h:2213 - * - ``set_result_index(result)`` - - pd_groupby.h:2312 - * - ``set_result_index(result)`` - - pd_groupby.h:2344 - * - ``set_result_index(result)`` - - pd_groupby.h:2406 - * - ``set_result_index(result)`` - - pd_groupby.h:2567 - * - ``set_result_index(result)`` - - pd_groupby.h:2694 - * - ``Rolling setup_time_rolling(const Series& s, const std::string& offset_str, const std::string& closed_str = "", size_t min_periods = 1)`` - Rolling - pd_rolling.h:606 - :ref:`View ` * - ``sheet_order_(std::move(other.sheet_order_))`` - - pd_excel.h:215 - * - ``inline std::string show_versions()`` - std::string - pd_top_level.h:2794 - :ref:`View ` * - ``inline pandas::Series slice_by_ns_range( const pandas::Series& s, const pandas::DatetimeIndex& dti, int64_t start_ns, int64_t end_ns)`` - pandas::Series - pd_datetime_utils.h:93 - :ref:`View ` * - ``inline int snprintf_fixed(char\* buf, std::size_t bufsz, int digits, double v)`` - int - pd_float_array_formatter.h:45 - * - ``inline int snprintf_fixed_series(char\* buf, std::size_t bufsz, int digits, double v)`` - int - pd_series.h:148 - * - ``inline int snprintf_fixed_signspace(char\* buf, std::size_t bufsz, int digits, double v)`` - int - pd_float_array_formatter.h:60 - * - ``inline std::string sparse_dtype_name()`` - std::string - pd_sparse_dtype.h:23 - * - ``std::vector> sparsified(n_levels)`` - std::vector> - pd_display_formats.h:126 - * - ``inline std::vector> sparsify_labels( const std::vector>& index_level_values)`` - std::vector> - pd_display_formats.h:121 - :ref:`View ` * - ``inline ComplexParts split_complex_str(const std::string& s)`` - ComplexParts - pd_series.h:103 - * - ``std::ofstream sql_file(sql_file_path)`` - std::ofstream - pd_dataframe.h:30423 - * - ``std::istringstream ss(props)`` - std::istringstream - pd_styler.h:989 - :ref:`View ` * - ``std::istringstream ss(props)`` - std::istringstream - pd_styler.h:1038 - :ref:`View ` * - ``std::istringstream ss(props)`` - std::istringstream - pd_styler.h:1114 - :ref:`View ` * - ``std::istringstream ss(props)`` - std::istringstream - pd_styler.h:1186 - :ref:`View ` * - ``std::istringstream ss(props)`` - std::istringstream - pd_styler.h:1257 - :ref:`View ` * - ``inline bool starts_with(std::string_view s, std::string_view p)`` - bool - pd_dtype_override.h:63 - * - ``inline bool starts_with(std::string_view s, std::string_view prefix)`` - bool - pd_extension_dtype_router.h:54 - * - ``static_assert(std::is_floating_point_v, "FloatingArray requires a floating-point type")`` - class FloatingArray { - pd_floating_array.h:42 - :ref:`View ` * - ``static_assert(std::is_floating_point_v, "FloatingDtype requires a floating-point type")`` - class FloatingDtype : public ExtensionDtype { - pd_floating_dtype.h:26 - :ref:`View ` * - ``static_assert(std::is_integral_v, "IntegerArray requires an integral type")`` - class IntegerArray { - pd_integer_array.h:39 - :ref:`View ` * - ``static_assert(std::is_integral_v, "IntegerDtype requires an integral type")`` - class IntegerDtype : public ExtensionDtype { - pd_integer_dtype.h:24 - :ref:`View ` * - ``static_assert(std::is_arithmetic_v, "IntervalArray requires an arithmetic type")`` - class IntervalArray { - pd_interval_array.h:45 - :ref:`View ` * - ``static_assert(std::is_arithmetic_v, "IntervalDtype requires an arithmetic type")`` - class IntervalDtype : public ExtensionDtype { - pd_interval_dtype.h:77 - :ref:`View ` * - ``static_assert(std::is_arithmetic_v, "Interval requires an arithmetic type")`` - class Interval { - pd_interval_dtype.h:240 - :ref:`View ` * - ``static_assert(std::is_arithmetic_v, "IntervalIndex requires an arithmetic type")`` - class IntervalIndex : public ExtensionIndex> { - pd_interval_index.h:43 - :ref:`View ` * - ``inline StorageFamily storage_family_of(const std::string& storage_name)`` - StorageFamily - pd_dtype_classify.h:221 - * - ``HDF5Store store(path_or_buf, hdf_mode)`` - HDF5Store - pd_dataframe.h:29969 - :ref:`View ` * - ``HDF5Store store(path, "r")`` - HDF5Store - pd_dataframe.h:38296 - :ref:`View ` * - ``std::vector> str_cols(ncols)`` - std::vector> - pd_dataframe.h:44639 - * - ``numpy::str64 str_field(str_val)`` - numpy::str64 - pd_dataframe.h:32074 - * - ``numpy::str64 str_field(str_val)`` - numpy::str64 - pd_dataframe.h:32081 - * - ``std::istringstream stream(csv_content)`` - std::istringstream - pd_dataframe.h:34845 - * - ``inline Styler style() const`` - inline Styler - pd_dataframe.h:42967 - :ref:`View ` * - ``pandas::Timedelta td(s)`` - pandas::Timedelta - pd_timedelta_index.h:3331 - :ref:`View ` * - ``pandas::Timedelta td(s)`` - pandas::Timedelta - pd_top_level.h:2643 - :ref:`View ` * - ``inline int td64_frac_digits(Timedelta64Resolution r)`` - int - pd_timedelta64_formatter.h:42 - * - ``inline std::int64_t td64_ticks_per_second(Timedelta64Resolution r)`` - std::int64_t - pd_timedelta64_formatter.h:32 - * - ``throw_invoke_unsupported("invoke_with_dataframe")`` - - pd_dataframe.h:43209 - * - ``inline int64_t time_unit_factor(numpy::DateTimeUnit unit)`` - int64_t - pd_dataframe_construct.h:41 - :ref:`View ` * - ``inline int64_t timedelta64_to_ns(const numpy::timedelta64& td)`` - int64_t - pd_dataframe_construct.h:64 - :ref:`View ` * - ``inline std::vector> timedelta_index_to_ns_values(const TimedeltaIndexT& tdi)`` - std::vector> - pd_dataframe_construct.h:96 - * - ``inline TimedeltaIndex timedelta_range( const std::optional& start = std::nullopt, const std::optional& end = std::nullopt, std::optional periods = std::nullopt, const std::string& freq = "D", const std::optional& name = std::nullopt, const std::string& closed = "both", const std::string& unit = "ns")`` - TimedeltaIndex - pd_timedelta_index.h:3272 - :ref:`View ` * - ``timegm(&tm)`` - - pd_holiday.h:66 - * - ``inline std::vector tokenize_eval(const std::string& expr)`` - std::vector - pd_dataframe.h:443 - * - ``inline std::string_view trim(std::string_view s)`` - std::string_view - pd_dtype_override.h:68 - :ref:`View ` * - ``inline void trim_zeros_column(std::vector& vals)`` - void - pd_series.h:265 - * - ``trim_zeros_column(vals)`` - - pd_series.h:367 - * - ``inline std::vector truncate_indices(size_t len, size_t max_display)`` - std::vector - pd_display_formats.h:19 - * - ``try_stamp("object")`` - - pd_resampler.h:3532 - * - ``try_stamp(result_dtype)`` - - pd_resampler.h:3534 - * - ``pandas::Timestamp ts(h)`` - pandas::Timestamp - pd_datetime_index.h:4464 - :ref:`View ` * - ``pandas::Timestamp ts(s)`` - pandas::Timestamp - pd_datetime_index.h:4492 - :ref:`View ` * - ``pandas::Timestamp ts(year[i], month[i], day[i], h, m, s, 0, 0, "")`` - pandas::Timestamp - pd_top_level.h:2602 - :ref:`View ` * - ``pandas::Timestamp ts_obj(year, month, day, hour, minute, second, 0, 0, "")`` - pandas::Timestamp - pd_top_level.h:2372 - * - ``pandas::Timestamp ts_obj(parse_str)`` - pandas::Timestamp - pd_top_level.h:2379 - * - ``pandas::Timestamp ts_obj(s)`` - pandas::Timestamp - pd_top_level.h:2542 - * - ``pandas::Timestamp ts_obj(year, month, day, tm.tm_hour, tm.tm_min, tm.tm_sec, 0, 0, "")`` - pandas::Timestamp - pd_top_level.h:2556 - * - ``std::string u(abbr)`` - std::string - pd_groupby.h:3428 - * - ``std::string u(abbr)`` - std::string - pd_groupby.h:3437 - * - ``DataFrame unary_op(UnaryOp op) const`` - DataFrame - pd_dataframe.h:42464 - * - ``inline std::string undefined_variable(const std::string& name)`` - std::string - pd_exceptions.h:394 - :ref:`View ` * - ``inline std::string undefined_variable_in_query(const std::string& name)`` - std::string - pd_exceptions.h:402 - :ref:`View ` * - ``inline int64_t unit_string_to_ns_multiplier( const std::string& unit, UnitDefault when_empty)`` - int64_t - pd_top_level.h:2436 - :ref:`View ` * - ``inline std::string unknown_interpolation_method(const std::string& method)`` - std::string - pd_exceptions.h:271 - :ref:`View ` * - ``inline std::string unsorted_index(const std::string& key)`` - std::string - pd_exceptions.h:407 - :ref:`View ` * - ``inline std::string unsorted_index_key_vs_depth(size_t key_len, size_t lexsort_depth)`` - std::string - pd_exceptions.h:424 - :ref:`View ` * - ``inline std::string unsupported_binop(const std::string& op, const std::string& lhs, const std::string& rhs)`` - std::string - pd_exceptions.h:342 - :ref:`View ` * - ``inline std::string unsupported_dtype(const std::string& dt)`` - std::string - pd_exceptions.h:364 - :ref:`View ` * - ``inline std::string unsupported_dtype_for_multiindex(const std::string& dt)`` - std::string - pd_exceptions.h:379 - :ref:`View ` * - ``inline std::string unsupported_dtype_quoted(const std::string& dt, const std::string& supported_list)`` - std::string - pd_exceptions.h:367 - :ref:`View ` * - ``inline std::string unsupported_op(const std::string& op, const std::string& dtype)`` - std::string - pd_exceptions.h:296 - :ref:`View ` * - ``std::regex us_date_re(R"(^(\\d{1,2})/(\\d{1,2})/(\\d{2,4})$)")`` - std::regex - pd_period_ordinal_utils.h:585 - * - ``inline std::vector us_federal_holiday_rules()`` - std::vector - pd_holiday.h:186 - * - ``std::vector> valid_counts(nrows, std::vector(ncols, 0))`` - std::vector> - pd_top_level.h:420 - * - ``static const char\* version()`` - static const char\* - pd_config.h:9 - :ref:`View ` * - ``inline int weekday_abbr_to_num(const std::string& abbr)`` - int - pd_groupby.h:3435 - * - ``inline int weekday_index(const std::string& abbr)`` - int - pd_dateoffset_freq_parse.h:65 - * - ``inline DataFrame wide_to_long( const DataFrame& df, const std::vector& stubnames, const std::vector& i, const std::string& j, const std::string& sep = "", const std::string& suffix = "\\\\d+")`` - DataFrame - pd_top_level.h:1651 - :ref:`View ` * - ``write_byte(static_cast(data_label.length()))`` - - pd_dataframe.h:32542 - * - ``write_byte(static_cast(c))`` - - pd_dataframe.h:32545 - * - ``write_byte(static_cast(ts.length()))`` - - pd_dataframe.h:32561 - * - ``write_byte(static_cast(c))`` - - pd_dataframe.h:32563 - * - ``write_byte(static_cast(missing_int8))`` - - pd_dataframe.h:32703 - * - ``write_byte(static_cast(static_cast(val)))`` - - pd_dataframe.h:32706 - * - ``write_byte(0)`` - - pd_dataframe.h:32800 - * - ``write_byte(0)`` - - pd_dataframe.h:32801 - * - ``write_byte(0)`` - - pd_dataframe.h:32802 - * - ``write_byte(static_cast(c))`` - - pd_dataframe.h:32825 - * - ``write_byte(big_endian ? 0x01 : 0x02)`` - - pd_dataframe.h:32866 - * - ``write_byte(0x01)`` - - pd_dataframe.h:32869 - * - ``write_byte(0x00)`` - - pd_dataframe.h:32872 - * - ``write_byte(static_cast(col.stata_type))`` - - pd_dataframe.h:32899 - * - ``write_byte(static_cast(col.stata_type))`` - - pd_dataframe.h:32901 - * - ``write_byte(0x00)`` - - pd_dataframe.h:32940 - * - ``write_byte(static_cast(missing_int8))`` - - pd_dataframe.h:32988 - * - ``write_byte(static_cast(static_cast(val)))`` - - pd_dataframe.h:32991 - * - ``write_byte(0)`` - - pd_dataframe.h:33059 - * - ``write_byte(static_cast(c))`` - - pd_dataframe.h:33073 - * - ``write_byte(0)`` - - pd_dataframe.h:33075 - * - ``write_field_header(page_header, 1, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29316 - * - ``write_field_header(page_header, 2, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29320 - * - ``write_field_header(page_header, 3, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29324 - * - ``write_field_header(page_header, 5, THRIFT_STRUCT, prev_fid)`` - - pd_dataframe.h:29328 - * - ``write_field_header(page_header, 1, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29332 - * - ``write_field_header(page_header, 2, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29335 - * - ``write_field_header(page_header, 3, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29338 - * - ``write_field_header(page_header, 4, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29341 - * - ``write_field_header(page_header, 1, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29459 - * - ``write_field_header(page_header, 2, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29463 - * - ``write_field_header(page_header, 3, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29467 - * - ``write_field_header(page_header, 5, THRIFT_STRUCT, prev_fid)`` - - pd_dataframe.h:29471 - * - ``write_field_header(page_header, 1, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29474 - * - ``write_field_header(page_header, 2, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29476 - * - ``write_field_header(page_header, 3, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29478 - * - ``write_field_header(page_header, 4, THRIFT_I32, prev_dph)`` - - pd_dataframe.h:29480 - * - ``write_field_header(metadata, 1, THRIFT_I32, prev_fid)`` - - pd_dataframe.h:29506 - * - ``write_field_header(metadata, 2, THRIFT_LIST, prev_fid)`` - - pd_dataframe.h:29510 - * - ``write_field_header(metadata, 4, THRIFT_BINARY, prev_se)`` - - pd_dataframe.h:29518 - * - ``write_field_header(metadata, 6, THRIFT_I32, prev_se)`` - - pd_dataframe.h:29521 - * - ``write_field_header(metadata, 1, THRIFT_I32, prev_se)`` - - pd_dataframe.h:29530 - * - ``write_field_header(metadata, 4, THRIFT_BINARY, prev_se)`` - - pd_dataframe.h:29533 - * - ``write_field_header(metadata, 7, THRIFT_I32, prev_se)`` - - pd_dataframe.h:29537 - * - ``write_field_header(metadata, 3, THRIFT_I64, prev_fid)`` - - pd_dataframe.h:29543 - * - ``write_field_header(metadata, 4, THRIFT_LIST, prev_fid)`` - - pd_dataframe.h:29547 - * - ``write_field_header(metadata, 1, THRIFT_LIST, prev_rg)`` - - pd_dataframe.h:29555 - * - ``write_field_header(metadata, 2, THRIFT_I64, prev_cc)`` - - pd_dataframe.h:29562 - * - ``write_field_header(metadata, 3, THRIFT_STRUCT, prev_cc)`` - - pd_dataframe.h:29566 - * - ``write_field_header(metadata, 1, THRIFT_I32, prev_cm)`` - - pd_dataframe.h:29571 - * - ``write_field_header(metadata, 2, THRIFT_LIST, prev_cm)`` - - pd_dataframe.h:29575 - * - ``write_field_header(metadata, 3, THRIFT_LIST, prev_cm)`` - - pd_dataframe.h:29580 - * - ``write_field_header(metadata, 4, THRIFT_I32, prev_cm)`` - - pd_dataframe.h:29585 - * - ``write_field_header(metadata, 5, THRIFT_I64, prev_cm)`` - - pd_dataframe.h:29589 - * - ``write_field_header(metadata, 6, THRIFT_I64, prev_cm)`` - - pd_dataframe.h:29593 - * - ``write_field_header(metadata, 7, THRIFT_I64, prev_cm)`` - - pd_dataframe.h:29597 - * - ``write_field_header(metadata, 9, THRIFT_I64, prev_cm)`` - - pd_dataframe.h:29601 - * - ``write_field_header(metadata, 2, THRIFT_I64, prev_rg)`` - - pd_dataframe.h:29611 - * - ``write_field_header(metadata, 3, THRIFT_I64, prev_rg)`` - - pd_dataframe.h:29615 - * - ``write_field_header(metadata, 5, THRIFT_LIST, prev_fid)`` - - pd_dataframe.h:29622 - * - ``write_field_header(metadata, 1, THRIFT_BINARY, prev_kv)`` - - pd_dataframe.h:29626 - * - ``write_field_header(metadata, 2, THRIFT_BINARY, prev_kv)`` - - pd_dataframe.h:29628 - * - ``write_field_header(metadata, 6, THRIFT_BINARY, prev_fid)`` - - pd_dataframe.h:29634 - * - ``write_flatbuf_string(fields_data, name)`` - - pd_dataframe.h:39751 - * - ``write_float32(missing_f)`` - - pd_dataframe.h:32729 - * - ``write_float32(static_cast(val))`` - - pd_dataframe.h:32732 - * - ``write_float32(missing_f)`` - - pd_dataframe.h:33011 - * - ``write_float32(static_cast(val))`` - - pd_dataframe.h:33014 - * - ``write_float64(val)`` - - pd_dataframe.h:32689 - * - ``write_float64(missing_d)`` - - pd_dataframe.h:32739 - * - ``write_float64(stata_ms)`` - - pd_dataframe.h:32745 - * - ``write_float64(val)`` - - pd_dataframe.h:32748 - * - ``write_float64(val)`` - - pd_dataframe.h:32977 - * - ``write_float64(missing_d)`` - - pd_dataframe.h:33020 - * - ``write_float64(stata_ms)`` - - pd_dataframe.h:33025 - * - ``write_float64(val)`` - - pd_dataframe.h:33028 - * - ``write_int16(missing_int16)`` - - pd_dataframe.h:32711 - * - ``write_int16(static_cast(val))`` - - pd_dataframe.h:32714 - * - ``write_int16(static_cast(nvar))`` - - pd_dataframe.h:32875 - * - ``write_int16(0)`` - - pd_dataframe.h:32916 - * - ``write_int16(missing_int16)`` - - pd_dataframe.h:32995 - * - ``write_int16(static_cast(val))`` - - pd_dataframe.h:32998 - * - ``write_int32(missing_int32)`` - - pd_dataframe.h:32682 - * - ``write_int32(static_cast(val))`` - - pd_dataframe.h:32684 - * - ``write_int32(missing_int32)`` - - pd_dataframe.h:32719 - * - ``write_int32(static_cast(val))`` - - pd_dataframe.h:32722 - * - ``write_int32(lbl_len)`` - - pd_dataframe.h:32794 - * - ``write_int32(static_cast(labels.size()))`` - - pd_dataframe.h:32805 - * - ``write_int32(static_cast(txt_len))`` - - pd_dataframe.h:32808 - * - ``write_int32(offset)`` - - pd_dataframe.h:32813 - * - ``write_int32(val)`` - - pd_dataframe.h:32819 - * - ``write_int32(static_cast(nobs))`` - - pd_dataframe.h:32878 - * - ``write_int32(static_cast(val))`` - - pd_dataframe.h:32974 - * - ``write_int32(missing_int32)`` - - pd_dataframe.h:33002 - * - ``write_int32(static_cast(val))`` - - pd_dataframe.h:33005 - * - ``write_int32(lbl_len)`` - - pd_dataframe.h:33057 - * - ``write_int32(static_cast(labels.size()))`` - - pd_dataframe.h:33060 - * - ``write_int32(static_cast(txt_len))`` - - pd_dataframe.h:33061 - * - ``write_int32(offset)`` - - pd_dataframe.h:33065 - * - ``write_int32(val)`` - - pd_dataframe.h:33069 - * - ``write_int64(range_idx->start())`` - - pd_dataframe.h:29790 - * - ``write_int64(range_idx->stop())`` - - pd_dataframe.h:29791 - * - ``write_int64(range_idx->step())`` - - pd_dataframe.h:29792 - * - ``write_int64(static_cast(nobs))`` - - pd_dataframe.h:32530 - * - ``write_le32(body_buffer, static_cast(val))`` - - pd_dataframe.h:39565 - * - ``write_le32(body_buffer, static_cast(bits))`` - - pd_dataframe.h:39587 - * - ``write_le32(body_buffer, current_offset)`` - - pd_dataframe.h:39644 - * - ``write_le32(body_buffer, current_offset)`` - - pd_dataframe.h:39647 - * - ``write_le32(fields_data, bit_width)`` - - pd_dataframe.h:39762 - * - ``write_le32(feather_bytes, metadata_size)`` - - pd_dataframe.h:40158 - * - ``write_le32(feather_bytes, static_cast(rb_message.size()))`` - - pd_dataframe.h:40254 - * - ``write_le32(feather_bytes, footer_size)`` - - pd_dataframe.h:40319 - * - ``write_le64(body_buffer, val)`` - - pd_dataframe.h:39567 - * - ``write_le64(body_buffer, static_cast(bits))`` - - pd_dataframe.h:39601 - * - ``write_le64(body_buffer, val)`` - - pd_dataframe.h:39629 - * - ``write_list_header(metadata, column_chunks.size(), THRIFT_STRUCT)`` - - pd_dataframe.h:29556 - * - ``write_list_header(metadata, 1, THRIFT_I32)`` - - pd_dataframe.h:29576 - * - ``write_list_header(metadata, 1, THRIFT_BINARY)`` - - pd_dataframe.h:29581 - * - ``write_list_header(metadata, 1, THRIFT_STRUCT)`` - - pd_dataframe.h:29623 - * - ``write_string(metadata, "schema")`` - - pd_dataframe.h:29519 - * - ``write_string(metadata, column_chunks[i].col_name)`` - - pd_dataframe.h:29534 - * - ``write_string(metadata, cc.col_name)`` - - pd_dataframe.h:29582 - * - ``write_string(metadata, "pandas")`` - - pd_dataframe.h:29627 - * - ``write_string(metadata, "{}")`` - - pd_dataframe.h:29629 - * - ``write_string(metadata, "PandasCore C++ Library")`` - - pd_dataframe.h:29635 - * - ``write_string(range_idx->name().value())`` - - pd_dataframe.h:29794 - * - ``write_string(index_->get_value_str(i))`` - - pd_dataframe.h:29803 - * - ``write_string(index_->name().value())`` - - pd_dataframe.h:29807 - * - ``write_string(columns_index_.get_value_str(c))`` - - pd_dataframe.h:29818 - * - ``write_string(dtype)`` - - pd_dataframe.h:29822 - * - ``write_string(val_str)`` - - pd_dataframe.h:29833 - * - ``write_string(name, varname_len)`` - - pd_dataframe.h:32593 - * - ``write_string(col.format, format_len)`` - - pd_dataframe.h:32609 - * - ``write_string(col.name, varname_len)`` - - pd_dataframe.h:32619 - * - ``write_string("", varname_len)`` - - pd_dataframe.h:32621 - * - ``write_string(col.label, varlabel_len)`` - - pd_dataframe.h:32630 - * - ``write_string(idx_str, col.stata_type)`` - - pd_dataframe.h:32692 - * - ``write_string(val, col.stata_type)`` - - pd_dataframe.h:32753 - * - ``write_string(col.name, varname_len)`` - - pd_dataframe.h:32797 - * - ``write_string(data_label, 81)`` - - pd_dataframe.h:32881 - * - ``write_string(ts, 18)`` - - pd_dataframe.h:32893 - * - ``write_string(name, 33)`` - - pd_dataframe.h:32911 - * - ``write_string(col.format, 49)`` - - pd_dataframe.h:32921 - * - ``write_string(col.name, 33)`` - - pd_dataframe.h:32927 - * - ``write_string("", 33)`` - - pd_dataframe.h:32929 - * - ``write_string(col.label, 81)`` - - pd_dataframe.h:32935 - * - ``write_string(idx_str, col.stata_type)`` - - pd_dataframe.h:32979 - * - ``write_string(val, col.stata_type)`` - - pd_dataframe.h:33032 - * - ``write_string(col.name, 33)`` - - pd_dataframe.h:33058 - * - ``write_tag("")`` - - pd_dataframe.h:32505 - * - ``write_tag("
")`` - - pd_dataframe.h:32506 - * - ``write_tag("")`` - - pd_dataframe.h:32509 - * - ``write_tag(std::to_string(version))`` - - pd_dataframe.h:32510 - * - ``write_tag("")`` - - pd_dataframe.h:32511 - * - ``write_tag("")`` - - pd_dataframe.h:32514 - * - ``write_tag(big_endian ? "MSF" : "LSF")`` - - pd_dataframe.h:32515 - * - ``write_tag("")`` - - pd_dataframe.h:32516 - * - ``write_tag("")`` - - pd_dataframe.h:32519 - * - ``write_tag("")`` - - pd_dataframe.h:32525 - * - ``write_tag("")`` - - pd_dataframe.h:32528 - * - ``write_tag("")`` - - pd_dataframe.h:32534 - * - ``write_tag("")`` - - pd_dataframe.h:32547 - * - ``write_tag("")`` - - pd_dataframe.h:32550 - * - ``write_tag("")`` - - pd_dataframe.h:32565 - * - ``write_tag("
")`` - - pd_dataframe.h:32567 - * - ``write_tag("")`` - - pd_dataframe.h:32571 - * - ``write_tag("")`` - - pd_dataframe.h:32575 - * - ``write_tag("")`` - - pd_dataframe.h:32579 - * - ``write_tag("")`` - - pd_dataframe.h:32583 - * - ``write_tag("")`` - - pd_dataframe.h:32587 - * - ``write_tag("")`` - - pd_dataframe.h:32595 - * - ``write_tag("")`` - - pd_dataframe.h:32599 - * - ``write_tag("")`` - - pd_dataframe.h:32603 - * - ``write_tag("")`` - - pd_dataframe.h:32607 - * - ``write_tag("")`` - - pd_dataframe.h:32611 - * - ``write_tag("")`` - - pd_dataframe.h:32615 - * - ``write_tag("")`` - - pd_dataframe.h:32624 - * - ``write_tag("")`` - - pd_dataframe.h:32628 - * - ``write_tag("")`` - - pd_dataframe.h:32632 - * - ``write_tag("")`` - - pd_dataframe.h:32636 - * - ``write_tag("")`` - - pd_dataframe.h:32637 - * - ``write_tag("")`` - - pd_dataframe.h:32641 - * - ``write_tag("")`` - - pd_dataframe.h:32758 - * - ``write_tag("")`` - - pd_dataframe.h:32762 - * - ``write_tag("")`` - - pd_dataframe.h:32763 - * - ``write_tag("")`` - - pd_dataframe.h:32767 - * - ``write_tag("")`` - - pd_dataframe.h:32778 - * - ``write_tag("")`` - - pd_dataframe.h:32830 - * - ``write_tag("")`` - - pd_dataframe.h:32835 - * - ``write_tag("
")`` - - pd_dataframe.h:32839 - * - ``write_u16(static_cast(entry.name.size()))`` - - pd_excel.h:560 - * - ``write_u16(static_cast(entry.name.size()))`` - - pd_excel.h:583 - * - ``write_u16(static_cast(zip_entries.size()))`` - - pd_excel.h:600 - * - ``write_u16(static_cast(zip_entries.size()))`` - - pd_excel.h:601 - * - ``write_u32(LOCAL_FILE_HEADER_SIG)`` - - pd_excel.h:551 - * - ``write_u32(crc32(entry.data))`` - - pd_excel.h:557 - * - ``write_u32(static_cast(entry.data.size()))`` - - pd_excel.h:558 - * - ``write_u32(static_cast(entry.data.size()))`` - - pd_excel.h:559 - * - ``write_u32(CENTRAL_DIR_HEADER_SIG)`` - - pd_excel.h:573 - * - ``write_u32(crc32(entry.data))`` - - pd_excel.h:580 - * - ``write_u32(static_cast(entry.data.size()))`` - - pd_excel.h:581 - * - ``write_u32(static_cast(entry.data.size()))`` - - pd_excel.h:582 - * - ``write_u32(local_header_offsets[i])`` - - pd_excel.h:589 - * - ``write_u32(END_OF_CENTRAL_DIR_SIG)`` - - pd_excel.h:597 - * - ``write_u32(central_dir_size)`` - - pd_excel.h:602 - * - ``write_u32(central_dir_start)`` - - pd_excel.h:603 - * - ``write_uint16(nvar)`` - - pd_dataframe.h:32523 - * - ``write_uint16(static_cast(data_label.length()))`` - - pd_dataframe.h:32540 - * - ``write_uint16(col.stata_type)`` - - pd_dataframe.h:32581 - * - ``write_uint16(0)`` - - pd_dataframe.h:32601 - * - ``write_uint32(static_cast(str.size()))`` - - pd_dataframe.h:29778 - * - ``write_uint32(0)`` - - pd_dataframe.h:29809 - * - ``write_uint32(static_cast(ncols()))`` - - pd_dataframe.h:29814 - * - ``write_uint32(static_cast(nvar))`` - - pd_dataframe.h:32521 - * - ``write_uint32(static_cast(nobs))`` - - pd_dataframe.h:32532 - * - ``write_uint64(index_->size())`` - - pd_dataframe.h:29801 - * - ``write_uint64(n)`` - - pd_dataframe.h:29826 - * - ``write_varint(encoded)`` - - pd_dataframe.h:28575 - * - ``write_varint(data.size())`` - - pd_dataframe.h:28590 - * - ``write_varint(str.size())`` - - pd_dataframe.h:28596 - * - ``write_zigzag_to(page_header, 0)`` - - pd_dataframe.h:29317 - * - ``write_zigzag_to(page_header, static_cast(page_data.size()))`` - - pd_dataframe.h:29321 - * - ``write_zigzag_to(page_header, static_cast(page_data.size()))`` - - pd_dataframe.h:29325 - * - ``write_zigzag_to(page_header, static_cast(nrows()))`` - - pd_dataframe.h:29333 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29336 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29339 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29342 - * - ``write_zigzag_to(page_header, 0)`` - - pd_dataframe.h:29460 - * - ``write_zigzag_to(page_header, static_cast(page_data.size()))`` - - pd_dataframe.h:29464 - * - ``write_zigzag_to(page_header, static_cast(page_data.size()))`` - - pd_dataframe.h:29468 - * - ``write_zigzag_to(page_header, static_cast(nrows()))`` - - pd_dataframe.h:29475 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29477 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29479 - * - ``write_zigzag_to(page_header, ENCODING_PLAIN)`` - - pd_dataframe.h:29481 - * - ``write_zigzag_to(metadata, static_cast(total_cols))`` - - pd_dataframe.h:29522 - * - ``write_zigzag_to(metadata, column_chunks[i].parquet_type)`` - - pd_dataframe.h:29531 - * - ``write_zigzag_to(metadata, static_cast(nrows()))`` - - pd_dataframe.h:29544 - * - ``write_zigzag_to(metadata, cc.file_offset)`` - - pd_dataframe.h:29563 - * - ``write_zigzag_to(metadata, cc.parquet_type)`` - - pd_dataframe.h:29572 - * - ``write_zigzag_to(metadata, ENCODING_PLAIN)`` - - pd_dataframe.h:29577 - * - ``write_zigzag_to(metadata, COMPRESSION_UNCOMPRESSED)`` - - pd_dataframe.h:29586 - * - ``write_zigzag_to(metadata, cc.num_values)`` - - pd_dataframe.h:29590 - * - ``write_zigzag_to(metadata, cc.total_size)`` - - pd_dataframe.h:29594 - * - ``write_zigzag_to(metadata, cc.total_size)`` - - pd_dataframe.h:29598 - * - ``write_zigzag_to(metadata, cc.file_offset)`` - - pd_dataframe.h:29602 - * - ``write_zigzag_to(metadata, row_group_total_size)`` - - pd_dataframe.h:29612 - * - ``write_zigzag_to(metadata, static_cast(nrows()))`` - - pd_dataframe.h:29616 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_dataframe.h:36926 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_dataframe.h:36981 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_dataframe.h:37024 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_dataframe.h:37073 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_excel.h:1048 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_excel.h:1071 - * - ``std::string xml(entry.data.begin(), entry.data.end())`` - std::string - pd_excel.h:1148 - * - ``std::regex year_re(R"(^(\\d{4})$)")`` - std::regex - pd_period_ordinal_utils.h:526 - * - ``inline int64_t ymd_to_day_ord(int y, int m, int d)`` - int64_t - pd_groupby.h:3267 - * - ``zip_entries_(std::move(other.zip_entries_))`` - - pd_excel.h:944 - Code Examples ------------- The following examples are extracted from the test suite. .. _example-top_level-to_clipboard-0: .. dropdown:: to_clipboard (pd_test_2_all.cpp:10176) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10166 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_swaplevel test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_swaplevel.cpp (end) ----------------------------- // ------------------- pd_test_to_clipboard.cpp (start) ----------------------------- // pd_test_to_clipboard.cpp // Tests for DataFrame.to_clipboard() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_datetime-1: .. dropdown:: to_datetime (pd_test_3_all.cpp:13652) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13642 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // To Datetime / To Timedelta Tests // ============================================================================ void pd_test_top_level_to_datetime() { std::cout << "========= to_datetime() ==============================="; std::vector dates = { "2023-01-15", "2023-06-20", "2023-12-31" }; pandas::DatetimeArray result = pandas::to_datetime(dates); if (result.size() != 3) { .. _example-top_level-to_datetime-2: .. dropdown:: to_datetime (pd_test_3_all.cpp:13652) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13642 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // To Datetime / To Timedelta Tests // ============================================================================ void pd_test_top_level_to_datetime() { std::cout << "========= to_datetime() ==============================="; std::vector dates = { "2023-01-15", "2023-06-20", "2023-12-31" }; pandas::DatetimeArray result = pandas::to_datetime(dates); if (result.size() != 3) { .. _example-top_level-to_datetime_from_columns-3: .. dropdown:: to_datetime_from_columns (pd_test_2_all.cpp:22794) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22784 :emphasize-lines: 11 // ===================================================================== // DataFrame column assembly tests // ===================================================================== void test_to_datetime_from_columns_basic() { std::cout << " -- test_to_datetime_from_columns_basic --" << std::endl; std::vector years = {2020, 2021, 2022}; std::vector months = {1, 6, 12}; std::vector days = {15, 20, 25}; auto arr = pandas::to_datetime_from_columns(years, months, days); check(arr.size() == 3, "size==3"); auto v0 = arr[0]; check(v0.has_value(), "v0_has_value"); if (v0.has_value()) { pandas::Timestamp ts(v0->getValue()); check(ts.year() == 2020, "v0_year==2020"); check(ts.month() == 1, "v0_month==1"); check(ts.day() == 15, "v0_day==15"); check(ts.hour() == 0, "v0_hour==0"); .. _example-top_level-to_datetime_mixed-4: .. dropdown:: to_datetime_mixed (pd_test_2_all.cpp:22721) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22711 :emphasize-lines: 11 check(ns_frac == 500000000LL, "fractional==500ms"); } // ===================================================================== // Mixed format tests // ===================================================================== void test_to_datetime_mixed_iso() { std::cout << " -- test_to_datetime_mixed_iso --" << std::endl; std::vector vals = {"2020-01-01", "2020/06/15"}; auto arr = pandas::to_datetime_mixed(vals); check(arr.size() == 2, "size==2"); auto v0 = arr[0]; check(v0.has_value(), "v0_has_value"); if (v0.has_value()) { pandas::Timestamp ts(v0->getValue()); check(ts.year() == 2020, "v0_year==2020"); check(ts.month() == 1, "v0_month==1"); check(ts.day() == 1, "v0_day==1"); } auto v1 = arr[1]; .. _example-top_level-to_datetime_numeric-5: .. dropdown:: to_datetime_numeric (pd_test_2_all.cpp:22585) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22575 :emphasize-lines: 11 } // ===================================================================== // Numeric epoch tests // ===================================================================== void test_to_datetime_numeric_seconds() { std::cout << " -- test_to_datetime_numeric_seconds --" << std::endl; // 1490195805 seconds = 2017-03-22 15:16:45 UTC std::vector vals = {1490195805.0}; auto arr = pandas::to_datetime_numeric(vals, "s"); check(arr.size() == 1, "size==1"); auto v = arr[0]; check(v.has_value(), "has_value"); if (v.has_value()) { pandas::Timestamp ts(v->getValue()); check(ts.year() == 2017, "year==2017"); check(ts.month() == 3, "month==3"); check(ts.day() == 22, "day==22"); check(ts.hour() == 15, "hour==15"); check(ts.minute() == 16, "min==16"); .. _example-top_level-to_datetime_numeric-6: .. dropdown:: to_datetime_numeric (pd_test_2_all.cpp:22585) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22575 :emphasize-lines: 11 } // ===================================================================== // Numeric epoch tests // ===================================================================== void test_to_datetime_numeric_seconds() { std::cout << " -- test_to_datetime_numeric_seconds --" << std::endl; // 1490195805 seconds = 2017-03-22 15:16:45 UTC std::vector vals = {1490195805.0}; auto arr = pandas::to_datetime_numeric(vals, "s"); check(arr.size() == 1, "size==1"); auto v = arr[0]; check(v.has_value(), "has_value"); if (v.has_value()) { pandas::Timestamp ts(v->getValue()); check(ts.year() == 2017, "year==2017"); check(ts.month() == 3, "month==3"); check(ts.day() == 22, "day==22"); check(ts.hour() == 15, "hour==15"); check(ts.minute() == 16, "min==16"); .. _example-top_level-to_datetime_scalar-7: .. dropdown:: to_datetime_scalar (pd_test_2_all.cpp:22696) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22686 :emphasize-lines: 11 } } // ===================================================================== // Scalar epoch tests // ===================================================================== void test_to_datetime_scalar_int() { std::cout << " -- test_to_datetime_scalar_int --" << std::endl; // 1490195805 seconds auto ts = pandas::to_datetime_scalar(static_cast(1490195805), "s"); check(ts.year() == 2017, "year==2017"); check(ts.month() == 3, "month==3"); check(ts.day() == 22, "day==22"); check(ts.hour() == 15, "hour==15"); } void test_to_datetime_scalar_float() { std::cout << " -- test_to_datetime_scalar_float --" << std::endl; // 1.5 seconds = 1500000000 ns from epoch auto ts = pandas::to_datetime_scalar(1.5, "s"); .. _example-top_level-to_datetime_scalar-8: .. dropdown:: to_datetime_scalar (pd_test_2_all.cpp:22696) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22686 :emphasize-lines: 11 } } // ===================================================================== // Scalar epoch tests // ===================================================================== void test_to_datetime_scalar_int() { std::cout << " -- test_to_datetime_scalar_int --" << std::endl; // 1490195805 seconds auto ts = pandas::to_datetime_scalar(static_cast(1490195805), "s"); check(ts.year() == 2017, "year==2017"); check(ts.month() == 3, "month==3"); check(ts.day() == 22, "day==22"); check(ts.hour() == 15, "hour==15"); } void test_to_datetime_scalar_float() { std::cout << " -- test_to_datetime_scalar_float --" << std::endl; // 1.5 seconds = 1500000000 ns from epoch auto ts = pandas::to_datetime_scalar(1.5, "s"); .. _example-top_level-to_dict-9: .. dropdown:: to_dict (pd_test_1_all.cpp:13343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13333 :emphasize-lines: 11 void pd_test_io_to_dict() { std::cout << "========= to_dict ================================"; std::map> data; data["A"] = {1.0, 2.0, 3.0}; data["B"] = {4.0, 5.0, 6.0}; pandas::DataFrame df(data); // Test list orientation auto dict_list = df.to_dict("list"); bool passed = (dict_list.count("A") > 0 && dict_list.count("B") > 0); passed = passed && (dict_list["A"].size() == 3); passed = passed && (dict_list["B"].size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_io_to_dict() : to_dict list failed" << std::endl; throw std::runtime_error("pd_test_io_to_dict failed"); } .. _example-top_level-to_dict_orient_dict-10: .. dropdown:: to_dict_orient_dict (pd_test_2_all.cpp:10652) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10642 :emphasize-lines: 11 // Create DataFrame with string index std::map> data = { {"col1", {1, 2}}, {"col2", {3, 4}} }; pandas::DataFrame df(data); std::vector idx_vals = {"a", "b"}; df.set_index(std::make_unique>(idx_vals)); // Test orient='dict': {column -> {index -> value}} auto result = df.to_dict_orient_dict(); // Verify structure if (result.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_dict() : expected 2 columns" << std::endl; throw std::runtime_error("pd_test_to_dict_orient_dict failed: wrong column count"); } // Verify col1 auto& col1 = result["col1"]; if (col1["a"] != "1" || col1["b"] != "2") { .. _example-top_level-to_dict_orient_index-11: .. dropdown:: to_dict_orient_index (pd_test_2_all.cpp:10755) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10745 :emphasize-lines: 11 // Create DataFrame with string index std::map> data = { {"col1", {1, 2}}, {"col2", {3, 4}} }; pandas::DataFrame df(data); std::vector idx_vals = {"row_a", "row_b"}; df.set_index(std::make_unique>(idx_vals)); // Test orient='index': {index -> {column -> value}} auto result = df.to_dict_orient_index(); // Verify structure if (result.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_index() : expected 2 rows" << std::endl; throw std::runtime_error("pd_test_to_dict_orient_index failed: wrong row count"); } // Verify row_a auto& row_a = result["row_a"]; if (row_a["col1"] != "1" || row_a["col2"] != "3") { .. _example-top_level-to_dict_orient_records-12: .. dropdown:: to_dict_orient_records (pd_test_2_all.cpp:10688) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10678 :emphasize-lines: 11 std::cout << "========= to_dict_orient_records ================================"; // Create simple DataFrame std::map> data = { {"col1", {1, 2}}, {"col2", {3, 4}} }; pandas::DataFrame df(data); // Test orient='records': [{column -> value}, ...] auto result = df.to_dict_orient_records(); // Verify structure - should be list of 2 dicts if (result.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_records() : expected 2 records, got " << result.size() << std::endl; throw std::runtime_error("pd_test_to_dict_orient_records failed: wrong record count"); } // Verify first record if (result[0]["col1"] != "1" || result[0]["col2"] != "3") { std::cout << " [FAIL] : in pd_test_to_dict_orient_records() : wrong values in first record" << std::endl; .. _example-top_level-to_dict_orient_series-13: .. dropdown:: to_dict_orient_series (pd_test_2_all.cpp:10911) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10901 :emphasize-lines: 11 void pd_test_to_dict_orient_series() { std::cout << "========= to_dict_orient_series ================================="; std::map> data = { {"col1", {1, 2, 3}}, {"col2", {4, 5, 6}} }; pandas::DataFrame df(data); // Test orient='series': {column -> Series} auto result = df.to_dict_orient_series(); // Verify structure if (result.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_series() : expected 2 columns" << std::endl; throw std::runtime_error("pd_test_to_dict_orient_series failed: wrong column count"); } // Verify col1 is a valid Series if (result.find("col1") == result.end() || !result["col1"]) { std::cout << " [FAIL] : in pd_test_to_dict_orient_series() : missing or null col1" << std::endl; .. _example-top_level-to_dict_orient_split-14: .. dropdown:: to_dict_orient_split (pd_test_2_all.cpp:10791) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10781 :emphasize-lines: 11 std::cout << "========= to_dict_orient_split =================================="; // Create simple DataFrame std::map> data = { {"A", {1, 2}}, {"B", {3, 4}} }; pandas::DataFrame df(data); // Test orient='split': {index: [], columns: [], data: [[]]} auto result = df.to_dict_orient_split(); // Verify index if (result.index.size() != 2 || result.index[0] != "0" || result.index[1] != "1") { std::cout << " [FAIL] : in pd_test_to_dict_orient_split() : wrong index values" << std::endl; throw std::runtime_error("pd_test_to_dict_orient_split failed: wrong index"); } // Verify columns if (result.columns.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_split() : wrong column count" << std::endl; .. _example-top_level-to_dict_orient_tight-15: .. dropdown:: to_dict_orient_tight (pd_test_2_all.cpp:10865) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10855 :emphasize-lines: 11 }; pandas::DataFrame df(data); // Set index with a name std::vector idx_vals = {"x", "y"}; auto idx = std::make_unique>(idx_vals); idx->set_name("row_idx"); df.set_index(std::move(idx)); // Test orient='tight' auto result = df.to_dict_orient_tight(); // Verify index if (result.index.size() != 2 || result.index[0] != "x" || result.index[1] != "y") { std::cout << " [FAIL] : in pd_test_to_dict_orient_tight() : wrong index values" << std::endl; throw std::runtime_error("pd_test_to_dict_orient_tight failed: wrong index"); } // Verify columns if (result.columns.size() != 2) { std::cout << " [FAIL] : in pd_test_to_dict_orient_tight() : wrong column count" << std::endl; .. _example-top_level-to_excel-16: .. dropdown:: to_excel (pd_test_2_all.cpp:3427) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3417 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_eval test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_eval.cpp (end) ----------------------------- // ------------------- pd_test_excel.cpp (start) ----------------------------- // dataframe_tests/pd_test_excel.cpp // Test file for DataFrame.to_excel() method #include #include #include #include #include #include #include #include .. _example-top_level-to_excel-17: .. dropdown:: to_excel (pd_test_2_all.cpp:3427) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3417 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_eval test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_eval.cpp (end) ----------------------------- // ------------------- pd_test_excel.cpp (start) ----------------------------- // dataframe_tests/pd_test_excel.cpp // Test file for DataFrame.to_excel() method #include #include #include #include #include #include #include #include .. _example-top_level-to_feather-18: .. dropdown:: to_feather (pd_test_2_all.cpp:11158) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 11148 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_dict test suite ==========================" << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_dict.cpp (end) ----------------------------- // ------------------- pd_test_to_feather.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_feather.cpp // Comprehensive tests for DataFrame.to_feather() method (pandas-compatible) #include #include #include #include #include #include #include #include #include .. _example-top_level-to_hdf-19: .. dropdown:: to_hdf (pd_test_2_all.cpp:11613) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 11603 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_feather test suite ==========================" << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_feather.cpp (end) ----------------------------- // ------------------- pd_test_to_hdf.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_hdf.cpp // Tests for DataFrame.to_hdf() method - Updated for real HDF5 format #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_html-20: .. dropdown:: to_html (pd_test_1_all.cpp:13438) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13428 :emphasize-lines: 11 void pd_test_io_to_html() { std::cout << "========= to_html ================================"; std::map> data; data["A"] = {1.0, 2.0}; data["B"] = {3.0, 4.0}; pandas::DataFrame df(data); std::string html = df.to_html(); // Check for key HTML elements bool has_table = (html.find("") != std::string::npos); bool has_tbody = (html.find("") != std::string::npos); bool has_th = (html.find("") != std::string::npos); bool has_td = (html.find("") != std::string::npos); bool passed = has_table && has_thead && has_tbody && has_th && has_td; .. _example-top_level-to_latex-21: .. dropdown:: to_latex (pd_test_2_all.cpp:9446) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 9436 :emphasize-lines: 11 void pd_test_styler_to_latex() { std::cout << "========= to_latex ================================="; std::map> data = { {"A", {1.0, 2.0, 3.0}}, {"B", {4.0, 5.0, 6.0}} }; pandas::DataFrame df(data); auto styler = df.style(); std::string latex = styler.to_latex(); if (!contains(latex, "\\begin{tabular}")) { std::cout << " [FAIL] : in pd_test_styler_to_latex() : did not produce tabular environment" << std::endl; throw std::runtime_error("pd_test_styler_to_latex failed: did not produce tabular environment"); } if (!contains(latex, "\\end{tabular}")) { std::cout << " [FAIL] : in pd_test_styler_to_latex() : did not close tabular environment" << std::endl; throw std::runtime_error("pd_test_styler_to_latex failed: did not close tabular environment"); } .. _example-top_level-to_markdown-22: .. dropdown:: to_markdown (pd_test_1_all.cpp:13466) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13456 :emphasize-lines: 11 void pd_test_io_to_markdown() { std::cout << "========= to_markdown ============================"; std::map> data; data["X"] = {10.0, 20.0}; data["Y"] = {30.0, 40.0}; pandas::DataFrame df(data); std::string md = df.to_markdown(); // Check for markdown table elements bool has_pipe = (md.find("|") != std::string::npos); bool has_separator = (md.find("---") != std::string::npos); bool passed = has_pipe && has_separator; if (!passed) { std::cout << " [FAIL] : in pd_test_io_to_markdown() : invalid markdown format" << std::endl; throw std::runtime_error("pd_test_io_to_markdown failed"); .. _example-top_level-to_numeric-23: .. dropdown:: to_numeric (pd_test_3_all.cpp:906) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 896 :emphasize-lines: 11 throw std::runtime_error("crosstab: expected 2 rows"); } if (ct.ncols() != 3) { throw std::runtime_error("crosstab: expected 3 cols"); } } // Case B: pandas::to_numeric on Series with errors="coerce" { pandas::Series s({"1", "2", "'A'", "4.22"}, std::string("col_1")); auto out = pandas::to_numeric(s, "coerce"); if (out.size() != 4) { throw std::runtime_error("to_numeric: size mismatch"); } if (out[0] != 1.0 || out[1] != 2.0 || out[3] != 4.22) { throw std::runtime_error("to_numeric: parsed values wrong"); } if (!std::isnan(out[2])) { throw std::runtime_error("to_numeric coerce: non-numeric did not become NaN"); } } .. _example-top_level-to_numeric-24: .. dropdown:: to_numeric (pd_test_3_all.cpp:906) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 896 :emphasize-lines: 11 throw std::runtime_error("crosstab: expected 2 rows"); } if (ct.ncols() != 3) { throw std::runtime_error("crosstab: expected 3 cols"); } } // Case B: pandas::to_numeric on Series with errors="coerce" { pandas::Series s({"1", "2", "'A'", "4.22"}, std::string("col_1")); auto out = pandas::to_numeric(s, "coerce"); if (out.size() != 4) { throw std::runtime_error("to_numeric: size mismatch"); } if (out[0] != 1.0 || out[1] != 2.0 || out[3] != 4.22) { throw std::runtime_error("to_numeric: parsed values wrong"); } if (!std::isnan(out[2])) { throw std::runtime_error("to_numeric coerce: non-numeric did not become NaN"); } } .. _example-top_level-to_orc-25: .. dropdown:: to_orc (pd_test_2_all.cpp:13769) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13759 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_markdown test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_markdown.cpp (end) ----------------------------- // ------------------- pd_test_to_orc.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_orc.cpp // Tests for DataFrame.to_orc() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_parquet-26: .. dropdown:: to_parquet (pd_test_2_all.cpp:14117) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 14107 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_orc test suite ==========================" << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_orc.cpp (end) ----------------------------- // ------------------- pd_test_to_parquet.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_parquet.cpp // Tests for DataFrame.to_parquet() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_pickle-27: .. dropdown:: to_pickle (pd_test_2_all.cpp:14906) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 14896 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_period test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_period.cpp (end) ----------------------------- // ------------------- pd_test_to_pickle.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_pickle.cpp // Tests for DataFrame.to_pickle() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_pickle-28: .. dropdown:: to_pickle (pd_test_2_all.cpp:14906) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 14896 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_period test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_period.cpp (end) ----------------------------- // ------------------- pd_test_to_pickle.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_pickle.cpp // Tests for DataFrame.to_pickle() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_records-29: .. dropdown:: to_records (pd_test_2_all.cpp:15323) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 15313 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_pickle test suite =========================" << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_pickle.cpp (end) ----------------------------- // ------------------- pd_test_to_records.cpp (start) ----------------------------- // pd_test_to_records.cpp // Tests for DataFrame.to_records() method #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_records_dict-30: .. dropdown:: to_records_dict (pd_test_1_all.cpp:13491) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13481 :emphasize-lines: 11 void pd_test_io_to_records() { std::cout << "========= to_records ============================="; std::map> data; data["name"] = {1.0, 2.0, 3.0}; data["value"] = {10.0, 20.0, 30.0}; pandas::DataFrame df(data); auto records = df.to_records_dict(); bool passed = (records.size() == 3); if (passed && records.size() > 0) { // Each record should have all columns passed = passed && (records[0].size() == 2); } if (!passed) { std::cout << " [FAIL] : in pd_test_io_to_records() : wrong number of records" << std::endl; throw std::runtime_error("pd_test_io_to_records failed"); .. _example-top_level-to_sql-31: .. dropdown:: to_sql (pd_test_2_all.cpp:15576) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 15566 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_records test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_records.cpp (end) ----------------------------- // ------------------- pd_test_to_sql.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_sql.cpp // Tests for DataFrame.to_sql() method #include #include #include #include #include #include #include #include .. _example-top_level-to_sql_con-32: .. dropdown:: to_sql_con (pd_test_3_all.cpp:17647) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 17637 :emphasize-lines: 11 bool passed = !str.empty(); if (!passed) { std::cout << " [FAIL] : in pd_test_to_string_formatters()" << std::endl; throw std::runtime_error("pd_test_to_string_formatters failed"); } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Test to_sql_con (alias for to_sql with con parameter name) // ============================================================================ void pd_test_to_sql_con() { std::cout << "========= DataFrame.to_sql_con() ======================"; std::map> data = { {"A", {1, 2}}, {"B", {3, 4}} }; pandas::DataFrame df(data); .. _example-top_level-to_stata-33: .. dropdown:: to_stata (pd_test_2_all.cpp:16133) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 16123 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_sql test suite ==========================" << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_sql.cpp (end) ----------------------------- // ------------------- pd_test_to_stata.cpp (start) ----------------------------- // pd_test_to_stata.cpp // Tests for DataFrame.to_stata() method #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-to_string-34: .. dropdown:: to_string (pd_test_1_all.cpp:2693) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 2683 :emphasize-lines: 11 pandas::PeriodArray arr_m(std::vector{ "2020-01", "NaT", "2025-06" }, "M"); // Year auto years = arr_m.year(); auto y0 = years[0]; if (!y0.has_value() || y0.value() != 2020) { std::cout << " [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]"); } auto y1 = years[1]; if (y1.has_value()) { std::cout << " [FAIL] : year[1] should be NA (NaT)" << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA"); } auto y2 = years[2]; .. _example-top_level-to_string-35: .. dropdown:: to_string (pd_test_1_all.cpp:2693) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 2683 :emphasize-lines: 11 pandas::PeriodArray arr_m(std::vector{ "2020-01", "NaT", "2025-06" }, "M"); // Year auto years = arr_m.year(); auto y0 = years[0]; if (!y0.has_value() || y0.value() != 2020) { std::cout << " [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]"); } auto y1 = years[1]; if (y1.has_value()) { std::cout << " [FAIL] : year[1] should be NA (NaT)" << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA"); } auto y2 = years[2]; .. _example-top_level-to_string-36: .. dropdown:: to_string (pd_test_1_all.cpp:2693) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 2683 :emphasize-lines: 11 pandas::PeriodArray arr_m(std::vector{ "2020-01", "NaT", "2025-06" }, "M"); // Year auto years = arr_m.year(); auto y0 = years[0]; if (!y0.has_value() || y0.value() != 2020) { std::cout << " [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]"); } auto y1 = years[1]; if (y1.has_value()) { std::cout << " [FAIL] : year[1] should be NA (NaT)" << std::endl; throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA"); } auto y2 = years[2]; .. _example-top_level-to_string_vector-37: .. dropdown:: to_string_vector (pd_test_1_all.cpp:10871) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10861 :emphasize-lines: 11 std::cout << " -> tests passed" << std::endl; } void pd_test_extension_index_to_string_vector() { std::cout << "========= to_string_vector ========================="; pandas::CategoricalArray arr({"a", std::nullopt, "c"}); pandas::CategoricalIndex idx(arr); auto str_vec = idx.to_string_vector(); bool passed = (str_vec.size() == 3 && str_vec[0] == "a" && str_vec[1] == "NA" && str_vec[2] == "c"); if (!passed) { std::cout << " [FAIL] : in pd_test_extension_index_to_string_vector() : to_string_vector check failed" << std::endl; throw std::runtime_error("pd_test_extension_index_to_string_vector failed"); } std::cout << " -> tests passed" << std::endl; } .. _example-top_level-to_timedelta-38: .. dropdown:: to_timedelta (pd_test_3_all.cpp:13691) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13681 :emphasize-lines: 11 numpy::NDArray na_mask2 = result2.isna(); if (!static_cast(na_mask2.getElementAt({1}))) { std::cout << " [FAIL] : in pd_test_top_level_to_datetime() : empty string should be NA" << std::endl; throw std::runtime_error("pd_test_top_level_to_datetime failed: empty not NA"); } std::cout << " -> tests passed" << std::endl; } void pd_test_top_level_to_timedelta() { std::cout << "========= to_timedelta() =============================="; // Test string version std::vector tds = { "1 days", "2 hours", "30 minutes" }; pandas::TimedeltaArray result = pandas::to_timedelta(tds); .. _example-top_level-to_timedelta-39: .. dropdown:: to_timedelta (pd_test_3_all.cpp:13691) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13681 :emphasize-lines: 11 numpy::NDArray na_mask2 = result2.isna(); if (!static_cast(na_mask2.getElementAt({1}))) { std::cout << " [FAIL] : in pd_test_top_level_to_datetime() : empty string should be NA" << std::endl; throw std::runtime_error("pd_test_top_level_to_datetime failed: empty not NA"); } std::cout << " -> tests passed" << std::endl; } void pd_test_top_level_to_timedelta() { std::cout << "========= to_timedelta() =============================="; // Test string version std::vector tds = { "1 days", "2 hours", "30 minutes" }; pandas::TimedeltaArray result = pandas::to_timedelta(tds); .. _example-top_level-to_xarray-40: .. dropdown:: to_xarray (pd_test_2_all.cpp:16928) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 16918 :emphasize-lines: 11 std::cout << "====================================== [OK] pd_test_to_timestamp test suite ========================== " << std::endl; return 0; } } // namespace dataframe_tests // ------------------- pd_test_to_timestamp.cpp (end) ----------------------------- // ------------------- pd_test_to_xarray.cpp (start) ----------------------------- // dataframe_tests/pd_test_to_xarray.cpp // Test for DataFrame.to_xarray() - Convert DataFrame to xarray Dataset #include #include #include #include #include #include #include #include "../pandas/pd_dataframe.h" .. _example-top_level-align_empty_series_to_index-41: .. dropdown:: align_empty_series_to_index (pd_test_3_all.cpp:23211) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 23201 :emphasize-lines: 11 throw std::runtime_error("test_align_string: values[2] should be empty string"); if (!aligned.has_missing) throw std::runtime_error("test_align_string: has_missing should be true"); std::cout << " -> test passed" << std::endl; } void test_align_empty() { std::cout << "========= align_empty_series_to_index ================="; auto aligned = pandas::construct::align_empty_series_to_index(4); if (aligned.values.size() != 4) throw std::runtime_error("test_align_empty: expected 4 values"); for (size_t i = 0; i < 4; ++i) { if (!aligned.missing_mask[i]) throw std::runtime_error("test_align_empty: missing_mask[" + std::to_string(i) + "] should be true"); } if (!aligned.has_missing) throw std::runtime_error("test_align_empty: has_missing should be true"); .. _example-top_level-align_series_to_dataframe-42: .. dropdown:: align_series_to_dataframe (pd_test_5_all.cpp:90968) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 90958 :emphasize-lines: 11 static bool is_nan(double v) { return v != v; } void case_1_positional_int64() { int local_fail = 0; auto df = make_abc_frame(); auto s = make_labelled_series( {10, 20, 30}, {"a", "b", "c"}); auto r = pandas::align_series_to_dataframe( s, df.index(), /*preserve_dtype=*/true); check_shape("case_1_positional_int64", r, 3, pandas::SetItemResult::POSITIONAL, local_fail); pandas_tests::check(r.has_nan_from_upcasting == false, "case_1_positional_int64.no_nan_introduced", local_fail); pandas_tests::check(r.dtype_override.has_value(), "case_1_positional_int64.dtype_override_present", local_fail); pandas_tests::check(r.aligned_values[0] == 10.0 && r.aligned_values[1] == 20.0 && .. _example-top_level-align_series_to_index-43: .. dropdown:: align_series_to_index (pd_test_3_all.cpp:23163) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 23153 :emphasize-lines: 11 void test_align_float64() { std::cout << "========= align_series_to_index float64 ==============="; // Series [1,2,3] with index ["a","b","c"] -> target ["a","c","d"] = [1,3,NaN] pandas::Index idx(std::vector{"a", "b", "c"}); pandas::Series s( std::vector{1.0, 2.0, 3.0}, idx); std::vector target = {"a", "c", "d"}; auto aligned = pandas::construct::align_series_to_index(s, target); if (aligned.values.size() != 3) throw std::runtime_error("test_align_float64: expected 3 values"); if (aligned.values[0] != 1.0) throw std::runtime_error("test_align_float64: values[0] should be 1.0"); if (aligned.values[1] != 3.0) throw std::runtime_error("test_align_float64: values[1] should be 3.0"); if (!aligned.missing_mask[2]) throw std::runtime_error("test_align_float64: missing_mask[2] should be true"); if (aligned.missing_mask[0] || aligned.missing_mask[1]) .. _example-top_level-concat-44: .. dropdown:: concat (pd_test_1_all.cpp:17717) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 17707 :emphasize-lines: 11 } void pd_test_period_index_concat() { std::cout << "========= concat factory =============================="; std::vector ordinals1 = {0, 1}; std::vector ordinals2 = {2, 3}; pandas::PeriodIndex idx1(ordinals1, "D"); pandas::PeriodIndex idx2(ordinals2, "D"); pandas::PeriodIndex concatenated = pandas::PeriodIndex::concat({idx1, idx2}); bool passed = (concatenated.size() == 4); if (!passed) { std::cout << " [FAIL] : in pd_test_period_index_concat()" << std::endl; throw std::runtime_error("pd_test_period_index_concat failed"); } std::cout << " -> tests passed" << std::endl; } .. _example-top_level-concat-45: .. dropdown:: concat (pd_test_1_all.cpp:17717) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 17707 :emphasize-lines: 11 } void pd_test_period_index_concat() { std::cout << "========= concat factory =============================="; std::vector ordinals1 = {0, 1}; std::vector ordinals2 = {2, 3}; pandas::PeriodIndex idx1(ordinals1, "D"); pandas::PeriodIndex idx2(ordinals2, "D"); pandas::PeriodIndex concatenated = pandas::PeriodIndex::concat({idx1, idx2}); bool passed = (concatenated.size() == 4); if (!passed) { std::cout << " [FAIL] : in pd_test_period_index_concat()" << std::endl; throw std::runtime_error("pd_test_period_index_concat failed"); } std::cout << " -> tests passed" << std::endl; } .. _example-top_level-concat_bool_partner_kind-46: .. dropdown:: concat_bool_partner_kind (pd_test_5_all.cpp:102198) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 102188 :emphasize-lines: 11 } static void check_partner_kind(const std::string& label, const std::vector& canon, bool expected, int& local_fail) { std::cout << "-- " << label << "\n"; bool got = false; std::string err; try { got = pandas::concat_bool_partner_kind(canon); } catch (const std::exception& e) { err = e.what(); } catch (...) { err = ""; } pandas_tests::check(err.empty(), label + "()_no_throw", local_fail); if (!err.empty()) { std::cout << " err: " << err << "\n"; return; } .. _example-top_level-concat_bool_partner_kind-47: .. dropdown:: concat_bool_partner_kind (pd_test_5_all.cpp:102198) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 102188 :emphasize-lines: 11 } static void check_partner_kind(const std::string& label, const std::vector& canon, bool expected, int& local_fail) { std::cout << "-- " << label << "\n"; bool got = false; std::string err; try { got = pandas::concat_bool_partner_kind(canon); } catch (const std::exception& e) { err = e.what(); } catch (...) { err = ""; } pandas_tests::check(err.empty(), label + "()_no_throw", local_fail); if (!err.empty()) { std::cout << " err: " << err << "\n"; return; } .. _example-top_level-concat_dispatch-48: .. dropdown:: concat_dispatch (pd_test_5_all.cpp:113473) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 113463 :emphasize-lines: 11 check_dtype("concat_dispatch_o7p8q9_disjoint_widening", df, "float64", local_fail); bool len_ok = (df.nrows() == 4); pandas_tests::check(len_ok, "concat_dispatch_o7p8q9_disjoint_widening.nrows_4", local_fail); } static void f_concat_dispatch_o7p8q9_case_H1_dispatch_empty(int& local_fail) { std::cout << "-- case_H1_dispatch_empty\n"; std::vector inputs; pandas::Result r = pandas::concat_dispatch(inputs); bool got = std::holds_alternative>(r.value); pandas_tests::check(got, "case_H1.empty_returns_dataframe", local_fail); if (!got) return; auto& dfp = std::get>(r.value); pandas_tests::check(dfp->nrows() == 0, "case_H1.nrows_0", local_fail); } static void f_concat_dispatch_o7p8q9_case_H2_dispatch_empty_axis1(int& local_fail) { std::cout << "-- case_H2_dispatch_empty_axis1\n"; std::vector inputs; .. _example-top_level-concat_dispatch_series_mixed-49: .. dropdown:: concat_dispatch_series_mixed (pd_test_5_all.cpp:102135) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 102125 :emphasize-lines: 11 return std::static_pointer_cast(s); } static pandas::Result try_concat( const std::vector>& inputs, const std::vector& dtypes_full, std::string& caught_msg, bool ignore_index = true) { caught_msg.clear(); try { return pandas::concat_dispatch_series_mixed(inputs, dtypes_full, ignore_index); } catch (const std::exception& e) { caught_msg = e.what(); } catch (...) { caught_msg = ""; } return pandas::Result{}; } static std::string result_dtype(const pandas::Result& r) { .. _example-top_level-join_must_be_inner_or_outer_got-50: .. dropdown:: join_must_be_inner_or_outer_got (pd_test_5_all.cpp:73163) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 73153 :emphasize-lines: 11 pandas::error_messages::invalid_join_type("left"), "case_2.long_form_distinct_from_short_form", local_fail); } void case_3_join_inner_outer_helper(int& local_fail) { std::cout << "-- case_3_join_inner_outer_helper\n"; check_eq_str( "case_3.join_inner_outer_xyz", "join must be 'inner' or 'outer', got 'xyz'", pandas::error_messages::join_must_be_inner_or_outer_got("xyz"), local_fail); check_eq_str( "case_3.join_inner_outer_empty", "join must be 'inner' or 'outer', got ''", pandas::error_messages::join_must_be_inner_or_outer_got(""), local_fail); } void case_4_join_outer_inner_left_right(int& local_fail) { std::cout << "-- case_4_join_outer_inner_left_right\n"; .. _example-top_level-merge-51: .. dropdown:: merge (pd_test_1_all.cpp:13639) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13629 :emphasize-lines: 11 namespace dataframe_tests { namespace dataframe_tests_joining { // Helper to check approximate equality bool approx_equal(double a, double b, double tol = 1e-9) { if (std::isnan(a) && std::isnan(b)) return true; return std::abs(a - b) < tol; } // ===================================================================== // merge() Tests // ===================================================================== void pd_test_joining_merge_inner() { std::cout << "========= merge inner join ============================"; // Left DataFrame: id, value_left std::map> left_data = { {"id", {1.0, 2.0, 3.0, 4.0}}, {"value_left", {10.0, 20.0, 30.0, 40.0}} }; .. _example-top_level-merge-52: .. dropdown:: merge (pd_test_1_all.cpp:13639) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13629 :emphasize-lines: 11 namespace dataframe_tests { namespace dataframe_tests_joining { // Helper to check approximate equality bool approx_equal(double a, double b, double tol = 1e-9) { if (std::isnan(a) && std::isnan(b)) return true; return std::abs(a - b) < tol; } // ===================================================================== // merge() Tests // ===================================================================== void pd_test_joining_merge_inner() { std::cout << "========= merge inner join ============================"; // Left DataFrame: id, value_left std::map> left_data = { {"id", {1.0, 2.0, 3.0, 4.0}}, {"value_left", {10.0, 20.0, 30.0, 40.0}} }; .. _example-top_level-merge_asof-53: .. dropdown:: merge_asof (pd_test_3_all.cpp:13741) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13731 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Merge Asof / Merge Ordered Tests // ============================================================================ void pd_test_top_level_merge_asof() { std::cout << "========= merge_asof() ================================"; // Create left DataFrame std::map> left_data = { {"time", {1.0, 5.0, 10.0}}, {"value_left", {100.0, 200.0, 300.0}} }; pandas::DataFrame left(left_data); // Create right DataFrame std::map> right_data = { .. _example-top_level-merge_ordered-54: .. dropdown:: merge_ordered (pd_test_3_all.cpp:13775) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13765 :emphasize-lines: 11 // Should have columns from both DataFrames if (result.ncols() < 3) { std::cout << " [FAIL] : in pd_test_top_level_merge_asof() : expected at least 3 columns" << std::endl; throw std::runtime_error("pd_test_top_level_merge_asof failed: wrong column count"); } std::cout << " -> tests passed" << std::endl; } void pd_test_top_level_merge_ordered() { std::cout << "========= merge_ordered() ============================="; std::map> left_data = { {"key", {1.0, 3.0, 5.0}}, {"val_a", {10.0, 30.0, 50.0}} }; pandas::DataFrame left(left_data); std::map> right_data = { {"key", {2.0, 4.0, 6.0}}, {"val_b", {20.0, 40.0, 60.0}} .. _example-top_level-melt-55: .. dropdown:: melt (pd_test_1_all.cpp:6846) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6836 :emphasize-lines: 11 } // Test melt { std::map> data; data["id"] = {1, 2}; data["A"] = {10, 20}; data["B"] = {30, 40}; pandas::DataFrame df(data); auto melted = df.melt({"id"}); if (melted.nrows() != 4) { // 2 ids * 2 value columns std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows"); } if (!melted.has_column("variable")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column"); } if (!melted.has_column("value")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl; .. _example-top_level-melt-56: .. dropdown:: melt (pd_test_1_all.cpp:6846) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6836 :emphasize-lines: 11 } // Test melt { std::map> data; data["id"] = {1, 2}; data["A"] = {10, 20}; data["B"] = {30, 40}; pandas::DataFrame df(data); auto melted = df.melt({"id"}); if (melted.nrows() != 4) { // 2 ids * 2 value columns std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows"); } if (!melted.has_column("variable")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column"); } if (!melted.has_column("value")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl; .. _example-top_level-melt-57: .. dropdown:: melt (pd_test_1_all.cpp:6846) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6836 :emphasize-lines: 11 } // Test melt { std::map> data; data["id"] = {1, 2}; data["A"] = {10, 20}; data["B"] = {30, 40}; pandas::DataFrame df(data); auto melted = df.melt({"id"}); if (melted.nrows() != 4) { // 2 ids * 2 value columns std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows"); } if (!melted.has_column("variable")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl; throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column"); } if (!melted.has_column("value")) { std::cout << " [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl; .. _example-top_level-pivot_table_with_grouper-58: .. dropdown:: pivot_table_with_grouper (pd_test_2_all.cpp:21310) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 21300 :emphasize-lines: 11 << dataframe_tests_misc_migration::g_fail << " failed)" << std::endl; return dataframe_tests_misc_migration::g_fail; } } // namespace dataframe_tests // ------------------- pd_test_misc_migration.cpp (end) ----------------------------- // ------------------- pd_test_pivot_ext.cpp (start) ----------------------------- // pd_test_pivot_ext.cpp - Tests for pivot_table extensions // Tests pivot_table_multi_agg(), pivot_table_with_grouper(), auto-detect numeric columns #include #include #include #include #include #include "../pandas/pd_dataframe.h" #include "../pandas/pd_groupby.h" .. _example-top_level-counts-59: .. dropdown:: counts (pd_test_1_all.cpp:1394) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 1384 :emphasize-lines: 11 pandas::DatetimeArray arr(std::vector{ "2023-01-01", "NaT", "2023-12-31", "NaT" }); // fillna // Fix A: storage is always ns; the boxed fill scalar comes back at ns // resolution. Compare ns counts (not toString) to be storage-unit-agnostic. numpy::datetime64 fill_val("2023-06-15"); auto filled = arr.fillna(fill_val); if (filled[1].value().toNanoseconds() != fill_val.toNanoseconds()) { std::cout << " [FAIL] : fillna: NaT should be replaced" << std::endl; throw std::runtime_error("pd_test_datetime_array_fillna_dropna failed: fillna"); } // dropna auto dropped = arr.dropna(); if (dropped.size() != 2) { .. _example-top_level-describe_option-60: .. dropdown:: describe_option (pd_test_3_all.cpp:13415) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13405 :emphasize-lines: 11 // Test reset_option pandas::reset_option("display.max_rows"); max_rows = pandas::get_option("display.max_rows"); if (max_rows != 60) { std::cout << " [FAIL] : in pd_test_top_level_options() : reset_option failed" << std::endl; throw std::runtime_error("pd_test_top_level_options failed: reset_option"); } // Test describe_option std::string desc = pandas::describe_option("display.max_rows"); if (desc.empty() || desc.find("display.max_rows") == std::string::npos) { std::cout << " [FAIL] : in pd_test_top_level_options() : describe_option empty or missing key" << std::endl; throw std::runtime_error("pd_test_top_level_options failed: describe_option"); } // Test invalid option bool threw = false; try { pandas::get_option("invalid.option.name"); } catch (const std::exception&) { .. _example-top_level-duplicatelabelerror-61: .. dropdown:: DuplicateLabelError (pd_test_5_all.cpp:72295) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 72285 :emphasize-lines: 11 } void case_6_throw_via_registry(int& local_fail) { std::cout << "-- case_6_throw_via_registry\n"; std::string caught; try { // DuplicateLabelError currently lives in pandasPython/ // bindings_common.h; plan_88a moves it into pandas::. If // plan_88a hasn't landed yet this is a compile error and // documents the dependency. throw pandas::DuplicateLabelError( std::string(pandas::error_messages::kCannotReindexDuplicate)); } catch (const std::exception& e) { caught = e.what(); } check_eq_str( "case_6.DuplicateLabelError_round_trip", "cannot reindex on an axis with duplicate labels", caught, local_fail); } .. _example-top_level-globalunlock-62: .. dropdown:: GlobalUnlock (pd_test_2_all.cpp:10220) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10210 :emphasize-lines: 11 return ""; } char* pszText = static_cast(GlobalLock(hData)); if (pszText == nullptr) { CloseClipboard(); return ""; } std::string text(pszText); GlobalUnlock(hData); CloseClipboard(); return text; } #else std::string get_clipboard_text() { // Non-Windows: just return empty (can't easily read clipboard) return ""; } #endif .. _example-top_level-incompatibledataargerror-63: .. dropdown:: IncompatibleDataArgError (pd_test_5_all.cpp:75723) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 75713 :emphasize-lines: 11 bool caught_func = false; try { throw pandas::IncompatibleFuncArgError("from pd_exceptions.h"); } catch (const pandas::IncompatibleFuncArgError& e) { caught_func = (std::string(e.what()) == "from pd_exceptions.h"); } catch (...) {} pandas_tests::check(caught_func, "case_1.func_arg_visible_in_pd_exceptions_h", local_fail); bool caught_data = false; try { throw pandas::IncompatibleDataArgError("from pd_exceptions.h"); } catch (const pandas::IncompatibleDataArgError& e) { caught_data = (std::string(e.what()) == "from pd_exceptions.h"); } catch (...) {} pandas_tests::check(caught_data, "case_1.data_arg_visible_in_pd_exceptions_h", local_fail); if (local_fail > 0) throw std::runtime_error("case_1 failed"); std::cout << " -> case_1 passed\n"; } void case_2_exists_via_legacy_dispatch_include() { .. _example-top_level-incompatiblefuncargerror-64: .. dropdown:: IncompatibleFuncArgError (pd_test_5_all.cpp:75705) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 75695 :emphasize-lines: 11 throw std::runtime_error("f_test_value_error_messages_3 failed"); } std::cout << " -> tests passed" << std::endl; } // --- f_test_dispatch_sentinels_3.cpp --- namespace f_test_dispatch_sentinels_3_ns { static void dispatch_call_emulator(const std::string& method) { throw pandas::IncompatibleFuncArgError( std::string("FuncDispatcher::call: no registered implementation for '") + method + "'"); } void case_1_exists_in_pd_exceptions_h() { std::cout << "----- case_1_exists_in_pd_exceptions_h -----\n"; int local_fail = 0; bool caught_func = false; try { throw pandas::IncompatibleFuncArgError("from pd_exceptions.h"); .. _example-top_level-incompatiblefuncargerror-65: .. dropdown:: IncompatibleFuncArgError (pd_test_5_all.cpp:75705) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 75695 :emphasize-lines: 11 throw std::runtime_error("f_test_value_error_messages_3 failed"); } std::cout << " -> tests passed" << std::endl; } // --- f_test_dispatch_sentinels_3.cpp --- namespace f_test_dispatch_sentinels_3_ns { static void dispatch_call_emulator(const std::string& method) { throw pandas::IncompatibleFuncArgError( std::string("FuncDispatcher::call: no registered implementation for '") + method + "'"); } void case_1_exists_in_pd_exceptions_h() { std::cout << "----- case_1_exists_in_pd_exceptions_h -----\n"; int local_fail = 0; bool caught_func = false; try { throw pandas::IncompatibleFuncArgError("from pd_exceptions.h"); .. _example-top_level-series-66: .. dropdown:: Series (pd_test_1_all.cpp:11161) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 11151 :emphasize-lines: 11 pandas::Series s({1.0, 2.0, 3.0, 4.0}, "values"); // Pipe applies function to entire Series auto add_mean = [](const pandas::Series& ser, double offset) { auto mean_val = ser.mean(); std::vector result; for (size_t i = 0; i < ser.size(); ++i) { result.push_back(ser[i] + mean_val.value_or(0.0) + offset); } return pandas::Series(result, ser.name()); }; auto result = s.pipe(add_mean, 10.0); bool passed = true; // mean is 2.5, offset is 10.0, so each value + 12.5 std::vector expected = {13.5, 14.5, 15.5, 16.5}; for (size_t i = 0; i < result.size(); ++i) { if (!approx_equal(result[i], expected[i])) { passed = false; .. _example-top_level-adjoin-67: .. dropdown:: adjoin (pd_test_3_all.cpp:25672) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25662 :emphasize-lines: 11 // ------------------- pd_test_index_type_id (end) ------------------ // ------------------- pd_test_display_formats (start) ----------------------------- // Tests for pandas/pd_display_formats.h formatting utilities namespace dataframe_tests_display_formats { void pd_test_display_formats_adjoin_basic() { std::cout << "========= display::adjoin basic ======================="; std::vector> cols = {{"a", "bb"}, {"xxx", "y"}}; std::string result = ::pandas::display::adjoin(1, cols); std::string expected = "a xxx\nbb y "; if (result != expected) { throw std::runtime_error("adjoin basic failed: got [" + result + "]"); } std::cout << " -> tests passed" << std::endl; } void pd_test_display_formats_adjoin_unequal() { std::cout << "========= display::adjoin unequal lengths ============="; std::vector> cols = {{"a", "b", "c"}, {"x"}}; .. _example-top_level-all_whole_numbers-68: .. dropdown:: all_whole_numbers (pd_test_3_all.cpp:25515) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25505 :emphasize-lines: 11 std::cout << "========= round_ns_1000() =============================="; int64_t r = pandas::round_ns_1000(1500000000123456789.0); if (r % 1000 != 0) throw std::runtime_error("round_ns_1000 failed: not 1000-aligned"); if (pandas::round_ns_1000(0.0) != 0) throw std::runtime_error("round_ns_1000 failed: zero"); std::cout << " -> tests passed" << std::endl; } void pd_test_value_classify_whole_numbers() { std::cout << "========= all_whole_numbers() =========================="; std::vector v1 = {1.0, 2.0, 3.0}; if (!pandas::all_whole_numbers(v1)) throw std::runtime_error("all_whole_numbers failed: all whole"); std::vector v2 = {1.0, 2.5, 3.0}; if (pandas::all_whole_numbers(v2)) throw std::runtime_error("all_whole_numbers failed: has fraction"); std::vector v3 = {1.0, std::numeric_limits::quiet_NaN(), 3.0}; if (!pandas::all_whole_numbers(v3)) throw std::runtime_error("all_whole_numbers failed: NaN ignored"); std::cout << " -> tests passed" << std::endl; .. _example-top_level-arr-69: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-arr-70: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-arr-71: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-arr-72: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-arr-73: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-arr-74: .. dropdown:: arr (pd_test_1_all.cpp:45) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 35 :emphasize-lines: 11 std::cout << " [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl; throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4"); } std::cout << " -> tests passed" << std::endl; } void pd_test_boolean_array_na_handling() { std::cout << "========= BooleanArray: NA handling ======================= "; pandas::BooleanArray arr({ std::optional(true), std::nullopt, // NA at index 1 std::optional(false) }); if (!arr.is_na(1)) { std::cout << " [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl; throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true"); } .. _example-top_level-array-75: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-76: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-77: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-78: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-79: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-80: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-81: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-82: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-83: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-array-84: .. dropdown:: array (pd_test_1_all.cpp:7343) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7333 :emphasize-lines: 11 }; pandas::DatetimeIndex idx(values, "with_nat"); bool passed = (idx.size() == 3); if (!passed) { std::cout << " [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } // Check that middle element is NA bool has_na = idx.array().is_na(1); passed = passed && has_na; if (!passed) { std::cout << " [FAIL] : NA not preserved" << std::endl; throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed"); } std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_index_copy_constructor() { .. _example-top_level-arrays-85: .. dropdown:: arrays (pd_test_1_all.cpp:10642) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10632 :emphasize-lines: 11 std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Set Operations Tests // ============================================================================ void pd_test_extension_index_append() { std::cout << "========= append ========================="; // Use same categories for both arrays (required by CategoricalArray::concat) std::vector cats = {"a", "b", "c", "d"}; pandas::CategoricalArray arr1({"a", "b"}, cats); pandas::CategoricalIndex idx1(arr1); pandas::CategoricalArray arr2({"c", "d"}, cats); pandas::CategoricalIndex idx2(arr2); auto appended = idx1.append(idx2); bool passed = (appended.size() == 4); .. _example-top_level-arrays-86: .. dropdown:: arrays (pd_test_1_all.cpp:10642) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10632 :emphasize-lines: 11 std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Set Operations Tests // ============================================================================ void pd_test_extension_index_append() { std::cout << "========= append ========================="; // Use same categories for both arrays (required by CategoricalArray::concat) std::vector cats = {"a", "b", "c", "d"}; pandas::CategoricalArray arr1({"a", "b"}, cats); pandas::CategoricalIndex idx1(arr1); pandas::CategoricalArray arr2({"c", "d"}, cats); pandas::CategoricalIndex idx2(arr2); auto appended = idx1.append(idx2); bool passed = (appended.size() == 4); .. _example-top_level-arrays-87: .. dropdown:: arrays (pd_test_1_all.cpp:10642) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10632 :emphasize-lines: 11 std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Set Operations Tests // ============================================================================ void pd_test_extension_index_append() { std::cout << "========= append ========================="; // Use same categories for both arrays (required by CategoricalArray::concat) std::vector cats = {"a", "b", "c", "d"}; pandas::CategoricalArray arr1({"a", "b"}, cats); pandas::CategoricalIndex idx1(arr1); pandas::CategoricalArray arr2({"c", "d"}, cats); pandas::CategoricalIndex idx2(arr2); auto appended = idx1.append(idx2); bool passed = (appended.size() == 4); .. _example-top_level-axis_must_be_0_or_1_got-88: .. dropdown:: axis_must_be_0_or_1_got (pd_test_5_all.cpp:72732) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 72722 :emphasize-lines: 11 "axis must be 'index', 'columns', '0', or '1'", std::string(pandas::error_messages::kAxisMustBeIndexColumnsOrStr01), local_fail); } void case_3_axis_format_helper(int& local_fail) { std::cout << "-- case_3_axis_format_helper\n"; check_eq_str( "case_3.axis_got_2", "axis must be 0 or 1, got 2", pandas::error_messages::axis_must_be_0_or_1_got(2), local_fail); // Negative value pass-through — `std::to_string(long long)` handles // negatives uniformly; this guards future replacement with an // unsigned formatter. check_eq_str( "case_3.axis_got_neg7", "axis must be 0 or 1, got -7", pandas::error_messages::axis_must_be_0_or_1_got(-7), local_fail); // Large-int pass-through. .. _example-top_level-bdate_range-89: .. dropdown:: bdate_range (pd_test_3_all.cpp:1357) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 1347 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Category 8: DateTime Functions // ============================================================================ void pd_test_3_all_bdate_range() { std::cout << "========= bdate_range() =============================="; // Create a business date range using start and end dates (not periods) // This avoids the incomplete periods implementation pandas::DatetimeIndex result = pandas::bdate_range( "2024-01-01", // Monday "2024-01-05", // Friday (5 weekdays: Mon-Fri) std::nullopt, // Use end date, not periods "B", std::nullopt, true, .. _example-top_level-build_multiindex_from_string_arrays-90: .. dropdown:: build_multiindex_from_string_arrays (pd_test_3_all.cpp:23316) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 23306 :emphasize-lines: 11 if (!mi_names[0].has_value() || *mi_names[0] != "first") throw std::runtime_error("wrong name 0"); if (!mi_names[1].has_value() || *mi_names[1] != "second") throw std::runtime_error("wrong name 1"); std::cout << " -> test passed" << std::endl; } void test_build_multiindex_from_arrays() { std::cout << "========= build_multiindex_from_arrays ================"; std::vector> arrays = {{"a", "a", "b"}, {"x", "y", "x"}}; pandas::MultiIndex mi = pandas::construct_helpers::build_multiindex_from_string_arrays(arrays); if (mi.size() != 3) throw std::runtime_error("expected size 3, got " + std::to_string(mi.size())); if (mi.nlevels() != 2) throw std::runtime_error("expected 2 levels, got " + std::to_string(mi.nlevels())); auto tup = mi.get_tuple_str(1); if (tup[0] != "a" || tup[1] != "y") throw std::runtime_error("wrong tuple at index 1"); std::cout << " -> test passed" << std::endl; } .. _example-top_level-cannot_astype_convert-91: .. dropdown:: cannot_astype_convert (pd_test_5_all.cpp:74129) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 74119 :emphasize-lines: 11 static_assert( std::is_same_v, "unsupported_dtype must return std::string"); static_assert( std::is_same_v, "unsupported_dtype_quoted must return std::string"); static_assert( std::is_same_v, "cannot_astype_convert must return std::string"); static_assert( std::is_same_v, "cannot_convert_index_to_dtype must return std::string"); static_assert( std::is_same_v( static_cast(ri)); bool ok = (v.size() == 5) && (v[0] == 0.0) && (v[1] == 1.0) && (v[2] == 2.0) && (v[3] == 3.0) && (v[4] == 4.0); pandas_tests::check(ok, "case_27_rangeindex_to_double()", local_fail); } void case_28_error_message_byte_exact(int& local_fail) { std::cout << "-- case_28_error_message_byte_exact\n"; std::string got = pandas::error_messages::cannot_coerce_index( "Index", "int64_t"); std::string expected = "Cannot coerce Index to vector"; bool ok = (got == expected); pandas_tests::check(ok, "case_28_error_message_byte_exact()", local_fail); if (!ok) std::cout << " expected=[" << expected << "] got=[" << got << "]\n"; } void case_29_error_message_different_kinds(int& local_fail) { std::cout << "-- case_29_error_message_different_kinds\n"; .. _example-top_level-cannot_compare_types-94: .. dropdown:: cannot_compare_types (pd_test_5_all.cpp:74699) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 74689 :emphasize-lines: 11 // Format helpers exist and return std::string. static_assert( std::is_same_v, "numeric_only_false must return std::string"); static_assert( std::is_same_v, "numeric_only_false_sum_hint must return std::string"); static_assert( std::is_same_v, "cannot_compare_types must return std::string"); static_assert( std::is_same_v, "unsupported_binop must return std::string"); .. _example-top_level-cannot_convert_index_to_dtype-95: .. dropdown:: cannot_convert_index_to_dtype (pd_test_5_all.cpp:74134) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 74124 :emphasize-lines: 11 std::is_same_v, "unsupported_dtype_quoted must return std::string"); static_assert( std::is_same_v, "cannot_astype_convert must return std::string"); static_assert( std::is_same_v, "cannot_convert_index_to_dtype must return std::string"); static_assert( std::is_same_v, "unsupported_dtype_for_multiindex must return std::string"); static_assert( std::is_same_v, "cannot_convert_index_to_dtype must return std::string"); static_assert( std::is_same_v, "unsupported_dtype_for_multiindex must return std::string"); static_assert( std::is_same_v, "cannot_convert_value_in_column must return std::string"); pandas_tests::check(true, "case_1.cat6_constants_and_helpers_type_pinned", local_fail); } void case_2_byte_exact_wording(int& local_fail) { std::cout << "-- case_2_byte_exact_wording\n"; .. _example-top_level-canonical_dtype_name-97: .. dropdown:: canonical_dtype_name (pd_test_5_all.cpp:86367) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 86357 :emphasize-lines: 11 void case_1_series_complex_dtype_name(int& local_fail) { std::cout << "-- case_1_series_complex_dtype_name\n"; pandas::Series s({cdouble(1.0, 2.0), cdouble(3.0, 4.0)}); const std::string dt = s.dtype_name(); pandas_tests::check(dt == "complex128", "case_1_series_complex_dtype_name.dtype_is_complex128_got_" + dt, local_fail); } void case_2_series_canonical_dtype_name(int& local_fail) { std::cout << "-- case_2_series_canonical_dtype_name\n"; const std::string canon = pandas::Series::canonical_dtype_name(); pandas_tests::check(canon == "complex128", "case_2_canonical_dtype_name_is_complex128_got_" + canon, local_fail); } void case_3_empty_series_complex_dtype(int& local_fail) { std::cout << "-- case_3_empty_series_complex_dtype\n"; pandas::Series s(std::vector{}); const std::string dt = s.dtype_name(); pandas_tests::check(dt == "complex128", "case_3_empty_series_complex_dtype.dtype_is_complex128_got_" + dt, local_fail); .. _example-top_level-canonicalise_axis-98: .. dropdown:: canonicalise_axis (pd_test_5_all.cpp:92263) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 92253 :emphasize-lines: 11 "case_12_cond_series_broadcast_other_callable.ncols_eq_3", local_fail); pandas_tests::check(!result.to_string().empty(), "case_12_cond_series_broadcast_other_callable.to_string_nonempty", local_fail); } void case_13_canonicalise_axis_string_index() { std::cout << "-- case_13_canonicalise_axis_string_index\n"; int local_fail = 0; int got = pandas::canonicalise_axis(std::string("index")); pandas_tests::check(got == 0, "case_13_canonicalise_axis_string_index.eq_0", local_fail); // Sanity: distinct invocation should be stable. int got2 = pandas::canonicalise_axis(std::string("index")); pandas_tests::check(got2 == 0, "case_13_canonicalise_axis_string_index.stable_eq_0", local_fail); pandas_tests::check(got == got2, "case_13_canonicalise_axis_string_index.idempotent", local_fail); } .. _example-top_level-canonicalise_axis-99: .. dropdown:: canonicalise_axis (pd_test_5_all.cpp:92263) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 92253 :emphasize-lines: 11 "case_12_cond_series_broadcast_other_callable.ncols_eq_3", local_fail); pandas_tests::check(!result.to_string().empty(), "case_12_cond_series_broadcast_other_callable.to_string_nonempty", local_fail); } void case_13_canonicalise_axis_string_index() { std::cout << "-- case_13_canonicalise_axis_string_index\n"; int local_fail = 0; int got = pandas::canonicalise_axis(std::string("index")); pandas_tests::check(got == 0, "case_13_canonicalise_axis_string_index.eq_0", local_fail); // Sanity: distinct invocation should be stable. int got2 = pandas::canonicalise_axis(std::string("index")); pandas_tests::check(got2 == 0, "case_13_canonicalise_axis_string_index.stable_eq_0", local_fail); pandas_tests::check(got == got2, "case_13_canonicalise_axis_string_index.idempotent", local_fail); } .. _example-top_level-canonicalize_dtype_for_promote-100: .. dropdown:: canonicalize_dtype_for_promote (pd_test_5_all.cpp:144807) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 144797 :emphasize-lines: 11 << "] got=[" << out << "]\n"; } } static void expect_canon(const std::string& tag, std::string_view src, const std::string& expected, int& local_fail) { std::string out; try { out = pandas::detail::canonicalize_dtype_for_promote(src); } catch (const std::exception& e) { std::cout << " exception: " << e.what() << "\n"; out = ""; } bool ok = (out == expected); pandas_tests::check(ok, "canonicalize_" + tag + "()", local_fail); if (!ok) { std::cout << " src=[" << src << "] expected=[" << expected << "] got=[" << out << "]\n"; } .. _example-top_level-categorical_categories_dtype_from_np_dtype-101: .. dropdown:: categorical_categories_dtype_from_np_dtype (pd_test_5_all.cpp:102945) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 102935 :emphasize-lines: 11 // --- f_test_C_26g_categorical_helpers_9.cpp --- namespace f_test_C_26g_categorical_helpers_9_ns { static void expect_categories_dtype(const std::string& label, std::string_view input_np_dtype, const std::string& expected, int& local_fail) { std::cout << "-- " << label << "\n"; std::string got = pandas::detail::categorical_categories_dtype_from_np_dtype(input_np_dtype); pandas_tests::check(got == expected, label + "()_value", local_fail); if (got != expected) { std::cout << " got=[" << got << "] expected=[" << expected << "]\n"; } } static void expect_value_to_str_some(const std::string& label, const pandas::CoreValueKind& v, const std::string& expected, .. _example-top_level-cell_to_dtype_kind-102: .. dropdown:: cell_to_dtype_kind (pd_test_5_all.cpp:93104) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 93094 :emphasize-lines: 11 void case_1_of_float(int& local_fail) { std::cout << "-- case_1_of_float\n"; pandas::ApplyCellResult r = pandas::ApplyCellResult::of_float(3.14); pandas_tests::check(r.kind == pandas::ApplyCellResult::Kind::Float, "C_26_apply_cell_result_case_1_of_float()_kind", local_fail); pandas_tests::check(r.flt == 3.14, "C_26_apply_cell_result_case_1_of_float()_payload", local_fail); char k = pandas::cell_to_dtype_kind(r); pandas_tests::check(k == 'f', "C_26_apply_cell_result_case_1_of_float()_dtype_kind", local_fail); if (k != 'f') std::cout << " got=[" << k << "] expected=[f]\n"; } void case_2_of_int(int& local_fail) { std::cout << "-- case_2_of_int\n"; pandas::ApplyCellResult r = pandas::ApplyCellResult::of_int( static_cast(42)); .. _example-top_level-classify_dtype-103: .. dropdown:: classify_dtype (pd_test_5_all.cpp:87626) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 87616 :emphasize-lines: 11 // --- f_test_06_dtype_string_canonicalize_9.cpp --- namespace f_test_06_dtype_string_canonicalize_9_ns { static void check_classify(const std::string& label, const std::string& input, pandas::DTypeCategory expected_cat, const std::string& expected_p1, const std::string& expected_p2, int& local_fail) { pandas::DTypeInfo info = pandas::classify_dtype(input); bool ok = (info.cat == expected_cat) && (info.param1 == expected_p1) && (info.param2 == expected_p2); pandas_tests::check(ok, label, local_fail); if (!ok) { std::cout << " input = [" << input << "]\n" << " expected = (cat=" << static_cast(expected_cat) << ", p1=[" << expected_p1 << "]" << ", p2=[" << expected_p2 << "])\n" << " actual = (cat=" << static_cast(info.cat) .. _example-top_level-classify_value_dtype-104: .. dropdown:: classify_value_dtype (pd_test_3_all.cpp:25475) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25465 :emphasize-lines: 11 return dataframe_tests_dst_offset::pd_test_dst_timezone_main(); } // ------------------- pd_test_dst_timezone (end) ------------------ // ------------------- pd_test_value_classify (start) ------------------ #include "../pandas/pd_value_classify.h" namespace dataframe_tests_value_classify { void pd_test_value_classify_dtype() { std::cout << "========= classify_value_dtype() ======================="; auto r1 = pandas::classify_value_dtype("datetime64[ns, US/Eastern]"); if (r1.kind != pandas::ValueKind::DatetimeTZ || r1.tz != "US/Eastern") throw std::runtime_error("classify_value_dtype failed: DatetimeTZ"); auto r2 = pandas::classify_value_dtype("datetime64[ns]"); if (r2.kind != pandas::ValueKind::DatetimeNaive) throw std::runtime_error("classify_value_dtype failed: DatetimeNaive"); auto r3 = pandas::classify_value_dtype("timedelta64[ns]"); if (r3.kind != pandas::ValueKind::Timedelta) throw std::runtime_error("classify_value_dtype failed: Timedelta"); .. _example-top_level-clear_cache-105: .. dropdown:: clear_cache (pd_test_1_all.cpp:19413) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 19403 :emphasize-lines: 11 s.mean(); s.min(); s.max(); passed = s.has_cached_values() == true; if (!passed) { std::cout << " [FAIL] : in pd_test_series_cache() : cache not populated" << std::endl; throw std::runtime_error("pd_test_series_cache failed: cache not populated"); } s.clear_cache(); passed = s.has_cached_values() == false; if (!passed) { std::cout << " [FAIL] : in pd_test_series_cache() : cache not cleared" << std::endl; throw std::runtime_error("pd_test_series_cache failed: cache not cleared"); } std::cout << " -> tests passed" << std::endl; } void pd_test_series_string_repr() { .. _example-top_level-col_data-106: .. dropdown:: col_data (pd_test_4_all.cpp:5286) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 5276 :emphasize-lines: 11 namespace { // Build a DataFrame matching the original fixture *after* the sliced setitem. // override_fn(orig) computes the replacement value for every row whose // C-level (third level of the row MultiIndex) is "C1" or "C3". template pandas::DataFrame build_slicer_post_state(Fn override_fn) { constexpr size_t N_ROWS = 64; // 4 * 2 * 4 * 2 constexpr size_t N_COLS = 4; std::vector> col_data(N_COLS); for (auto& v : col_data) v.reserve(N_ROWS); for (size_t r = 0; r < N_ROWS; ++r) { // r decomposes as a*16 + b*8 + c*2 + d (strides for 4·2·4·2) size_t c_lvl = (r / 2) % 4; // 0..3 → C0..C3 bool overridden = (c_lvl == 1 || c_lvl == 3); for (size_t c = 0; c < N_COLS; ++c) { int64_t orig = static_cast(r * N_COLS + c); col_data[c].push_back(overridden ? override_fn(orig) : orig); } .. _example-top_level-col_data-107: .. dropdown:: col_data (pd_test_4_all.cpp:5286) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 5276 :emphasize-lines: 11 namespace { // Build a DataFrame matching the original fixture *after* the sliced setitem. // override_fn(orig) computes the replacement value for every row whose // C-level (third level of the row MultiIndex) is "C1" or "C3". template pandas::DataFrame build_slicer_post_state(Fn override_fn) { constexpr size_t N_ROWS = 64; // 4 * 2 * 4 * 2 constexpr size_t N_COLS = 4; std::vector> col_data(N_COLS); for (auto& v : col_data) v.reserve(N_ROWS); for (size_t r = 0; r < N_ROWS; ++r) { // r decomposes as a*16 + b*8 + c*2 + d (strides for 4·2·4·2) size_t c_lvl = (r / 2) % 4; // 0..3 → C0..C3 bool overridden = (c_lvl == 1 || c_lvl == 3); for (size_t c = 0; c < N_COLS; ++c) { int64_t orig = static_cast(r * N_COLS + c); col_data[c].push_back(overridden ? override_fn(orig) : orig); } .. _example-top_level-collect_index_union-108: .. dropdown:: collect_index_union (pd_test_3_all.cpp:23100) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 23090 :emphasize-lines: 11 std::cout << "========= collect_index_union basic ==================="; // Build two Index with overlapping labels: ["a","b","c"] + ["b","c","d"] pandas::Index idx1(std::vector{"a", "b", "c"}); pandas::Index idx2(std::vector{"b", "c", "d"}); std::vector infos = { {3, &idx1, false}, {3, &idx2, false} }; auto result = pandas::construct::collect_index_union(infos); if (result.union_index.size() != 4) throw std::runtime_error("test_collect_union_basic: expected 4 labels, got " + std::to_string(result.union_index.size())); std::vector expected = {"a", "b", "c", "d"}; if (result.union_index != expected) throw std::runtime_error("test_collect_union_basic: wrong union labels"); if (!result.has_series_with_index) throw std::runtime_error("test_collect_union_basic: has_series_with_index should be true"); if (result.max_len != 3) .. _example-top_level-columns-109: .. dropdown:: columns (pd_test_1_all.cpp:6220) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6210 :emphasize-lines: 11 throw std::runtime_error("pd_test_dataframe_properties failed: should be empty"); } // Test nbytes > 0 for non-empty if (df.nbytes() == 0) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : nbytes should be > 0" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: nbytes should be > 0"); } // Test columns index if (df.columns().size() != 3) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : columns size != 3" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: columns size != 3"); } // Test dtypes auto dtypes = df.dtypes(); if (dtypes.size() != 3) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : dtypes size != 3" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: dtypes size != 3"); } .. _example-top_level-columns-110: .. dropdown:: columns (pd_test_1_all.cpp:6220) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6210 :emphasize-lines: 11 throw std::runtime_error("pd_test_dataframe_properties failed: should be empty"); } // Test nbytes > 0 for non-empty if (df.nbytes() == 0) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : nbytes should be > 0" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: nbytes should be > 0"); } // Test columns index if (df.columns().size() != 3) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : columns size != 3" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: columns size != 3"); } // Test dtypes auto dtypes = df.dtypes(); if (dtypes.size() != 3) { std::cout << " [FAIL] : in pd_test_dataframe_properties() : dtypes size != 3" << std::endl; throw std::runtime_error("pd_test_dataframe_properties failed: dtypes size != 3"); } .. _example-top_level-compose_override-111: .. dropdown:: compose_override (pd_test_5_all.cpp:93541) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 93531 :emphasize-lines: 11 void case_23_is_object_bool_false_for_object_int(int& local_fail) { std::cout << "-- case_23_is_object_bool_false_for_object_int\n"; bool got = pandas::is_object_bool(std::string_view("object:int")); pandas_tests::check(got == false, "C_26_dtype_override_case_23_is_object_bool_false_for_object_int()_false", local_fail); } void case_24_compose_object_bool_first(int& local_fail) { std::cout << "-- case_24_compose_object_bool_first\n"; std::string got = pandas::compose_override( std::string_view("object:bool"), std::string_view("first"), std::string_view("bool")); bool ok = (got == "object"); pandas_tests::check(ok, "C_26_dtype_override_case_24_compose_object_bool_first()_value", local_fail); if (!ok) std::cout << " got=[" << got << "] expected=[object]\n"; } .. _example-top_level-current-112: .. dropdown:: current (pd_test_4_all.cpp:1140) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 1130 :emphasize-lines: 11 const std::string& actual) { int _f = 0; pandas_tests::check_str_ws(label, expected, actual, _f); if (_f > 0) throw std::runtime_error(label + ": str mismatch"); } // ---------------------------------------------------------------------------- // Case 1 — dtype.int32_df_nsmallest // ---------------------------------------------------------------------------- void dtype_int32_df_nsmallest() { // Strategy B: synthesize the current (buggy) post-nsmallest state. // Column A is double because int32 is silently promoted inside // pandas::DataFrame::nsmallest today. Column B (from range(10)) stays // int64. Row index labels "2","6","4" are the original positions of the // 3 smallest A values, ties broken by first-occurrence. pandas::DataFrame df; df.add_column("A", std::vector{1.0, 2.0, 3.0}); df.add_column("B", std::vector{2, 6, 4}); df.set_index(std::make_unique>( std::vector{"2", "6", "4"})); apply_default_display(df); .. _example-top_level-cut-113: .. dropdown:: cut (pd_test_3_all.cpp:13483) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13473 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Cut and Qcut Tests // ============================================================================ void pd_test_top_level_cut() { std::cout << "========= cut() ======================================="; std::vector x = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}; // Test cut with number of bins pandas::CutResult result = pandas::cut(x, 4); if (result.bins.size() != 4) { std::cout << " [FAIL] : in pd_test_top_level_cut() : expected 4 bins, got " << result.bins.size() << std::endl; throw std::runtime_error("pd_test_top_level_cut failed: wrong bin count"); } if (result.labels.size() != 4) { .. _example-top_level-date_range-114: .. dropdown:: date_range (pd_test_1_all.cpp:7908) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7898 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Factory Function Tests // ============================================================================ void pd_test_datetime_index_date_range_start_end() { std::cout << "========= date_range (start, end) ====================="; auto idx = pandas::date_range("2020-01-01", "2020-01-10"); bool passed = (idx.size() == 10); if (!passed) { std::cout << " [FAIL] : expected 10 elements, got " << idx.size() << std::endl; throw std::runtime_error("pd_test_datetime_index_date_range_start_end failed"); } std::cout << " -> tests passed" << std::endl; .. _example-top_level-date_range-115: .. dropdown:: date_range (pd_test_1_all.cpp:7908) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7898 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Factory Function Tests // ============================================================================ void pd_test_datetime_index_date_range_start_end() { std::cout << "========= date_range (start, end) ====================="; auto idx = pandas::date_range("2020-01-01", "2020-01-10"); bool passed = (idx.size() == 10); if (!passed) { std::cout << " [FAIL] : expected 10 elements, got " << idx.size() << std::endl; throw std::runtime_error("pd_test_datetime_index_date_range_start_end failed"); } std::cout << " -> tests passed" << std::endl; .. _example-top_level-date_range_with_offset-116: .. dropdown:: date_range_with_offset (pd_test_3_all.cpp:24739) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 24729 :emphasize-lines: 11 int pd_test_rolling_time_main() { return dataframe_tests_rolling_time::pd_test_rolling_time_main(); } // ------------------- pd_test_rolling_time (end) --------------------------- // ------------------- pd_test_date_range_offset (start) --------------------------- namespace dataframe_tests_date_range_offset { void pd_test_date_range_offset_with_periods() { std::cout << "========= date_range_with_offset (periods) ======================="; // BusinessDay(1) from 2024-01-01 (Mon) with periods=5 => Mon-Fri pandas::BusinessDay bday(1); auto dti = pandas::date_range_with_offset( bday, "2024-01-01", std::nullopt, std::optional(5)); if (dti.size() != 5) throw std::runtime_error("expected 5 dates, got " + std::to_string(dti.size())); // Verify all 5 are weekdays Mon(0)-Fri(4) for (size_t i = 0; i < dti.size(); ++i) { auto val = dti.array()[i]; if (!val.has_value()) .. _example-top_level-datetime64_to_ns-117: .. dropdown:: datetime64_to_ns (pd_test_3_all.cpp:22775) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22765 :emphasize-lines: 11 throw std::runtime_error("test_time_unit_factor: Day factor wrong"); std::cout << " -> test passed" << std::endl; } void test_datetime64_to_ns() { std::cout << " test_datetime64_to_ns" << std::endl; // 5 microseconds = 5000 nanoseconds numpy::datetime64 dt_us(5, numpy::DateTimeUnit::Microsecond); int64_t ns_us = pandas::construct_helpers::datetime64_to_ns(dt_us); if (ns_us != 5000LL) throw std::runtime_error("test_datetime64_to_ns: 5 us should be 5000 ns, got " + std::to_string(ns_us)); // 1 second = 1e9 nanoseconds numpy::datetime64 dt_s(1, numpy::DateTimeUnit::Second); int64_t ns_s = pandas::construct_helpers::datetime64_to_ns(dt_s); if (ns_s != 1000000000LL) throw std::runtime_error("test_datetime64_to_ns: 1 s should be 1e9 ns, got " + std::to_string(ns_s)); // 2 nanoseconds = 2 nanoseconds (identity) .. _example-top_level-datetime_unit_to_ns_multiplier-118: .. dropdown:: datetime_unit_to_ns_multiplier (pd_test_2_all.cpp:22559) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22549 :emphasize-lines: 11 ++g_fail; } } // ===================================================================== // Unit multiplier tests // ===================================================================== void test_datetime_unit_ns_multiplier() { std::cout << " -- test_datetime_unit_ns_multiplier --" << std::endl; check(pandas::datetime_unit_to_ns_multiplier("ns") == 1, "ns"); check(pandas::datetime_unit_to_ns_multiplier("nanoseconds") == 1, "nanoseconds"); check(pandas::datetime_unit_to_ns_multiplier("us") == 1000, "us"); check(pandas::datetime_unit_to_ns_multiplier("microseconds") == 1000, "microseconds"); check(pandas::datetime_unit_to_ns_multiplier("ms") == 1000000, "ms"); check(pandas::datetime_unit_to_ns_multiplier("milliseconds") == 1000000, "milliseconds"); check(pandas::datetime_unit_to_ns_multiplier("s") == 1000000000LL, "s"); check(pandas::datetime_unit_to_ns_multiplier("seconds") == 1000000000LL, "seconds"); check(pandas::datetime_unit_to_ns_multiplier("sec") == 1000000000LL, "sec"); check(pandas::datetime_unit_to_ns_multiplier("m") == 60LL * 1000000000LL, "m"); check(pandas::datetime_unit_to_ns_multiplier("min") == 60LL * 1000000000LL, "min"); .. _example-top_level-day_of_week-119: .. dropdown:: day_of_week (pd_test_3_all.cpp:22018) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22008 :emphasize-lines: 11 void test_dt_aliases() { std::cout << "========= dt accessor aliases ===================="; std::vector dates = { numpy::datetime64("2023-01-15"), numpy::datetime64("2023-06-20") }; pandas::Series s(dates); auto dow1 = s.dt().dayofweek(); auto dow2 = s.dt().day_of_week(); auto dow3 = s.dt().weekday(); if (dow1[0] != dow2[0] || dow1[0] != dow3[0]) { throw std::runtime_error("dt aliases: dayofweek/day_of_week/weekday mismatch"); } auto doy1 = s.dt().dayofyear(); auto doy2 = s.dt().day_of_year(); if (doy1[0] != doy2[0]) { .. _example-top_level-days_in_month-120: .. dropdown:: days_in_month (pd_test_1_all.cpp:2766) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 2756 :emphasize-lines: 11 std::cout << " [FAIL] : day[0] should be 15" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: day[0]"); } auto d1 = days[1]; if (!d1.has_value() || d1.value() != 25) { std::cout << " [FAIL] : day[1] should be 25" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: day[1]"); } // Days in month auto dim = arr.days_in_month(); auto dim0 = dim[0]; if (!dim0.has_value() || dim0.value() != 31) { std::cout << " [FAIL] : days_in_month[0] should be 31 (March)" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[0]"); } auto dim1 = dim[1]; if (!dim1.has_value() || dim1.value() != 31) { std::cout << " [FAIL] : days_in_month[1] should be 31 (December)" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[1]"); } .. _example-top_level-days_in_month-121: .. dropdown:: days_in_month (pd_test_1_all.cpp:2766) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 2756 :emphasize-lines: 11 std::cout << " [FAIL] : day[0] should be 15" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: day[0]"); } auto d1 = days[1]; if (!d1.has_value() || d1.value() != 25) { std::cout << " [FAIL] : day[1] should be 25" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: day[1]"); } // Days in month auto dim = arr.days_in_month(); auto dim0 = dim[0]; if (!dim0.has_value() || dim0.value() != 31) { std::cout << " [FAIL] : days_in_month[0] should be 31 (March)" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[0]"); } auto dim1 = dim[1]; if (!dim1.has_value() || dim1.value() != 31) { std::cout << " [FAIL] : days_in_month[1] should be 31 (December)" << std::endl; throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[1]"); } .. _example-top_level-detect_int_columns-122: .. dropdown:: detect_int_columns (pd_test_3_all.cpp:22937) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22927 :emphasize-lines: 11 col4.name = "D"; col4.string_data = {"x", "y"}; col4.is_numeric = false; // Empty numeric -> is_int = false pandas::construct_helpers::RecordColumn col5; col5.name = "E"; col5.is_numeric = true; std::vector cols = {col1, col2, col3, col4, col5}; pandas::construct_helpers::detect_int_columns(cols); if (!cols[0].is_int) throw std::runtime_error("test_detect_int_columns: [1.0,2.0,3.0] should be is_int=true"); if (cols[1].is_int) throw std::runtime_error("test_detect_int_columns: [1.5,2.0,3.0] should be is_int=false"); if (cols[2].is_int) throw std::runtime_error("test_detect_int_columns: [1.0,NaN] should be is_int=false"); if (cols[3].is_int) throw std::runtime_error("test_detect_int_columns: string col should be is_int=false"); if (cols[4].is_int) .. _example-top_level-detect_tuple_key_levels-123: .. dropdown:: detect_tuple_key_levels (pd_test_3_all.cpp:22998) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22988 :emphasize-lines: 11 throw std::runtime_error("test_records_to_dataframe: column Y should not have int64 override"); std::cout << " -> test passed" << std::endl; } void test_detect_tuple_keys() { std::cout << "========= detect_tuple_key_levels ===================="; // All 2-tuples -> {true, 2} std::vector> keys1 = {{true, 2}, {true, 2}, {true, 2}}; auto info1 = pandas::construct_helpers::detect_tuple_key_levels(keys1); if (!info1.all_tuple_keys || info1.tuple_len != 2) throw std::runtime_error("test_detect_tuple_keys: all 2-tuples should be {true, 2}"); // Mixed lengths -> {false, 0} std::vector> keys2 = {{true, 2}, {true, 3}}; auto info2 = pandas::construct_helpers::detect_tuple_key_levels(keys2); if (info2.all_tuple_keys || info2.tuple_len != 0) throw std::runtime_error("test_detect_tuple_keys: mixed lengths should be {false, 0}"); // Non-tuple key -> {false, 0} .. _example-top_level-detect_tz_uniformity-124: .. dropdown:: detect_tz_uniformity (pd_test_3_all.cpp:27218) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 27208 :emphasize-lines: 11 check(std::abs(result[2] - 3.0) < 1e-10, "sqrt(9)==3"); check(result.name() == "data", "name preserved"); } // Test 8: detect_tz_uniformity void pd_test_detect_tz_uniformity() { std::cout << " -- pd_test_detect_tz_uniformity --" << std::endl; // Uniform case { std::vector tz_strings = {"UTC", "UTC", "UTC"}; auto [uniform, tz] = ::pandas::detect_tz_uniformity(tz_strings); check(uniform, "all UTC -> uniform"); check(tz == "UTC", "common tz == UTC"); } // Non-uniform case { std::vector tz_strings = {"UTC", "US/Eastern", "UTC"}; auto [uniform, tz] = ::pandas::detect_tz_uniformity(tz_strings); check(!uniform, "mixed tz -> not uniform"); } // Empty first entry .. _example-top_level-dt-125: .. dropdown:: dt (pd_test_3_all.cpp:18239) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 18229 :emphasize-lines: 11 if (offset.freqstr() != "D") { std::cout << " [FAIL] : Day freqstr() failed" << std::endl; throw std::runtime_error("pd_test_day_offset: freqstr() failed"); } if (offset.name() != "Day") { std::cout << " [FAIL] : Day name() failed" << std::endl; throw std::runtime_error("pd_test_day_offset: name() failed"); } // Test apply numpy::datetime64 dt("2020-01-15"); auto result = offset.apply(dt); std::tm tm = result.toTm(); if (tm.tm_mday != 20) { std::cout << " [FAIL] : Day apply() failed, got day " << tm.tm_mday << std::endl; throw std::runtime_error("pd_test_day_offset: apply() failed"); } std::cout << " -> tests passed" << std::endl; } .. _example-top_level-dt-126: .. dropdown:: dt (pd_test_3_all.cpp:18239) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 18229 :emphasize-lines: 11 if (offset.freqstr() != "D") { std::cout << " [FAIL] : Day freqstr() failed" << std::endl; throw std::runtime_error("pd_test_day_offset: freqstr() failed"); } if (offset.name() != "Day") { std::cout << " [FAIL] : Day name() failed" << std::endl; throw std::runtime_error("pd_test_day_offset: name() failed"); } // Test apply numpy::datetime64 dt("2020-01-15"); auto result = offset.apply(dt); std::tm tm = result.toTm(); if (tm.tm_mday != 20) { std::cout << " [FAIL] : Day apply() failed, got day " << tm.tm_mday << std::endl; throw std::runtime_error("pd_test_day_offset: apply() failed"); } std::cout << " -> tests passed" << std::endl; } .. _example-top_level-dt_idx-127: .. dropdown:: dt_idx (pd_test_1_all.cpp:15618) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 15608 :emphasize-lines: 11 void pd_test_is_all_dates() { std::cout << "========= is_all_dates() ========================="; // DatetimeIndex numpy::NDArray dt_data(std::vector{1}); dt_data.setElementAt({0}, numpy::datetime64(1000LL, numpy::DateTimeUnit::Nanosecond)); numpy::NDArray dt_mask(std::vector{1}); dt_mask.setElementAt({0}, numpy::bool_(false)); pandas::DatetimeArray dt_arr(dt_data, dt_mask); pandas::DatetimeIndexBase dt_idx(dt_arr); // TimedeltaIndex numpy::NDArray td_data(std::vector{1}); td_data.setElementAt({0}, numpy::timedelta64(1000LL, numpy::DateTimeUnit::Nanosecond)); numpy::NDArray td_mask(std::vector{1}); td_mask.setElementAt({0}, numpy::bool_(false)); pandas::TimedeltaArray td_arr(td_data, td_mask); pandas::TimedeltaIndexBase td_idx(td_arr); // PeriodIndex .. _example-top_level-dt_idx-128: .. dropdown:: dt_idx (pd_test_1_all.cpp:15618) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 15608 :emphasize-lines: 11 void pd_test_is_all_dates() { std::cout << "========= is_all_dates() ========================="; // DatetimeIndex numpy::NDArray dt_data(std::vector{1}); dt_data.setElementAt({0}, numpy::datetime64(1000LL, numpy::DateTimeUnit::Nanosecond)); numpy::NDArray dt_mask(std::vector{1}); dt_mask.setElementAt({0}, numpy::bool_(false)); pandas::DatetimeArray dt_arr(dt_data, dt_mask); pandas::DatetimeIndexBase dt_idx(dt_arr); // TimedeltaIndex numpy::NDArray td_data(std::vector{1}); td_data.setElementAt({0}, numpy::timedelta64(1000LL, numpy::DateTimeUnit::Nanosecond)); numpy::NDArray td_mask(std::vector{1}); td_mask.setElementAt({0}, numpy::bool_(false)); pandas::TimedeltaArray td_arr(td_data, td_mask); pandas::TimedeltaIndexBase td_idx(td_arr); // PeriodIndex .. _example-top_level-dtype_category_to_canonical_string-129: .. dropdown:: dtype_category_to_canonical_string (pd_test_5_all.cpp:87650) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 87640 :emphasize-lines: 11 } static void check_reverse(const std::string& label, pandas::DTypeCategory cat, const std::string& p1, const std::string& p2, const std::string& expected, int& local_fail) { pandas::DTypeInfo info{cat, p1, p2}; std::string actual = pandas::dtype_category_to_canonical_string(cat, info); bool ok = (actual == expected); pandas_tests::check(ok, label, local_fail); if (!ok) { std::cout << " cat = " << static_cast(cat) << " p1=[" << p1 << "] p2=[" << p2 << "]\n" << " expected = [" << expected << "]\n" << " actual = [" << actual << "]\n"; } } .. _example-top_level-ensure_dtype_can_hold_na-130: .. dropdown:: ensure_dtype_can_hold_na (pd_test_5_all.cpp:56410) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 56400 :emphasize-lines: 11 static std::string mp(std::string_view dt, pandas::detail::FillKind k, bool has_missing) { return pandas::detail::maybe_promote(dt, k, has_missing); } static std::string mp_float(std::string_view dt, double fv) { return pandas::detail::maybe_promote(dt, pandas::detail::FillKind::Float, true, fv); } static std::string ehd(std::string_view dt) { return pandas::detail::ensure_dtype_can_hold_na(dt); } void pd_promote_9_413721_case_1_ehd_bool_promotes_to_object(int& local_fail) { std::cout << "----- case_1_ehd_bool_promotes_to_object -----\n"; check_str("pd_promote.ehd_bool", "object", ehd("bool"), local_fail); check_str("pd_promote.ehd_object_bool", "object", ehd("object:bool"), local_fail); } void pd_promote_9_413721_case_2_ehd_native_int_promotes_to_float64(int& local_fail) { std::cout << "----- case_2_ehd_native_int_promotes_to_float64 -----\n"; .. _example-top_level-extract_date_if_midnight-131: .. dropdown:: extract_date_if_midnight (pd_test_3_all.cpp:25167) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25157 :emphasize-lines: 11 std::cout << "========= nanos_to_timestamp_str: pre-epoch 1960 ======="; int64_t ns = pandas::Timestamp::componentsToNanos(1960, 1, 1, 0, 0, 0, 0, 0); auto result = pandas::datetime_utils::nanos_to_timestamp_str(ns); if (result != "1960-01-01 00:00:00") throw std::runtime_error("nanos_to_str pre-epoch: got " + result); std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_utils_midnight() { std::cout << "========= extract_date_if_midnight: midnight ==========="; auto r = pandas::datetime_utils::extract_date_if_midnight("2000-01-06 00:00:00"); if (r != "2000-01-06") throw std::runtime_error("extract_date midnight: got " + r); std::cout << " -> tests passed" << std::endl; } void pd_test_datetime_utils_midnight_nanos() { std::cout << "========= extract_date_if_midnight: midnight+nanos ====="; auto r = pandas::datetime_utils::extract_date_if_midnight("2000-01-06 00:00:00.000000000"); if (r != "2000-01-06") throw std::runtime_error("extract_date midnight nanos: got " + r); .. _example-top_level-extract_epoch_seconds-132: .. dropdown:: extract_epoch_seconds (pd_test_3_all.cpp:24668) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 24658 :emphasize-lines: 11 void pd_test_rolling_time_epoch_seconds() { std::cout << "========= extract_epoch_seconds ===================="; // Create a 3-date DatetimeIndex: 2023-01-01, 2023-01-02, 2023-01-03 std::vector dates = { numpy::datetime64("2023-01-01"), numpy::datetime64("2023-01-02"), numpy::datetime64("2023-01-03") }; pandas::DatetimeIndex dti(dates); auto epochs = pandas::extract_epoch_seconds(dti); if (epochs.size() != 3) throw std::runtime_error("expected 3 epoch values"); // Consecutive days should be 86400s apart if (epochs[1] - epochs[0] != 86400) throw std::runtime_error("expected 86400s between day 1 and day 2"); if (epochs[2] - epochs[1] != 86400) throw std::runtime_error("expected 86400s between day 2 and day 3"); std::cout << " -> tests passed" << std::endl; } .. _example-top_level-file-133: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-134: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-135: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-136: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-137: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-138: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-139: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-140: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-141: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-142: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-143: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-144: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-145: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-146: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-147: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-file-148: .. dropdown:: file (pd_test_2_all.cpp:3463) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 3453 :emphasize-lines: 11 {"C", {100, 200, 300, 400, 500}} }; pandas::DataFrame df(data); // Export to Excel std::string filepath = "temp/pd_test_excel_basic.xlsx"; df.to_excel(filepath); // Verify file was created std::ifstream file(filepath, std::ios::binary); if (!file.good()) { std::cout << " [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl; throw std::runtime_error("pd_test_excel_basic failed: file not created"); } // Check file size is reasonable (valid XLSX should be > 1KB) file.seekg(0, std::ios::end); auto size = file.tellg(); if (size < 1000) { std::cout << " [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl; .. _example-top_level-find_common_type-149: .. dropdown:: find_common_type (pd_test_5_all.cpp:39698) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 39688 :emphasize-lines: 11 } static pandas::DataFrame concat_axis1(const pandas::DataFrame& a, const pandas::DataFrame& b) { std::vector frames{a, b}; return pandas::concat(frames, /*axis=*/1); } void f_concat_df_bool_int_524871_case_1_helper_bool_int8_object(int& local_fail) { std::cout << "-- case_1_helper_bool_int8_object\n"; auto got = pandas::detail::find_common_type({"bool", "int8"}); pandas_tests::check(got == "object", "case_1.find_common_type({bool,int8}) == object (got '" + got + "')", local_fail); } void f_concat_df_bool_int_524871_case_2_helper_bool_int16_object(int& local_fail) { std::cout << "-- case_2_helper_bool_int16_object\n"; auto got = pandas::detail::find_common_type({"bool", "int16"}); pandas_tests::check(got == "object", "case_2.find_common_type({bool,int16}) == object (got '" + got + "')", .. _example-top_level-flatten_dict-150: .. dropdown:: flatten_dict (pd_test_5_all.cpp:81031) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81021 :emphasize-lines: 11 } // --- f_test_plan_06_normalize_jsonvalue_9.cpp --- namespace f_test_plan_06_normalize_jsonvalue_9_ns { struct PIO { static std::string json_value_to_string(const pandas::io::JsonValue& v) { return pandas::io::json_value_to_string(v); } static void flatten_dict(const pandas::io::JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } static const pandas::io::JsonValue* lookup_path( const pandas::io::JsonObject& root, const std::vector& path) { .. _example-top_level-flatten_dict-151: .. dropdown:: flatten_dict (pd_test_5_all.cpp:81031) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81021 :emphasize-lines: 11 } // --- f_test_plan_06_normalize_jsonvalue_9.cpp --- namespace f_test_plan_06_normalize_jsonvalue_9_ns { struct PIO { static std::string json_value_to_string(const pandas::io::JsonValue& v) { return pandas::io::json_value_to_string(v); } static void flatten_dict(const pandas::io::JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } static const pandas::io::JsonValue* lookup_path( const pandas::io::JsonObject& root, const std::vector& path) { .. _example-top_level-flatten_dict-152: .. dropdown:: flatten_dict (pd_test_5_all.cpp:81031) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81021 :emphasize-lines: 11 } // --- f_test_plan_06_normalize_jsonvalue_9.cpp --- namespace f_test_plan_06_normalize_jsonvalue_9_ns { struct PIO { static std::string json_value_to_string(const pandas::io::JsonValue& v) { return pandas::io::json_value_to_string(v); } static void flatten_dict(const pandas::io::JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } static const pandas::io::JsonValue* lookup_path( const pandas::io::JsonObject& root, const std::vector& path) { .. _example-top_level-format_duplicate_label_error-153: .. dropdown:: format_duplicate_label_error (pd_test_2_all.cpp:21263) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 21253 :emphasize-lines: 11 // ===================================================================== // 7F: Duplicate label error formatter // ===================================================================== void test_format_duplicate_label_error() { std::cout << " -- test_format_duplicate_label_error --" << std::endl; pandas::Index idx({"a", "b", "a", "c", "b"}); std::string msg = pandas::format_duplicate_label_error(idx); check(msg.find("Index has duplicates.") != std::string::npos, "has_header"); check(msg.find("positions") != std::string::npos, "has_positions_header"); check(msg.find("label") != std::string::npos, "has_label_header"); // "a" appears at positions 0, 2 check(msg.find("[0, 2]") != std::string::npos, "a_positions"); // "b" appears at positions 1, 4 check(msg.find("[1, 4]") != std::string::npos, "b_positions"); } .. _example-top_level-format_float-154: .. dropdown:: format_float (pd_test_5_all.cpp:57514) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 57504 :emphasize-lines: 11 std::vector v = {1.5, 2.25}; int p = pandas::detail::infer_float_repr_precision(std::span(v)); // Plan 14 Case 27 inverted: helper returns 2 (1.5 -> 1dp, 2.25 -> 2dp, // max = 2). pandas_tests::check(p == 2, "format_helpers_coverage_8b2f47_case_Plan14_27.infer_two_decimals", local_fail); } static void f_format_helpers_coverage_8b2f47_case_B01_nan_prec0(int& local_fail) { std::cout << "-- case_B01_nan_prec0\n"; std::string s = pandas::detail::format_float( std::numeric_limits::quiet_NaN(), 0); pandas_tests::check(s == "NaN", "format_helpers_coverage_8b2f47_case_B01.NaN_prec0", local_fail); } static void f_format_helpers_coverage_8b2f47_case_B02_nan_prec5(int& local_fail) { std::cout << "-- case_B02_nan_prec5\n"; std::string s = pandas::detail::format_float( std::numeric_limits::quiet_NaN(), 5); pandas_tests::check(s == "NaN", .. _example-top_level-format_pivot_cell_value-155: .. dropdown:: format_pivot_cell_value (pd_test_2_all.cpp:21231) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 21221 :emphasize-lines: 11 check(result.find("X") != std::string::npos, "contains_X"); check(result.find("Y") != std::string::npos, "contains_Y"); check(result.find("row1") != std::string::npos, "contains_row1"); check(result.find("idx") != std::string::npos, "contains_idx"); } void test_format_pivot_cell_int() { std::cout << " -- test_format_pivot_cell_int --" << std::endl; // sum with integer value -> integer string check(pandas::display::format_pivot_cell_value(42.0, "42.0", "sum") == "42", "sum_int"); // count with integer value -> integer string check(pandas::display::format_pivot_cell_value(7.0, "7.0", "count") == "7", "count_int"); // min with integer -> integer string check(pandas::display::format_pivot_cell_value(3.0, "3.0", "min") == "3", "min_int"); // max with integer -> integer string check(pandas::display::format_pivot_cell_value(100.0, "100.0", "max") == "100", "max_int"); .. _example-top_level-format_pivot_multi_aggfunc-156: .. dropdown:: format_pivot_multi_aggfunc (pd_test_2_all.cpp:21214) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 21204 :emphasize-lines: 11 std::vector sub_cols = {"X", "Y"}; // 4 data columns: (sum, X), (sum, Y), (mean, X), (mean, Y) std::vector> str_data = { {"10", "20"}, // sum, X {"30", "40"}, // sum, Y {"1.5", "2.5"}, // mean, X {"3.5", "4.5"} // mean, Y }; std::string result = pandas::display::format_pivot_multi_aggfunc( idx_vals, idx_names, col_lvl, aggfuncs, sub_cols, str_data); // Should produce a non-empty formatted string with hierarchical headers check(!result.empty(), "result_not_empty"); check(result.find("sum") != std::string::npos, "contains_sum"); check(result.find("mean") != std::string::npos, "contains_mean"); check(result.find("X") != std::string::npos, "contains_X"); check(result.find("Y") != std::string::npos, "contains_Y"); check(result.find("row1") != std::string::npos, "contains_row1"); check(result.find("idx") != std::string::npos, "contains_idx"); .. _example-top_level-format_quantile_label-157: .. dropdown:: format_quantile_label (pd_test_3_all.cpp:25776) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25766 :emphasize-lines: 11 int pd_test_display_formats_main() { return dataframe_tests_display_formats::pd_test_display_formats_main(); } // ------------------- pd_test_display_formats (end) ----------------------------- // ------------------- pd_test_series_format_helpers (begin) --------------------- namespace dataframe_tests_series_format_helpers { void pd_test_series_format_helpers_quantile_label() { std::cout << " format_quantile_label... "; std::string r1 = ::pandas::display::format_quantile_label(0.25); if (r1 != "0.25") throw std::runtime_error("Expected '0.25', got '" + r1 + "'"); std::string r2 = ::pandas::display::format_quantile_label(0.5); if (r2 != "0.5") throw std::runtime_error("Expected '0.5', got '" + r2 + "'"); std::string r3 = ::pandas::display::format_quantile_label(0.75); if (r3 != "0.75") throw std::runtime_error("Expected '0.75', got '" + r3 + "'"); std::cout << "PASSED" << std::endl; } void pd_test_series_format_helpers_quantile_list() { std::cout << " quantile_list... "; .. _example-top_level-found-158: .. dropdown:: found (pd_test_2_all.cpp:13553) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13543 :emphasize-lines: 11 // Should have formatted values with 2 decimal places bool passed = md.find("3.14") != std::string::npos; if (!passed) { std::cout << " [FAIL] : in pd_test_to_markdown_float_format() : formatted value not found" << std::endl; throw std::runtime_error("pd_test_to_markdown_float_format failed"); } // Should NOT have full precision passed = md.find("3.14159265") == std::string::npos; if (!passed) { std::cout << " [FAIL] : in pd_test_to_markdown_float_format() : full precision found (should be formatted)" << std::endl; throw std::runtime_error("pd_test_to_markdown_float_format failed"); } std::cout << " -> tests passed" << std::endl; } // Test custom column alignment void pd_test_to_markdown_colalign() { std::cout << "========= custom column alignment ==================="; .. _example-top_level-found-159: .. dropdown:: found (pd_test_2_all.cpp:13553) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13543 :emphasize-lines: 11 // Should have formatted values with 2 decimal places bool passed = md.find("3.14") != std::string::npos; if (!passed) { std::cout << " [FAIL] : in pd_test_to_markdown_float_format() : formatted value not found" << std::endl; throw std::runtime_error("pd_test_to_markdown_float_format failed"); } // Should NOT have full precision passed = md.find("3.14159265") == std::string::npos; if (!passed) { std::cout << " [FAIL] : in pd_test_to_markdown_float_format() : full precision found (should be formatted)" << std::endl; throw std::runtime_error("pd_test_to_markdown_float_format failed"); } std::cout << " -> tests passed" << std::endl; } // Test custom column alignment void pd_test_to_markdown_colalign() { std::cout << "========= custom column alignment ==================="; .. _example-top_level-freq_to_seconds-160: .. dropdown:: freq_to_seconds (pd_test_5_all.cpp:89804) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 89794 :emphasize-lines: 11 df_in.add_column("value", {1.0, 2.0, 3.0}); auto df = df_in.groupby("group").resample("D").sum(); pandas_tests::check(df.nrows() == 3, "case_12_aggregate_string_daily.nrows==3", local_fail); } void case_13_aggregate_string_ms_nonempty(int& local_fail) { std::cout << "-- case_13_aggregate_string_ms_nonempty\n"; // Sub-second source spans 5 ms. aggregate_string_cols_ today computes // `period_sec = freq_to_seconds("ms") * 1 = 0` and the inner // `i >= period_start && i < period_start + 0` filter never matches. // Combined with the resampler's own ms short-circuit, the whole // result frame is empty (nrows == 0). Post-fix, ms buckets carry // the source's tag values. pandas::DataFrame df_in; df_in.set_index(std::make_shared( mk_idx({"2020-01-01T00:00:00.000", "2020-01-01T00:00:00.002", "2020-01-01T00:00:00.005"}))); df_in.add_column("group", {"g", "g", "g"}); .. _example-top_level-has_cached_values-161: .. dropdown:: has_cached_values (pd_test_1_all.cpp:19395) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 19385 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } void pd_test_series_cache() { std::cout << "========= cache management ========================================="; pandas::Series s({1.0, 2.0, 3.0, 4.0, 5.0}); bool passed = s.has_cached_values() == false; if (!passed) { std::cout << " [FAIL] : in pd_test_series_cache() : initial cache not empty" << std::endl; throw std::runtime_error("pd_test_series_cache failed: initial cache not empty"); } // Trigger cache s.sum(); s.mean(); s.min(); s.max(); .. _example-top_level-infer_column_dtype-162: .. dropdown:: infer_column_dtype (pd_test_5_all.cpp:81044) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81034 :emphasize-lines: 11 int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } static const pandas::io::JsonValue* lookup_path( const pandas::io::JsonObject& root, const std::vector& path) { return pandas::io::lookup_path(root, path); } static std::string infer_column_dtype(const std::vector& vals, bool has_nan_token = true) { return pandas::io::infer_column_dtype(vals, has_nan_token); } }; using JsonValue = pandas::io::JsonValue; using JsonObject = pandas::io::JsonObject; using JsonArray = pandas::io::JsonArray; static void check_str(const std::string& label, .. _example-top_level-infer_dtype_override-163: .. dropdown:: infer_dtype_override (pd_test_3_all.cpp:22817) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22807 :emphasize-lines: 11 throw std::runtime_error("test_timedelta64_to_ns: 2 h should be 7200000000000 ns, got " + std::to_string(ns_h)); std::cout << " -> test passed" << std::endl; } void test_infer_int_override() { std::cout << " test_infer_int_override" << std::endl; // Column [1.0, 2.0, 3.0] -- all whole numbers, should be int64 std::vector vals1{1.0, 2.0, 3.0}; auto result1 = pandas::construct_helpers::infer_dtype_override(vals1, false); if (result1 != "int64") throw std::runtime_error("test_infer_int_override: [1.0,2.0,3.0] should infer as int64, got '" + result1 + "'"); // Column [1.5, 2.0] -- not all whole numbers std::vector vals2{1.5, 2.0}; auto result2 = pandas::construct_helpers::infer_dtype_override(vals2, false); if (result2 != "") throw std::runtime_error("test_infer_int_override: [1.5,2.0] should NOT infer as int, got '" + result2 + "'"); // Column [1.0, NaN] -- has NaN, should stay float64 .. _example-top_level-infer_dtype_override_from_kinds-164: .. dropdown:: infer_dtype_override_from_kinds (pd_test_5_all.cpp:94339) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 94329 :emphasize-lines: 11 df.add_column("s", { std::string("x"), std::string("y") }); KVec col = { kv_str("a"), kv_str("b") }; df.set_column_resolved("s", col); pandas_tests::check(df.column_dtype_override("s") == "string", "C_26h_case_159_set_column_string_replace()_dtype", local_fail); } void case_200_inf_pure_int(int& local_fail) { std::cout << "-- case_200_inf_pure_int\n"; KVec col = { kv_int(1) }; std::string s = pandas::construct_helpers::infer_dtype_override_from_kinds(col); pandas_tests::check(s == "int64", "C_26h_case_200_inf_pure_int()_dtype", local_fail); } void case_201_inf_int_with_na(int& local_fail) { std::cout << "-- case_201_inf_int_with_na\n"; KVec col = { kv_int(1), kv_na() }; std::string s = pandas::construct_helpers::infer_dtype_override_from_kinds(col); pandas_tests::check(s == "Int64", "C_26h_case_201_inf_int_with_na()_dtype", local_fail); .. _example-top_level-infer_float_repr_precision-165: .. dropdown:: infer_float_repr_precision (pd_test_5_all.cpp:57296) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 57286 :emphasize-lines: 11 f_test_astype_reindex_chain_coverage_23_main_ns::f_test_astype_reindex_chain_coverage_23_main(); } // --- f_test_format_helpers_coverage_9.cpp --- namespace f_test_format_helpers_coverage_9_main_ns { static void f_format_helpers_coverage_8b2f47_case_A01_empty_span_returns_min(int& local_fail) { std::cout << "-- case_A01_empty_span_returns_min\n"; std::vector v; int p = pandas::detail::infer_float_repr_precision(std::span(v)); pandas_tests::check(p == 1, "format_helpers_coverage_8b2f47_case_A01.empty_returns_min1", local_fail); } static void f_format_helpers_coverage_8b2f47_case_A02_all_integer_returns_min(int& local_fail) { std::cout << "-- case_A02_all_integer_returns_min\n"; std::vector v = {1.0, 2.0, 3.0}; int p = pandas::detail::infer_float_repr_precision(std::span(v)); pandas_tests::check(p == 1, "format_helpers_coverage_8b2f47_case_A02.all_integer_returns_min1", local_fail); .. _example-top_level-infer_freq-166: .. dropdown:: infer_freq (pd_test_3_all.cpp:9209) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 9199 :emphasize-lines: 11 // Check 10 % 3 = 1 if (std::abs(remainders[static_cast(1)] - 1.0) > 0.001) { std::cout << " [FAIL] : in pd_test_3_all_series_rdivmod() : remainder[1] wrong" << std::endl; throw std::runtime_error("pd_test_3_all_series_rdivmod failed: remainder"); } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Category 36: Plan 10 - infer_freq() // ============================================================================ void pd_test_3_all_infer_freq() { std::cout << "========= infer_freq() daily ======================"; // Create a DatetimeIndex with daily frequency constexpr int64_t NS_PER_DAY = 24LL * 60 * 60 * 1000000000LL; int64_t base_ns = 0; // 1970-01-01 std::vector dates; .. _example-top_level-info-167: .. dropdown:: info (pd_test_1_all.cpp:7122) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 7112 :emphasize-lines: 11 } if (!empty_params_error) { std::cout << " [FAIL] : select_dtypes empty params should throw" << std::endl; throw std::runtime_error("pd_test_dataframe_select_dtypes failed: empty params error"); } std::cout << " -> tests passed" << std::endl; } // ===================================================================== // Test: info() method // ===================================================================== void pd_test_dataframe_info() { std::cout << "========= info ========================"; // Test basic info() with stringstream std::map> data = { {"A", {1, 2, 3, 4, 5}}, {"B", {10, 20, 30, 40, 50}}, {"C", {100, 200, 300, 400, 500}} }; .. _example-top_level-interval_range-168: .. dropdown:: interval_range (pd_test_3_all.cpp:13614) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13604 :emphasize-lines: 11 } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Interval Range Tests // ============================================================================ void pd_test_top_level_interval_range() { std::cout << "========= interval_range() ============================"; // Test with start, end, periods pandas::IntervalArray result = pandas::interval_range( std::optional(0.0), std::optional(10.0), std::optional(5), std::nullopt, "right" ); .. _example-top_level-invalid_join_type-169: .. dropdown:: invalid_join_type (pd_test_5_all.cpp:73122) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 73112 :emphasize-lines: 11 if (s.empty()) return true; char back = s.back(); return !(back == ' ' || back == '\t' || back == '\n' || back == '\r'); } void case_1_invalid_join_type_format(int& local_fail) { std::cout << "-- case_1_invalid_join_type_format\n"; check_eq_str( "case_1.invalid_join_type_left", "Invalid join type: left", pandas::error_messages::invalid_join_type("left"), local_fail); check_eq_str( "case_1.invalid_join_type_outer", "Invalid join type: outer", pandas::error_messages::invalid_join_type("outer"), local_fail); // Empty pass-through — guards against future refactors that would // crash on empty input. check_eq_str( "case_1.invalid_join_type_empty", .. _example-top_level-invalid_join_type_with_valid_set-170: .. dropdown:: invalid_join_type_with_valid_set (pd_test_5_all.cpp:73143) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 73133 :emphasize-lines: 11 "Invalid join type: ", pandas::error_messages::invalid_join_type(""), local_fail); } void case_2_invalid_join_type_long_form(int& local_fail) { std::cout << "-- case_2_invalid_join_type_long_form\n"; check_eq_str( "case_2.invalid_join_type_with_valid_set_foo", "Invalid join type: foo. Must be 'left', 'right', 'inner', or 'outer'.", pandas::error_messages::invalid_join_type_with_valid_set("foo"), local_fail); check_eq_str( "case_2.invalid_join_type_with_valid_set_left", "Invalid join type: left. Must be 'left', 'right', 'inner', or 'outer'.", pandas::error_messages::invalid_join_type_with_valid_set("left"), local_fail); // Asymmetry pin: the long-form variant must NOT equal the short form. pandas_tests::check( pandas::error_messages::invalid_join_type_with_valid_set("left") != pandas::error_messages::invalid_join_type("left"), .. _example-top_level-iss-171: .. dropdown:: iss (pd_test_2_all.cpp:10348) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10338 :emphasize-lines: 11 try { df.to_clipboard(true, '\t', false); // index=false } catch (const std::exception& e) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #ifdef _WIN32 std::string clipboard = get_clipboard_text_with_retry(); // Without index, first line should be just "A" std::istringstream iss(clipboard); std::string first_line; std::getline(iss, first_line); passed = first_line == "A"; if (!passed) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #endif std::cout << " -> tests passed" << std::endl; .. _example-top_level-iss-172: .. dropdown:: iss (pd_test_2_all.cpp:10348) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10338 :emphasize-lines: 11 try { df.to_clipboard(true, '\t', false); // index=false } catch (const std::exception& e) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #ifdef _WIN32 std::string clipboard = get_clipboard_text_with_retry(); // Without index, first line should be just "A" std::istringstream iss(clipboard); std::string first_line; std::getline(iss, first_line); passed = first_line == "A"; if (!passed) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #endif std::cout << " -> tests passed" << std::endl; .. _example-top_level-iss-173: .. dropdown:: iss (pd_test_2_all.cpp:10348) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 10338 :emphasize-lines: 11 try { df.to_clipboard(true, '\t', false); // index=false } catch (const std::exception& e) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #ifdef _WIN32 std::string clipboard = get_clipboard_text_with_retry(); // Without index, first line should be just "A" std::istringstream iss(clipboard); std::string first_line; std::getline(iss, first_line); passed = first_line == "A"; if (!passed) { std::cout << " [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl; throw std::runtime_error("pd_test_to_clipboard_no_index failed"); } #endif std::cout << " -> tests passed" << std::endl; .. _example-top_level-json_normalize-174: .. dropdown:: json_normalize (pd_test_3_all.cpp:9344) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 9334 :emphasize-lines: 11 // Should have data columns: A, B (id and year are in the MultiIndex) if (result.ncols() != 2) { std::cout << " [FAIL] : in pd_test_3_all_wide_to_long() : expected 2 columns, got " << result.ncols() << std::endl; throw std::runtime_error("pd_test_3_all_wide_to_long failed: ncols"); } std::cout << " -> tests passed" << std::endl; } void pd_test_3_all_json_normalize() { std::cout << "========= json_normalize() ========================"; // Test with single row to verify basic functionality // (json_normalize only extracts numeric columns to DataFrame) // Note: Multi-row test skipped due to padding logic issue in implementation std::vector>>> data = { {{"id", 1.0}, {"score", 95.0}, {"age", 25.0}} }; pandas::DataFrame result = pandas::json_normalize(data); .. _example-top_level-json_normalize-175: .. dropdown:: json_normalize (pd_test_3_all.cpp:9344) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 9334 :emphasize-lines: 11 // Should have data columns: A, B (id and year are in the MultiIndex) if (result.ncols() != 2) { std::cout << " [FAIL] : in pd_test_3_all_wide_to_long() : expected 2 columns, got " << result.ncols() << std::endl; throw std::runtime_error("pd_test_3_all_wide_to_long failed: ncols"); } std::cout << " -> tests passed" << std::endl; } void pd_test_3_all_json_normalize() { std::cout << "========= json_normalize() ========================"; // Test with single row to verify basic functionality // (json_normalize only extracts numeric columns to DataFrame) // Note: Multi-row test skipped due to padding logic issue in implementation std::vector>>> data = { {{"id", 1.0}, {"score", 95.0}, {"age", 25.0}} }; pandas::DataFrame result = pandas::json_normalize(data); .. _example-top_level-json_value_to_string-176: .. dropdown:: json_value_to_string (pd_test_5_all.cpp:81028) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81018 :emphasize-lines: 11 throw std::runtime_error("f_test_plan_08_table_read_table_9 failed"); } std::cout << " -> tests passed" << std::endl; } // --- f_test_plan_06_normalize_jsonvalue_9.cpp --- namespace f_test_plan_06_normalize_jsonvalue_9_ns { struct PIO { static std::string json_value_to_string(const pandas::io::JsonValue& v) { return pandas::io::json_value_to_string(v); } static void flatten_dict(const pandas::io::JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } .. _example-top_level-json_value_to_string-177: .. dropdown:: json_value_to_string (pd_test_5_all.cpp:81028) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 81018 :emphasize-lines: 11 throw std::runtime_error("f_test_plan_08_table_read_table_9 failed"); } std::cout << " -> tests passed" << std::endl; } // --- f_test_plan_06_normalize_jsonvalue_9.cpp --- namespace f_test_plan_06_normalize_jsonvalue_9_ns { struct PIO { static std::string json_value_to_string(const pandas::io::JsonValue& v) { return pandas::io::json_value_to_string(v); } static void flatten_dict(const pandas::io::JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector>& out) { pandas::io::flatten_dict(d, prefix, sep, max_level, level, out); } .. _example-top_level-label_not_found-178: .. dropdown:: label_not_found (pd_test_5_all.cpp:72206) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 72196 :emphasize-lines: 11 check_eq_str( "case_3.cat1_DuplicateLabel.kCannotReindexDuplicate", "cannot reindex on an axis with duplicate labels", std::string(pandas::error_messages::kCannotReindexDuplicate), local_fail); // Category 2: IndexingError — "[