Top-Level Functions#

These functions are available directly in the pandas namespace.

#include <pandas/pandas.h>
using namespace pandas;

auto df = read_csv("data.csv");
auto merged = merge(df1, df2, "key");
auto concatenated = concat({df1, df2});

I/O#

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

View

DatetimeArray to_datetime( const std::vector<std::string>& 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

View

inline DatetimeArray to_datetime( const std::vector<std::string>& 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

View

inline DatetimeArray to_datetime_from_columns( const std::vector<int>& year, const std::vector<int>& month, const std::vector<int>& day, const std::vector<int>& hour = {}, const std::vector<int>& minute = {}, const std::vector<int>& second = {})

DatetimeArray

pd_top_level.h:2585

View

inline DatetimeArray to_datetime_mixed( const std::vector<std::string>& values, bool utc = false)

DatetimeArray

pd_top_level.h:2517

View

inline DatetimeArray to_datetime_numeric( const std::vector<double>& values, const std::string& unit = "ns", int64_t origin_ns = 0)

DatetimeArray

pd_top_level.h:2450

View

inline DatetimeArray to_datetime_numeric( const std::vector<int64_t>& values, const std::string& unit = "ns", int64_t origin_ns = 0)

DatetimeArray

pd_top_level.h:2480

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

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

View

std::map<std::string, std::vector<std::string>> to_dict( const std::string& orient = "list", bool index = true, [[maybe_unused]] const std::string& into = "dict") const

std::map<std::string, std::vector<std::string>>

pd_dataframe.h:28173

View

std::map<std::string, std::map<std::string, std::string>> to_dict_orient_dict( bool index = true) const

std::map<std::string, std::map<std::string, std::string>>

pd_dataframe.h:28223

View

std::map<std::string, std::map<std::string, std::string>> to_dict_orient_index() const

std::map<std::string, std::map<std::string, std::string>>

pd_dataframe.h:28309

View

std::vector<std::map<std::string, std::string>> to_dict_orient_records( bool index = false) const

std::vector<std::map<std::string, std::string>>

pd_dataframe.h:28262

View

std::map<std::string, std::unique_ptr<NDFrameBase>> to_dict_orient_series() const

std::map<std::string, std::unique_ptr<NDFrameBase>>

pd_dataframe.h:28463

View

DictSplitResult to_dict_orient_split(bool index = true) const

DictSplitResult

pd_dataframe.h:28349

View

DictTightResult to_dict_orient_tight(bool index = true) const

DictTightResult

pd_dataframe.h:28408

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<std::string>& 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<std::pair<size_t, size_t>> freeze_panes = std::nullopt, [[maybe_unused]] const std::string& engine = "openpyxl", [[maybe_unused]] const std::map<std::string, std::string>& engine_kwargs = {}, [[maybe_unused]] const std::string& storage_options = "") const

void

pd_dataframe.h:30540

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<std::string>& 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

View

std::vector<uint8_t> 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<uint8_t>

pd_dataframe.h:39326

View

void to_hdf( const std::string& path_or_buf, const std::string& key = "df", const std::string& mode = "a", [[maybe_unused]] std::optional<int> 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<std::string, int>& min_itemsize = {}, [[maybe_unused]] const std::string& nan_rep = "", [[maybe_unused]] bool dropna = false, [[maybe_unused]] const std::vector<std::string>& data_columns = {}, [[maybe_unused]] const std::string& errors = "strict", [[maybe_unused]] const std::string& encoding = "UTF-8") const

void

pd_dataframe.h:29916

View

std::string to_html( std::ostream\* buf = nullptr, const std::vector<std::string>& columns = {}, const std::vector<size_t>& 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<std::string>& formatters = {}) const

std::string

pd_dataframe.h:31162

View

std::string to_latex( std::ostream\* buf = nullptr, const std::vector<std::string>& 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<std::string>& formatters = {}) const

std::string

pd_dataframe.h:31544

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<std::string>& colalign = {}, std::optional<bool> 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

View

inline Series<double> to_numeric(const NDFrameBase& arg, const std::string& errors = "raise")

Series<double>

pd_top_level.h:2738

View

inline Series<double> to_numeric(const Series<std::string>& arg, const std::string& errors = "raise")

Series<double>

pd_top_level.h:2781

View

std::vector<uint8_t> to_orc( const std::string& path = "", const std::string& engine = "pyarrow", std::optional<bool> index = std::nullopt, [[maybe_unused]] const std::map<std::string, std::string>& engine_kwargs = {}) const

std::vector<uint8_t>

pd_dataframe.h:28514

View

std::vector<uint8_t> to_parquet( const std::string& path = "", const std::string& engine = "pyarrow", [[maybe_unused]] const std::string& compression = "snappy", std::optional<bool> index = std::nullopt, const std::vector<std::string>& partition_cols = {}, [[maybe_unused]] const std::string& storage_options = "") const

std::vector<uint8_t>

pd_dataframe.h:29077

View

std::vector<uint8_t> 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<uint8_t>

pd_dataframe.h:29723

View

inline std::vector<uint8_t> 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<uint8_t>

pd_dataframe.h:43178

View

inline std::vector<EvalToken> to_postfix(const std::vector<EvalToken>& tokens)

std::vector<EvalToken>

pd_dataframe.h:577

numpy::RecordArray to_records( bool index = true, const std::map<std::string, std::string>& column_dtypes = {}, const std::map<std::string, std::string>& index_dtypes = {}) const

numpy::RecordArray

pd_dataframe.h:31910

View

std::vector<std::map<std::string, std::string>> to_records_dict() const

std::vector<std::map<std::string, std::string>>

pd_dataframe.h:39259

View

std::optional<int64_t> 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<size_t> chunksize = std::nullopt, const std::map<std::string, std::string>& dtype = {}, const std::string& method = "") const

std::optional<int64_t>

pd_dataframe.h:30146

View

std::optional<int64_t> 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<size_t> chunksize = std::nullopt, const std::map<std::string, std::string>& dtype = {}, const std::string& method = "") const

std::optional<int64_t>

pd_dataframe.h:30464

View

std::vector<uint8_t> to_stata( const std::string& path = "", const std::map<std::string, std::string>& convert_dates = {}, bool write_index = true, const std::string& byteorder = "", const std::string& time_stamp = "", const std::string& data_label = "", const std::map<std::string, std::string>& variable_labels = {}, int version = 114, const std::vector<std::string>& convert_strl = {}, [[maybe_unused]] const std::string& compression = "infer", const std::map<std::string, std::map<int, std::string>>& value_labels = {}, [[maybe_unused]] const std::string& storage_options = "") const

std::vector<uint8_t>

pd_dataframe.h:32183

View

std::string to_string( std::ostream\* buf, const std::vector<std::string>& 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<std::string>& formatters = {}) const

std::string

pd_dataframe.h:40588

View

std::string to_string() const override

std::string

pd_dataframe.h:41010

View

to_string(oss, sparse_index, sparse_columns)

pd_styler.h:2048

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<std::string> to_string_vector() const override

std::vector<std::string>

pd_dataframe.h:40555

View

inline TimedeltaArray to_timedelta( const std::vector<std::string>& values, const std::string& unit = "ns", const std::string& errors = "raise")

TimedeltaArray

pd_top_level.h:2621

View

TimedeltaArray to_timedelta( const std::vector<T>& values, const std::string& unit = "ns")

TimedeltaArray

pd_top_level.h:2692

View

Dataset to_xarray() const

Dataset

pd_dataframe.h:40375

View

Combining#

Signature

Return Type

Location

Example

inline AlignedResult<T> align_empty_series_to_index(size_t target_size)

AlignedResult<T>

pd_dataframe_construct.h:949

View

AlignmentResult align_series_to_dataframe( const Series<T>& value, const IndexBase& df_index, bool preserve_dtype)

AlignmentResult

pd_dataframe_setitem.h:117

View

inline AlignedResult<T> align_series_to_index( const pandas::Series<T>& series, const std::vector<std::string>& target_index)

AlignedResult<T>

pd_dataframe_construct.h:917

View

inline Series<std::string> aligned_string_concat( const Series<std::string>& s, const Series<std::string>& o)

Series<std::string>

pd_series.h:16930

inline DataFrame concat( const std::vector<DataFrame>& objs, int axis = 0, const std::string& join = "outer", bool ignore_index = false, const std::vector<std::string>& keys = {}, const std::vector<std::vector<std::string>>& levels = {}, const std::vector<std::string>& names = {}, bool verify_integrity = false, bool sort = false, bool copy = true)

DataFrame

pd_dataframe.h:42991

View

inline DataFrame concat(const std::vector<DataFrame>& frames, bool ignore_index)

DataFrame

pd_dataframe.h:43008

View

inline bool concat_bool_partner_kind(const std::vector<std::string>& canon_dtypes)

bool

pd_concat_series.h:46

View

inline bool concat_bool_partner_kind(const std::vector<std::string>& canon_dtypes)

bool

pd_promote.h:1010

View

PANDASCORE_API Result concat_dispatch( const std::vector<FuncArg>& inputs, int axis = 0, bool ignore_index = false, bool sort = false, const std::optional<std::vector<std::string>>& keys = std::nullopt )

PANDASCORE_API Result

pd_concat.h:37

View

inline pandas::Result concat_dispatch_series_mixed( const std::vector<std::shared_ptr<pandas::NDFrameBase>>& inputs, const std::vector<std::string>& dtype_names_full, bool ignore_index = false)

pandas::Result

pd_concat_series.h:66

View

inline std::string join_must_be_inner_or_outer_got(const std::string& join)

std::string

pd_exceptions.h:217

View

inline DataFrame merge( const DataFrame& left, const DataFrame& right, OnT on_column, HowT how, const std::pair<std::string, std::string>& suffixes = {"_x", "_y"})

DataFrame

pd_dataframe.h:43128

View

inline DataFrame merge( const DataFrame& left, const DataFrame& right, const std::string& how = "inner", const std::vector<std::string>& on = {}, const std::vector<std::string>& left_on = {}, const std::vector<std::string>& right_on = {}, bool left_index = false, bool right_index = false, bool sort = false, const std::pair<std::string, std::string>& suffixes = {"_x", "_y"}, bool copy = true, const std::string& indicator = "", const std::string& validate = "")

DataFrame

pd_dataframe.h:43137

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<std::string, std::string>& suffixes = {"_x", "_y"}, const std::string& direction = "backward", std::optional<double> tolerance = std::nullopt, bool allow_exact_matches = true, const std::optional<std::string>& left_by = std::nullopt, bool left_index = false, const std::optional<std::string>& right_by = std::nullopt, bool right_index = false)

DataFrame

pd_top_level.h:1930

View

inline DataFrame merge_ordered( const DataFrame& left, const DataFrame& right, const std::string& on, const std::string& fill_method = "", const std::pair<std::string, std::string>& suffixes = {"_x", "_y"}, const std::string& how = "outer", const std::optional<std::string>& left_by = std::nullopt, const std::optional<std::string>& left_on = std::nullopt, const std::optional<std::string>& right_by = std::nullopt, const std::optional<std::string>& right_on = std::nullopt)

DataFrame

pd_top_level.h:2065

View

Reshaping#

Signature

Return Type

Location

Example

inline DataFrame melt( const DataFrame& frame, std::initializer_list<std::string> id_vars, std::initializer_list<std::string> value_vars, const std::string& var_name = "variable", const std::string& value_name = "value", std::optional<int> col_level = std::nullopt, bool ignore_index = true)

DataFrame

pd_dataframe.h:43048

View

inline DataFrame melt( const DataFrame& frame, const std::vector<std::string>& id_vars = {}, const std::vector<std::string>& value_vars = {}, const std::string& var_name = "variable", const std::string& value_name = "value", std::optional<int> col_level = std::nullopt, bool ignore_index = true)

DataFrame

pd_dataframe.h:43061

View

inline DataFrame melt( const DataFrame& frame, const std::string& var_name, const std::string& value_name)

DataFrame

pd_dataframe.h:43073

View

inline DataFrame pivot_table_with_grouper( const DataFrame& df, const std::vector<std::string>& values, const std::vector<std::pair<std::string, std::string>>& index_groupers, const std::vector<std::pair<std::string, std::string>>& column_groupers, const std::string& aggfunc = "mean", double fill_value = std::numeric_limits<double>::quiet_NaN())

DataFrame

pd_groupby.h:3840

View

Statistics#

Signature

Return Type

Location

Example

std::vector<std::vector<int64_t>> counts(nrows, std::vector<int64_t>(ncols, 0))

std::vector<std::vector<int64_t>>

pd_top_level.h:414

View

inline std::string describe_option(const std::string& pattern = "")

std::string

pd_top_level.h:326

View

std::vector<std::vector<double>> maxs(nrows, std::vector<double>(ncols, -std::numeric_limits<double>::infinity()))

std::vector<std::vector<double>>

pd_top_level.h:416

std::vector<std::vector<double>> mins(nrows, std::vector<double>(ncols, std::numeric_limits<double>::infinity()))

std::vector<std::vector<double>>

pd_top_level.h:415

Conversion#

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#

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

View

GlobalFree(hMem)

pd_dataframe.h:33236

GlobalFree(hMem)

pd_dataframe.h:33246

GlobalUnlock(hMem)

pd_dataframe.h:33242

View

throw IncompatibleDataArgError( "make_series_from_data_arg: unsupported DataArg::kind=" + std::to_string(static_cast<int>(data.kind)))

throw

pd_series_apply_dispatch.h:815

View

throw IncompatibleFuncArgError( "Series<std::string>::apply_dispatch: StringName arm is not " "supported for string-typed source (no numeric agg path).")

throw

pd_series_apply_dispatch.h:55

View

throw IncompatibleFuncArgError( "Series<complex128>::apply_dispatch: unsupported StringName '" + name + "'")

throw

pd_series_apply_dispatch.h:107

View

IndexDtype() = default

class IndexDtype : public ExtensionDtype { public: using scalar_type = T;

pd_index_dtype.h:32

Series(std::initializer_list<T>, std::initializer_list<std::string>) -> Series<T>

pd_series.h:16351

View

std::string acc(non_bool[0])

std::string

pd_promote.h:646

inline std::string adjoin( int space, const std::vector<std::vector<std::string>>& columns, std::string_view justify_mode = "left")

std::string

pd_display_formats.h:38

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<double>& data)

bool

pd_value_classify.h:83

View

DatetimeArray arr(values)

DatetimeArray

pd_datetime_index.h:4380

View

DatetimeArray arr(results)

DatetimeArray

pd_datetime_index.h:4573

View

DatetimeArray arr(business_days)

DatetimeArray

pd_datetime_index.h:4597

View

DatetimeArray arr(business_days)

DatetimeArray

pd_datetime_index.h:4626

View

DatetimeArray arr(business_days)

DatetimeArray

pd_datetime_index.h:4645

View

TimedeltaArray arr(values)

TimedeltaArray

pd_timedelta_index.h:3388

View

inline BooleanArray array(const numpy::NDArray<numpy::bool_>& data, const std::string& dtype = "", bool copy = false)

BooleanArray

pd_boolean_array.h:1012

View

inline BooleanArray array(const numpy::NDArray<numpy::bool_>& data, const numpy::NDArray<numpy::bool_>& mask, const std::string& dtype = "", bool copy = false)

BooleanArray

pd_boolean_array.h:1029

View

inline DatetimeArray array(const numpy::NDArray<numpy::datetime64>& data, std::shared_ptr<numpy::TimezoneInfo> tz = nullptr)

DatetimeArray

pd_datetime_array.h:1547

View

FloatingArray<T> array(const numpy::NDArray<T>& data, typename std::enable_if<std::is_floating_point_v<T>>::type\* = nullptr)

FloatingArray<T>

pd_floating_array.h:1113

View

FloatingArray<T> array(const numpy::NDArray<T>& data, const numpy::NDArray<numpy::bool_>& mask, typename std::enable_if<std::is_floating_point_v<T>>::type\* = nullptr)

FloatingArray<T>

pd_floating_array.h:1122

View

IntegerArray<T> array(const numpy::NDArray<T>& data)

IntegerArray<T>

pd_integer_array.h:990

View

IntegerArray<T> array(const numpy::NDArray<T>& data, const numpy::NDArray<numpy::bool_>& mask)

IntegerArray<T>

pd_integer_array.h:998

View

inline StringArray array(const numpy::NDArray<numpy::vstring_>& data)

StringArray

pd_string_array.h:1194

View

inline StringArray array(const numpy::NDArray<numpy::vstring_>& data, const numpy::NDArray<numpy::bool_>& mask)

StringArray

pd_string_array.h:1201

View

inline TimedeltaArray array(const numpy::NDArray<numpy::timedelta64>& data)

TimedeltaArray

pd_timedelta_array.h:1581

View

std::vector<std::vector<std::string>> arrays(nlevels)

std::vector<std::vector<std::string>>

pd_groupby.h:1039

View

std::vector<std::vector<std::string>> arrays(nlevels)

std::vector<std::vector<std::string>>

pd_groupby.h:2841

View

std::vector<std::vector<std::string>> arrays(n_lvl)

std::vector<std::vector<std::string>>

pd_rename_spec_impl.h:169

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

View

inline DatetimeIndex bdate_range( const std::optional<std::string>& start = std::nullopt, const std::optional<std::string>& end = std::nullopt, std::optional<size_t> periods = std::nullopt, const std::string& freq = "B", const std::optional<std::string>& tz = std::nullopt, bool normalize = true, const std::optional<std::string>& name = std::nullopt, const std::string& weekmask = "Mon Tue Wed Thu Fri", const std::vector<std::string>& holidays = {}, const std::string& inclusive = "both")

DatetimeIndex

pd_datetime_index.h:4437

View

inline std::vector<std::string> bin_datetime_column_by_freq( const DataFrame& df, const std::string& col_name, const std::string& freq)

std::vector<std::string>

pd_groupby.h:3760

inline std::vector<std::string> bin_datetime_strings_by_freq( const std::vector<std::string>& date_strings, const std::string& freq)

std::vector<std::string>

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<std::vector<std::string>>& arrays, const std::vector<std::optional<std::string>>& names = {})

pandas::MultiIndex

pd_dataframe_construct.h:403

View

inline std::string c26l_cell_label(const pandas::MapCellInput& in)

std::string

pd_series_apply_dispatch.h:1282

inline std::optional<Key> c26l_cell_to_key(const pandas::MapCellInput& in)

std::optional<Key>

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

View

inline std::string cannot_cast(const std::string& from_dt, const std::string& to_dt)

std::string

pd_exceptions.h:349

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

View

inline std::string cannot_compare_types(const std::string& lhs, const std::string& rhs)

std::string

pd_exceptions.h:338

View

inline std::string cannot_convert_index_to_dtype(const std::string& index_kind, const std::string& dt)

std::string

pd_exceptions.h:375

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

View

inline std::string canonical_dtype_name()

std::string

pd_dataframe_setitem.h:64

View

inline int canonicalise_axis(const std::string& s)

int

pd_where.h:82

View

inline int canonicalise_axis(int i)

int

pd_where.h:92

View

inline std::string canonicalize_dtype_for_promote(std::string_view dt)

std::string

pd_promote.h:532

View

inline std::string categorical_categories_dtype_from_np_dtype(std::string_view np_dt)

std::string

pd_categorical_array.h:2276

View

std::vector<std::vector<std::string>> cats(nlevels)

std::vector<std::vector<std::string>>

pd_dataframe_construct.h:469

inline char cell_to_dtype_kind(const ApplyCellResult& r)

char

pd_apply_result.h:153

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

View

inline ValueClassification classify_value_dtype(const std::string& dt_full)

ValueClassification

pd_value_classify.h:25

View

void clear_cache() const override

void

pd_dataframe.h:42338

View

std::vector<std::vector<T>> col_data(col_values.size(), std::vector<T>(row_keys.size(), default_fill))

std::vector<std::vector<T>>

pd_dataframe.h:43921

View

std::vector<std::vector<std::string>> col_data(n_cols)

std::vector<std::vector<std::string>>

pd_top_level.h:3081

View

std::vector<std::vector<numpy::bool_>> col_mask( col_values.size(), std::vector<numpy::bool_>(row_keys.size(), numpy::bool_(combo_miss_mask_bit)))

std::vector<std::vector<numpy::bool_>>

pd_dataframe.h:43929

std::vector<std::vector<std::string>> col_val_strs(ncols())

std::vector<std::vector<std::string>>

pd_dataframe.h:41118

std::vector<std::vector<std::string>> col_val_strs(ncols())

std::vector<std::vector<std::string>>

pd_dataframe.h:41564

std::vector<std::vector<std::string>> col_val_strs(ncols())

std::vector<std::vector<std::string>>

pd_dataframe.h:41846

std::vector<std::vector<std::string>> col_val_strs(ncols())

std::vector<std::vector<std::string>>

pd_dataframe.h:42123

inline CollectIndexUnionResult collect_index_union(const std::vector<SeriesInfo>& infos)

CollectIndexUnionResult

pd_dataframe_construct.h:880

View

std::istringstream cols_stream(cols_def)

std::istringstream

pd_dataframe.h:38591

std::vector<std::vector<std::string>> columns(col_names.size())

std::vector<std::vector<std::string>>

pd_dataframe.h:35025

View

std::vector<std::vector<std::string>> columns(col_indices.size())

std::vector<std::vector<std::string>>

pd_dataframe.h:37355

View

std::vector<std::vector<std::string>> columns_data(col_names.size())

std::vector<std::vector<std::string>>

pd_dataframe.h:38683

std::vector<std::vector<std::string>> columns_data(group_names.size())

std::vector<std::vector<std::string>>

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

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<DateYMD> compute_holidays(const std::vector<HolidayDef>& rules, DateYMD start, DateYMD end)

std::vector<DateYMD>

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<std::string> convert_ns_strings_to_dates(const std::vector<std::string>& vals)

std::vector<std::string>

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<std::string>& src_dtypes, bool empty_frame )

std::string

pd_dataframe.h:107

numpy::datetime64 current(start)

numpy::datetime64

pd_datetime_index.h:4665

View

inline DisplayConfig current_display_config()

DisplayConfig

pd_display_config.h:37

CutResult<T> cut( const std::vector<T>& x, const std::variant<int, std::vector<T>>& bins, bool right = true, const std::vector<std::string>& labels = {}, bool include_lowest = false, const std::string& duplicates = "raise", bool ordered = true, int precision = 3, bool retbins = false)

CutResult<T>

pd_top_level.h:718

View

inline std::string dataframe_block_common_type( const std::vector<std::string>& src_dtypes, bool any_na_introduction)

std::string

pd_promote.h:595

inline DatetimeIndex date_range( const std::optional<std::string>& start = std::nullopt, const std::optional<std::string>& end = std::nullopt, std::optional<size_t> periods = std::nullopt, const std::string& freq = "D", const std::optional<std::string>& tz = std::nullopt, bool normalize = false, const std::optional<std::string>& name = std::nullopt, const std::string& inclusive = "both", const std::string& unit = "ns", const std::string& tz_display = "")

DatetimeIndex

pd_datetime_index.h:3801

View

inline DatetimeIndex date_range(const std::string& start, int periods, const std::string& freq = "D")

DatetimeIndex

pd_datetime_index.h:4412

View

inline DatetimeIndex date_range_with_offset( const DateOffset& offset, const std::string& start, const std::optional<std::string>& end = std::nullopt, std::optional<size_t> periods = std::nullopt, const std::optional<std::string>& name = std::nullopt)

DatetimeIndex

pd_datetime_index.h:4658

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

View

inline std::vector<std::optional<double>> datetime_index_to_ns_values(const DatetimeIndexT& dti)

std::vector<std::optional<double>>

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

View

inline int day_of_week(int y, int m, int d)

int

pd_holiday.h:47

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

View

inline int days_in_month(int y, int m)

int

pd_holiday.h:37

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<RecordColumn>& columns)

void

pd_dataframe_construct.h:266

View

inline TupleKeyInfo detect_tuple_key_levels( const std::vector<std::pair<bool, size_t>>& key_components)

TupleKeyInfo

pd_dataframe_construct.h:322

View

inline std::pair<bool, std::string> detect_tz_uniformity(const std::vector<std::string>& tz_strings)

std::pair<bool, std::string>

pd_value_classify.h:72

View

numpy::datetime64 dt(sv)

numpy::datetime64

pd_dataframe.h:35373

View

numpy::datetime64 dt(lbl)

numpy::datetime64

pd_dataframe.h:35402

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

View

DatetimeIndex dt_idx(std::move(dt_arr), period_idx->name())

DatetimeIndex

pd_resampler.h:3892

View

inline std::string dtype_category_to_canonical_string(DTypeCategory cat, const DTypeInfo& info)

std::string

pd_dtype_classify.h:154

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

View

inline std::string epoch_ms_to_iso(int64_t ms)

std::string

json.h:258

escape_html(url) + "</a>"

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

View

inline std::vector<int64_t> extract_epoch_seconds(const DatetimeIndex& dti)

std::vector<int64_t>

pd_rolling.h:583

View

std::ofstream file(path, std::ios::binary)

std::ofstream

pd_dataframe.h:29015

View

std::ofstream file(path, std::ios::binary)

std::ofstream

pd_dataframe.h:29659

View

std::ofstream file(path, std::ios::binary)

std::ofstream

pd_dataframe.h:29839

View

std::ofstream file(excel_writer, std::ios::binary)

std::ofstream

pd_dataframe.h:31023

View

std::ofstream file(path, std::ios::binary)

std::ofstream

pd_dataframe.h:33085

View

std::ifstream file(filepath_or_buffer)

std::ifstream

pd_dataframe.h:34680

View

std::ifstream file(path_or_buf)

std::ifstream

pd_dataframe.h:35826

View

std::ifstream file(io, std::ios::binary \| std::ios::ate)

std::ifstream

pd_dataframe.h:36852

View

std::ifstream file(path, std::ios::binary \| std::ios::ate)

std::ifstream

pd_dataframe.h:37827

View

std::ifstream file(con)

std::ifstream

pd_dataframe.h:38567

View

std::ifstream file(path, std::ios::binary \| std::ios::ate)

std::ifstream

pd_dataframe.h:38788

View

std::ifstream file(path, std::ios::binary \| std::ios::ate)

std::ifstream

pd_dataframe.h:39181

View

std::ofstream file(path, std::ios::binary)

std::ofstream

pd_dataframe.h:40327

View

std::ofstream file(path_, std::ios::binary)

std::ofstream

pd_excel.h:607

View

std::ifstream file(path_, std::ios::binary \| std::ios::ate)

std::ifstream

pd_excel.h:976

View

std::ifstream file(filepath_or_buffer)

std::ifstream

pd_top_level.h:2978

View

fill_slot(slot_idx, tmp)

pd_apply_visitor.h:432

inline Series<numpy::float64> finalize_transform_callable( const Series<numpy::float64>& s, TransformCallableResult&& r)

Series<numpy::float64>

pd_apply_visitor.h:451

inline std::string find_common_type(const std::vector<std::string>& src_dtypes)

std::string

pd_promote.h:568

View

inline void flatten_dict(const JsonObject& d, const std::string& prefix, const std::string& sep, int max_level, int level, std::vector<std::pair<std::string, std::string>>& out)

void

json.h:108

View

flatten_dict(child, full_key, sep, max_level, level + 1, out)

json.h:118

View

flatten_dict(rec, "", params.sep, params.max_level, 0, flat)

json_impl.h:405

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<std::string>

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

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

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

View

inline std::string format_pivot_multi_aggfunc( const std::vector<std::vector<std::string>>& index_level_values, const std::vector<std::optional<std::string>>& index_level_names, const std::string& col_level_name, const std::vector<std::string>& aggfuncs, const std::vector<std::string>& sub_columns, const std::vector<std::vector<std::string>>& str_data)

std::string

pd_display_formats.h:150

View

inline std::string format_quantile_label(double q)

std::string

pd_display_formats.h:230

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<const char\*>(&buffer[pos]), expected_start.size())

std::string

pd_dataframe.h:38807

View

std::string found(reinterpret_cast<const char\*>(&buffer[pos]), tag.size())

std::string

pd_dataframe.h:38817

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

View

inline std::vector<std::string> full_bin_labels_for_freq( const std::string& min_label, const std::string& max_label, const std::string& freq)

std::vector<std::string>

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<numpy::float64> gs(std::move(gvals))

pandas::Series<numpy::float64>

pd_groupby.h:1624

bool has_cached_values() const override

bool

pd_dataframe.h:42342

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<std::string>& vals, bool /\*has_nan_token\*/ = true)

std::string

json.h:168

View

inline std::string infer_dtype_override(const Container& values, bool has_nan, bool bool_hint = false)

std::string

pd_dataframe_construct.h:126

View

inline std::string infer_dtype_override_from_kinds(const ValueKindRange& kinds)

std::string

pd_dataframe_construct.h:168

View

inline int infer_float_repr_precision(std::span<const double> vals, int min_precision = 1, int max_precision = 15)

int

pd_format_helpers.h:47

View

inline std::string infer_freq(const DatetimeIndex& index)

std::string

pd_top_level.h:1383

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<std::optional<pandas::Timestamp>>& vec)

SeriesDtypeInferenceResult

pd_series.h:450

void infer_json_column_dtypes(DataFrame& df, bool convert_dates, bool convert_axes, const std::vector<std::string>& convert_dates_explicit = {})

void

json.h:321

inline void infer_json_column_dtypes(DataFrame& result, bool convert_dates, bool convert_axes, const std::vector<std::string>& 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

View

std::vector<std::vector<int64_t>> int_results_per_col(value_cols.size())

std::vector<std::vector<int64_t>>

pd_groupby.h:5166

inline std::string interval_closed_to_string(IntervalClosed closed)

std::string

pd_interval_dtype.h:42

IntervalArray<T> interval_range( std::optional<T> start = std::nullopt, std::optional<T> end = std::nullopt, std::optional<int> periods = std::nullopt, std::optional<T> freq = std::nullopt, const std::string& closed = "right", const std::optional<std::string>& name = std::nullopt)

IntervalArray<T>

pd_top_level.h:1484

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

View

inline std::string invalid_join_type_with_valid_set(const std::string& how)

std::string

pd_exceptions.h:212

View

void invalidate_caches() const

void

pd_dataframe.h:42351

std::istringstream iss(s)

std::istringstream

pd_top_level.h:2362

View

std::istringstream iss(s)

std::istringstream

pd_top_level.h:2549

View

std::istringstream iss(s)

std::istringstream

pd_top_level.h:2652

View

inline bool json_name_is_datelike(const std::string& col_name)

bool

json.h:275

inline DataFrame json_normalize(const std::vector<JsonObject>& records, const NormalizeParams& params)

DataFrame

json_impl.h:318

View

inline DataFrame json_normalize( const std::vector<std::map<std::string, std::variant<double, std::string, std::vector<double>>>>& data, const std::string& record_path = "", const std::vector<std::string>& meta = {}, const std::string& meta_prefix = "", const std::string& sep = ".", const std::string& errors = "raise", std::optional<int> max_level = std::nullopt, const std::string& record_prefix = "")

DataFrame

pd_top_level.h:2210

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

View

omap_set(out, full_key, json_value_to_string(val))

omap_set(out, full_key,

json.h:124

View

std::vector<std::vector<std::string>> kept_levels(header_levels.size())

std::vector<std::vector<std::string>>

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

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<std::string, std::vector<std::string>>& groups, bool dropna = false)

DataFrame

pd_top_level.h:1563

View

std::istringstream lstream(data)

std::istringstream

pd_dataframe.h:35858

make_array_formatter(const ArrayT& arr, const FormatOptions& opts = {})

inline std::unique_ptr<ArrayFormatter>

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<std::vector<std::string>, size_t> make_fixed_width( const std::vector<std::string>& strings, std::string_view justify = "right", size_t minimum = 0, std::optional<size_t> max_colwidth = std::nullopt, std::shared_ptr<TextAdjustment> adj = nullptr)

std::pair<std::vector<std::string>, 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<DateOffset> make_offset_from_string( const std::string& freq_str, int periods)

std::unique_ptr<DateOffset>

pd_series_shift.h:15

View

inline std::shared_ptr<NDFrameBase> make_series_from_data_arg( const DataArg& data, const DTypeHint& /\*dtype_hint\*/, const IndexHint& /\*index_hint\*/, const NameHint& name_hint )

std::shared_ptr<NDFrameBase>

pd_series_apply_dispatch.h:760

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<double>::quiet_NaN() )

std::string

pd_promote.h:89

View

Series<numpy::int64> memory_usage(bool index = true, bool deep = false) const

Series<numpy::int64>

pd_dataframe.h:27992

View

size_t memory_usage_total(bool deep = false) const

size_t

pd_dataframe.h:28096

View

MultiIndex mi(std::move(levels), std::move(codes))

MultiIndex

pd_series.h:16453

View

MultiIndex mi(std::move(levels), std::move(codes))

MultiIndex

pd_series.h:16501

View

std::vector<std::vector<std::string>> mi_arrays(row_levels.size())

std::vector<std::vector<std::string>>

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<std::optional<std::string>> na_assignments(x.size(), std::nullopt)

std::vector<std::optional<std::string>>

pd_top_level.h:1047

std::vector<std::optional<std::string>> na_assignments(x.size(), std::nullopt)

std::vector<std::optional<std::string>>

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<const char\*>(&buffer[pos + 30]), name_len)

std::string

pd_dataframe.h:36907

View

std::string name(reinterpret_cast<const char\*>(&file_buffer_[pos + 30]), name_len)

std::string

pd_excel.h:1027

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

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

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

View

inline std::string numeric_only_false_sum_hint(const std::string& op)

std::string

pd_exceptions.h:334

View

inline void omap_set(std::vector<std::pair<std::string, std::string>>& out, const std::string& key, std::string value)

void

json.h:96

omap_set(out, full_key, "<dict>")

json.h:120

omap_set(out, full_key, "[<array>]")

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

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

View

std::string out(buf)

std::string

pd_timedelta64_formatter.h:92

View

std::vector<std::complex<double>> out_cx(this->size())

std::vector<std::complex<double>>

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

View

inline ResampleFreq parse_base_freq(const std::string& unit)

ResampleFreq

pd_resampler.h:115

View

inline int parse_closed_param(const std::string& closed_str)

int

pd_rolling.h:571

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<ResampleFreq, int> parse_freq_with_multiplier(const std::string& freq)

std::pair<ResampleFreq, int>

pd_resampler.h:136

inline IntervalClosed parse_interval_closed(const std::string& s)

IntervalClosed

pd_interval_dtype.h:58

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

View

inline PeriodFrequency parse_period_freq(const std::string& freq_str)

PeriodFrequency

pd_period_freq.h:45

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<numpy::float64>& s, const pandas::DatetimeIndex& dti, const std::string& label)

PartialDateResult

pd_datetime_utils.h:137

View

inline PeriodArray period_array(const numpy::NDArray<numpy::int64>& 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

View

PeriodIndex period_idx(std::move(period_arr), dt_idx->name())

PeriodIndex

pd_resampler.h:3840

View

inline std::string pluralize_offset_name(const std::string& singular, int64_t n)

std::string

pd_dateoffset.h:142

View

std::vector<std::vector<std::string>> preformatted(ncols())

std::vector<std::vector<std::string>>

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

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

View

put(key, value, format, index, false)

pd_dataframe.h:44275

put(key, combined, format, index, false)

pd_dataframe.h:44287

CutResult<T> qcut( const std::vector<T>& x, int q, const std::vector<std::string>& labels = {}, const std::string& duplicates = "raise", int precision = 3, bool retbins = false)

CutResult<T>

pd_top_level.h:979

View

CutResult<T> qcut( const std::vector<T>& x, const std::vector<T>& q_list, const std::vector<std::string>& labels = {}, const std::string& duplicates = "raise", int precision = 3)

CutResult<T>

pd_top_level.h:1072

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

View

std::regex re(pattern)

std::regex

pd_top_level.h:1668

inline DataFrame read_clipboard()

DataFrame

pd_top_level.h:2872

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<size_t> chunksize = std::nullopt, const std::string& comment = "", [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::map<std::string, std::function<std::string(const std::string&)>>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function<std::string(const std::string&)>& 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<std::string>& 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<std::string>& na_values = {}, const std::vector<std::string>& names = {}, std::optional<size_t> nrows = std::nullopt, const std::string& on_bad_lines = "error", const std::vector<int>& parse_dates = {}, const std::string& quotechar = "\\"", int quoting = 0, bool skip_blank_lines = true, [[maybe_unused]] std::optional<size_t> skipfooter = std::nullopt, bool skipinitialspace = false, std::optional<size_t> skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector<std::string>& true_values = {}, const std::vector<std::string>& usecols = {}, [[maybe_unused]] bool verbose = false, // Extended parameters (for migration from binding) const std::set<int>& skiprows_set = {}, const std::map<std::string, std::string>& dtype_map = {}, bool parse_dates_bool = false, const std::vector<int>& usecols_positions = {}, const std::vector<int>& header_rows = {}, const std::vector<std::string>& index_col_list = {}, const std::vector<int>& index_col_pos_list = {})

static DataFrame

pd_dataframe.h:34617

View

static DataFrame read_csv(const std::string& filepath, const std::map<std::string, CsvOption>& options)

static DataFrame

pd_dataframe.h:35505

View

static DataFrame read_csv(const std::string& source, const std::map<std::string, CsvOption>& options, bool source_is_content)

static DataFrame

pd_dataframe.h:35514

View

static DataFrame read_csv(const std::string& filepath, std::initializer_list<std::pair<const std::string, CsvOption>> options)

static DataFrame

pd_dataframe.h:35521

View

static DataFrame read_csv_options_impl(const std::string& filepath, const std::map<std::string, CsvOption>& 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<std::string>& names = {}, const std::vector<std::string>& usecols = {}, const std::string& dtype = "", const std::string& comment = "", [[maybe_unused]] const std::map<std::string, std::function<std::string(const std::string&)>>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function<std::string(const std::string&)>& 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<std::string, std::string>& engine_kwargs = {}, const std::vector<std::string>& false_values = {}, const std::string& index_col = "", bool keep_default_na = true, const std::vector<std::string>& na_filter = {}, const std::vector<std::string>& na_values = {}, std::optional<size_t> nrows = std::nullopt, const std::vector<int>& parse_dates = {}, std::optional<size_t> skipfooter = std::nullopt, std::optional<size_t> skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector<std::string>& true_values = {}, [[maybe_unused]] bool verbose = false, // plan_09b: dispatcher-only extension parameters. const std::vector<int>& header_rows = {}, const std::vector<int>& usecols_positions = {}, const std::set<int>& skiprows_set = {}, std::optional<int> index_col_position = std::nullopt, std::optional<int> sheet_index = std::nullopt)

static DataFrame

pd_dataframe.h:36816

View

static DataFrame read_excel(const std::string& io, const std::map<std::string, ExcelOption>& options)

static DataFrame

pd_dataframe.h:37627

View

static DataFrame read_excel(const std::string& io, std::initializer_list<std::pair<const std::string, ExcelOption>> options)

static DataFrame

pd_dataframe.h:37781

View

inline DataFrame read_excel( const std::string& io, [[maybe_unused]] const std::variant<int, std::string>& sheet_name = 0, [[maybe_unused]] int header = 0, [[maybe_unused]] const std::vector<std::string>& names = {}, [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector<std::string>& usecols = {}, [[maybe_unused]] const std::string& dtype = "", [[maybe_unused]] const std::string& engine = "", [[maybe_unused]] const std::map<std::string, std::function<std::string(const std::string&)>>& converters = {}, [[maybe_unused]] const std::vector<std::string>& true_values = {}, [[maybe_unused]] const std::vector<std::string>& false_values = {}, [[maybe_unused]] std::optional<size_t> skiprows = std::nullopt, [[maybe_unused]] std::optional<size_t> nrows = std::nullopt, [[maybe_unused]] const std::vector<std::string>& 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<int>& 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<size_t> skipfooter = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& dtype_backend = "")

DataFrame

pd_top_level.h:2911

View

static DataFrame read_feather( const std::string& path, [[maybe_unused]] const std::vector<std::string>& 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

View

inline DataFrame read_feather(const std::string& path)

DataFrame

pd_top_level.h:2946

View

inline DataFrame read_fwf( const std::string& filepath_or_buffer, [[maybe_unused]] std::optional<size_t> chunksize = std::nullopt, const std::vector<std::pair<int, int>>& colspecs = {}, [[maybe_unused]] const std::string& dtype_backend = "", int infer_nrows = 100, [[maybe_unused]] bool iterator = false, const std::vector<int>& 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<std::string>& 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<std::string, std::string>& configuration = {}, [[maybe_unused]] const std::string& credentials = "", [[maybe_unused]] bool use_bqstorage_api = false, [[maybe_unused]] std::optional<size_t> 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<size_t> chunksize = std::nullopt, const std::vector<std::string>& columns = {}, [[maybe_unused]] const std::string& errors = "strict", bool iterator = false, [[maybe_unused]] const std::string& mode = "r", std::optional<size_t> start = std::nullopt, std::optional<size_t> stop = std::nullopt, [[maybe_unused]] const std::string& where = "")

static DataFrame

pd_dataframe.h:38277

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<size_t> start = std::nullopt, std::optional<size_t> stop = std::nullopt, const std::vector<std::string>& columns = {}, bool iterator = false, std::optional<size_t> chunksize = std::nullopt)

DataFrame

pd_top_level.h:3223

View

inline std::vector<DataFrame> read_html( const std::string& io, [[maybe_unused]] const std::map<std::string, std::string>& attrs = {}, [[maybe_unused]] const std::map<std::string, std::function<std::string(const std::string&)>>& 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<std::string>& na_values = {}, [[maybe_unused]] bool parse_dates = false, [[maybe_unused]] std::optional<size_t> skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] const std::string& thousands = "")

std::vector<DataFrame>

pd_top_level.h:3265

static DataFrame read_json(const std::string& source, const std::map<std::string, JsonOption>& options)

static DataFrame

pd_dataframe.h:35749

View

static DataFrame read_json(const std::string& source, const std::map<std::string, JsonOption>& options, bool source_is_content)

static DataFrame

pd_dataframe.h:35758

View

static DataFrame read_json(const std::string& source, std::initializer_list<std::pair<const std::string, JsonOption>> options)

static DataFrame

pd_dataframe.h:35765

View

static DataFrame read_json( const std::string& path_or_buf, const std::string& orient = "columns", [[maybe_unused]] std::optional<size_t> chunksize = std::nullopt, [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] bool convert_axes = true, const std::vector<std::string>& 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<size_t> 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

View

static DataFrame read_json_options_impl(const std::string& source, const std::map<std::string, JsonOption>& options, bool source_is_content)

static DataFrame

pd_dataframe.h:36604

inline DataFrame read_orc( const std::string& path, std::optional<std::vector<std::string>> 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<std::string>& 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<std::vector<std::string>>& filters = {}, [[maybe_unused]] const std::string& storage_options = "", [[maybe_unused]] bool use_nullable_dtypes = false)

static DataFrame

pd_dataframe.h:37816

View

inline DataFrame read_parquet(const std::string& path)

DataFrame

pd_top_level.h:3313

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

View

inline DataFrame read_sas( const std::string& filepath_or_buffer, [[maybe_unused]] std::optional<size_t> 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

View

inline DataFrame read_spss( const std::string& path, std::optional<std::vector<std::string>> usecols = std::nullopt, bool convert_categoricals = true, const std::string& dtype_backend = "")

DataFrame

pd_top_level.h:3370

View

static DataFrame read_sql( [[maybe_unused]] const std::string& sql, const std::string& con, [[maybe_unused]] const std::vector<std::string>& columns = {}, [[maybe_unused]] std::optional<size_t> chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::map<std::string, std::string>& dtype = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector<std::string>& params = {}, [[maybe_unused]] const std::vector<std::string>& parse_dates = {})

static DataFrame

pd_dataframe.h:38554

View

inline DataFrame read_sql(const std::string& sql, const std::string& con)

DataFrame

pd_top_level.h:3388

View

inline DataFrame read_sql_query( const std::string& sql, const std::string& con, [[maybe_unused]] std::optional<size_t> chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::map<std::string, std::string>& dtype = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector<std::string>& params = {}, [[maybe_unused]] const std::vector<std::string>& 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<size_t> chunksize = std::nullopt, [[maybe_unused]] bool coerce_float = true, [[maybe_unused]] const std::vector<std::string>& columns = {}, [[maybe_unused]] const std::string& dtype_backend = "", [[maybe_unused]] const std::string& index_col = "", [[maybe_unused]] const std::vector<std::string>& 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<size_t> chunksize = std::nullopt, [[maybe_unused]] const std::vector<std::string>& 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

View

inline DataFrame read_stata( const std::string& filepath_or_buffer, [[maybe_unused]] bool iterator = false)

DataFrame

pd_top_level.h:3462

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<size_t> chunksize = std::nullopt, const std::string& comment = "", [[maybe_unused]] const std::string& compression = "infer", [[maybe_unused]] const std::map<std::string, std::function<std::string(const std::string&)>>& converters = {}, [[maybe_unused]] const std::string& date_format = "", [[maybe_unused]] const std::function<std::string(const std::string&)>& 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<std::string>& 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<std::string>& names = {}, const std::vector<std::string>& na_values = {}, std::optional<size_t> nrows = std::nullopt, const std::string& on_bad_lines = "error", const std::vector<int>& parse_dates = {}, const std::string& quotechar = "\\"", int quoting = 0, bool skip_blank_lines = true, [[maybe_unused]] std::optional<size_t> skipfooter = std::nullopt, bool skipinitialspace = false, std::optional<size_t> skiprows = std::nullopt, [[maybe_unused]] const std::string& storage_options = "", const std::string& thousands = "", const std::vector<std::string>& true_values = {}, const std::vector<std::string>& usecols = {}, [[maybe_unused]] bool verbose = false)

DataFrame

pd_top_level.h:3542

View

inline DataFrame read_table(const std::string& filepath_or_buffer, const std::map<std::string, DataFrame::CsvOption>& options, bool source_is_content = false)

DataFrame

pd_top_level.h:3636

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<std::string, std::function<std::string(const std::string&)>>& 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<std::string>& iterparse = {}, [[maybe_unused]] const std::vector<std::string>& names = {}, [[maybe_unused]] const std::map<std::string, std::string>& namespaces = {}, [[maybe_unused]] const std::vector<int>& 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

View

inline pandas::MultiIndex reconstruct_multiindex_from_levels_codes( const std::vector<std::vector<std::string>>& levels, const std::vector<std::vector<int64_t>>& codes, std::vector<std::optional<std::string>> names = {})

pandas::MultiIndex

pd_dataframe_construct.h:379

View

inline DataFrameT records_to_dataframe(const std::vector<RecordColumn>& columns)

DataFrameT

pd_dataframe_construct.h:288

View

std::string repr() const override

std::string

pd_dataframe.h:42323

View

inline void reset_option(const std::string& key)

void

pd_top_level.h:317

View

inline std::string resolve_grouper_level( const Grouper& g, const DataFrame& df, std::shared_ptr<DataFrame>& df_ptr)

std::string

pd_groupby.h:3967

inline std::size_t resolve_level_idx_(const RenameLevelMapper& lm, const std::vector<std::string>& names)

std::size_t

pd_rename_spec_impl.h:79

inline std::string resolve_result_dtype( const std::vector<std::string>& input_dtypes, const std::string& op, bool na_present)

std::string

pd_promote.h:920

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

View

inline int64_t resolve_string_endpoint_ns(const std::string& date_str, const std::string& side)

int64_t

pd_datetime_utils.h:87

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

View

Timestamp result(result_utc, "")

Timestamp

pd_dateoffset_apply.h:49

View

DatetimeIndex result(out, this->name())

DatetimeIndex

pd_datetime_index.h:3767

View

DatetimeIndex result(std::move(arr), name)

DatetimeIndex

pd_datetime_index.h:4387

View

DatetimeIndex result(std::move(arr), name)

DatetimeIndex

pd_datetime_index.h:4574

View

DatetimeIndex result(std::move(arr), name)

DatetimeIndex

pd_datetime_index.h:4598

View

DatetimeIndex result(std::move(arr), name)

DatetimeIndex

pd_datetime_index.h:4627

View

DatetimeIndex result(std::move(arr), name)

DatetimeIndex

pd_datetime_index.h:4646

View

pandas::Series<numpy::float64> result(result_vals, s.name())

pandas::Series<numpy::float64>

pd_datetime_utils.h:114

View

DataFrameGroupBy result(\*df_ptr, col_name, as_index, actual_sort, actual_dropna, actual_observed, group_keys)

DataFrameGroupBy

pd_groupby.h:4116

View

DataFrameGroupBy result(\*df_ptr, col_name, as_index, actual_sort, actual_dropna, actual_observed, group_keys)

DataFrameGroupBy

pd_groupby.h:4128

View

DataFrameGroupBy result(\*df_ptr, keys, as_index, sort, dropna, actual_observed, group_keys)

DataFrameGroupBy

pd_groupby.h:4232

View

std::vector<std::vector<double>> result(nrows, std::vector<double>(ncols, 0.0))

std::vector<std::vector<double>>

pd_top_level.h:413

View

std::vector<std::vector<std::string>> results_per_col(value_cols.size())

std::vector<std::vector<std::string>>

pd_groupby.h:5165

std::vector<std::optional<size_t>> right_matches(left_n)

std::vector<std::optional<size_t>>

pd_top_level.h:1965

inline int64_t round_ns_1000(double val)

int64_t

pd_value_classify.h:66

View

inline ExtensionDtypeRouteResult route_extension_dtype(const std::string& dtype_label)

ExtensionDtypeRouteResult

pd_extension_dtype_router.h:75

View

std::string s(suf)

std::string

json.h:279

View

std::string s(buf, ptr)

std::string

pd_categorical_array.h:2302

View

std::string_view s(dtype_label)

std::string_view

pd_extension_dtype_router.h:77

View

std::string s(buf, ptr)

std::string

pd_series.h:172

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

View

DataFrame series_broadcast_op( const Series<numpy::float64>& other, int axis, std::optional<double> fill_value, Op op, std::optional<int> level = std::nullopt ) const

DataFrame

pd_dataframe.h:42757

DataFrame series_compare_op( const Series<numpy::float64>& other, int axis, CompOp op ) const

DataFrame

pd_dataframe.h:42861

inline Series<numpy::float64> series_from_coo( const std::vector<double>& data, const std::vector<int64_t>& row_idx, const std::vector<int64_t>& col_idx, int64_t nrows, int64_t ncols, bool dense_index = false)

Series<numpy::float64>

pd_series.h:16394

View

inline std::vector<std::optional<std::string>> series_to_optional_string_vector(const Series<std::string>& s)

std::vector<std::optional<std::string>>

pd_categorical_constructors.h:14

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

View

inline void set_eng_float_format(int accuracy = 3, bool use_eng_prefix = true)

void

pd_top_level.h:2851

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

View

static void set_max_rows(size_t rows)

static void

pd_config.h:22

View

inline void set_multiindex_with_tuple_labels(DataFrameT& df, pandas::MultiIndex mi)

void

pd_dataframe_construct.h:419

View

static void set_na_repr(const char\* repr)

static void

pd_config.h:18

View

inline void set_option(const std::string& key, const T& value)

void

pd_top_level.h:309

View

set_option("display.precision", static_cast<int64_t>(accuracy))

pd_top_level.h:2853

View

set_option("display.float_format", std::string("eng"))

pd_top_level.h:2856

View

set_option("display.float_format", std::string(""))

pd_top_level.h:2858

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<T> setup_time_rolling(const Series<T>& s, const std::string& offset_str, const std::string& closed_str = "", size_t min_periods = 1)

Rolling<T>

pd_rolling.h:606

View

sheet_order_(std::move(other.sheet_order_))

pd_excel.h:215

inline std::string show_versions()

std::string

pd_top_level.h:2794

View

inline pandas::Series<numpy::float64> slice_by_ns_range( const pandas::Series<numpy::float64>& s, const pandas::DatetimeIndex& dti, int64_t start_ns, int64_t end_ns)

pandas::Series<numpy::float64>

pd_datetime_utils.h:93

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<std::vector<std::string>> sparsified(n_levels)

std::vector<std::vector<std::string>>

pd_display_formats.h:126

inline std::vector<std::vector<std::string>> sparsify_labels( const std::vector<std::vector<std::string>>& index_level_values)

std::vector<std::vector<std::string>>

pd_display_formats.h:121

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

View

std::istringstream ss(props)

std::istringstream

pd_styler.h:1038

View

std::istringstream ss(props)

std::istringstream

pd_styler.h:1114

View

std::istringstream ss(props)

std::istringstream

pd_styler.h:1186

View

std::istringstream ss(props)

std::istringstream

pd_styler.h:1257

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<T>, "FloatingArray requires a floating-point type")

class FloatingArray {

pd_floating_array.h:42

View

static_assert(std::is_floating_point_v<T>, "FloatingDtype requires a floating-point type")

class FloatingDtype : public ExtensionDtype {

pd_floating_dtype.h:26

View

static_assert(std::is_integral_v<T>, "IntegerArray requires an integral type")

class IntegerArray {

pd_integer_array.h:39

View

static_assert(std::is_integral_v<T>, "IntegerDtype requires an integral type")

class IntegerDtype : public ExtensionDtype {

pd_integer_dtype.h:24

View

static_assert(std::is_arithmetic_v<T>, "IntervalArray requires an arithmetic type")

class IntervalArray {

pd_interval_array.h:45

View

static_assert(std::is_arithmetic_v<T>, "IntervalDtype requires an arithmetic type")

class IntervalDtype : public ExtensionDtype {

pd_interval_dtype.h:77

View

static_assert(std::is_arithmetic_v<T>, "Interval requires an arithmetic type")

class Interval {

pd_interval_dtype.h:240

View

static_assert(std::is_arithmetic_v<T>, "IntervalIndex requires an arithmetic type")

class IntervalIndex : public ExtensionIndex<IntervalArray<T>> {

pd_interval_index.h:43

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

View

HDF5Store store(path, "r")

HDF5Store

pd_dataframe.h:38296

View

std::vector<std::vector<std::string>> str_cols(ncols)

std::vector<std::vector<std::string>>

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

View

pandas::Timedelta td(s)

pandas::Timedelta

pd_timedelta_index.h:3331

View

pandas::Timedelta td(s)

pandas::Timedelta

pd_top_level.h:2643

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

View

inline int64_t timedelta64_to_ns(const numpy::timedelta64& td)

int64_t

pd_dataframe_construct.h:64

View

inline std::vector<std::optional<double>> timedelta_index_to_ns_values(const TimedeltaIndexT& tdi)

std::vector<std::optional<double>>

pd_dataframe_construct.h:96

inline TimedeltaIndex timedelta_range( const std::optional<std::string>& start = std::nullopt, const std::optional<std::string>& end = std::nullopt, std::optional<size_t> periods = std::nullopt, const std::string& freq = "D", const std::optional<std::string>& name = std::nullopt, const std::string& closed = "both", const std::string& unit = "ns")

TimedeltaIndex

pd_timedelta_index.h:3272

View

timegm(&tm)

pd_holiday.h:66

inline std::vector<EvalToken> tokenize_eval(const std::string& expr)

std::vector<EvalToken>

pd_dataframe.h:443

inline std::string_view trim(std::string_view s)

std::string_view

pd_dtype_override.h:68

View

inline void trim_zeros_column(std::vector<std::string>& vals)

void

pd_series.h:265

trim_zeros_column(vals)

pd_series.h:367

inline std::vector<size_t> truncate_indices(size_t len, size_t max_display)

std::vector<size_t>

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

View

pandas::Timestamp ts(s)

pandas::Timestamp

pd_datetime_index.h:4492

View

pandas::Timestamp ts(year[i], month[i], day[i], h, m, s, 0, 0, "")

pandas::Timestamp

pd_top_level.h:2602

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

View

inline std::string undefined_variable_in_query(const std::string& name)

std::string

pd_exceptions.h:402

View

inline int64_t unit_string_to_ns_multiplier( const std::string& unit, UnitDefault when_empty)

int64_t

pd_top_level.h:2436

View

inline std::string unknown_interpolation_method(const std::string& method)

std::string

pd_exceptions.h:271

View

inline std::string unsorted_index(const std::string& key)

std::string

pd_exceptions.h:407

View

inline std::string unsorted_index_key_vs_depth(size_t key_len, size_t lexsort_depth)

std::string

pd_exceptions.h:424

View

inline std::string unsupported_binop(const std::string& op, const std::string& lhs, const std::string& rhs)

std::string

pd_exceptions.h:342

View

inline std::string unsupported_dtype(const std::string& dt)

std::string

pd_exceptions.h:364

View

inline std::string unsupported_dtype_for_multiindex(const std::string& dt)

std::string

pd_exceptions.h:379

View

inline std::string unsupported_dtype_quoted(const std::string& dt, const std::string& supported_list)

std::string

pd_exceptions.h:367

View

inline std::string unsupported_op(const std::string& op, const std::string& dtype)

std::string

pd_exceptions.h:296

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<HolidayDef> us_federal_holiday_rules()

std::vector<HolidayDef>

pd_holiday.h:186

std::vector<std::vector<int64_t>> valid_counts(nrows, std::vector<int64_t>(ncols, 0))

std::vector<std::vector<int64_t>>

pd_top_level.h:420

static const char\* version()

static const char*

pd_config.h:9

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<std::string>& stubnames, const std::vector<std::string>& i, const std::string& j, const std::string& sep = "", const std::string& suffix = "\\\\d+")

DataFrame

pd_top_level.h:1651

View

write_byte(static_cast<uint8_t>(data_label.length()))

pd_dataframe.h:32542

write_byte(static_cast<uint8_t>(c))

pd_dataframe.h:32545

write_byte(static_cast<uint8_t>(ts.length()))

pd_dataframe.h:32561

write_byte(static_cast<uint8_t>(c))

pd_dataframe.h:32563

write_byte(static_cast<uint8_t>(missing_int8))

pd_dataframe.h:32703

write_byte(static_cast<uint8_t>(static_cast<int8_t>(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<uint8_t>(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<uint8_t>(col.stata_type))

pd_dataframe.h:32899

write_byte(static_cast<uint8_t>(col.stata_type))

pd_dataframe.h:32901

write_byte(0x00)

pd_dataframe.h:32940

write_byte(static_cast<uint8_t>(missing_int8))

pd_dataframe.h:32988

write_byte(static_cast<uint8_t>(static_cast<int8_t>(val)))

pd_dataframe.h:32991

write_byte(0)

pd_dataframe.h:33059

write_byte(static_cast<uint8_t>(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<float>(val))

pd_dataframe.h:32732

write_float32(missing_f)

pd_dataframe.h:33011

write_float32(static_cast<float>(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<int16_t>(val))

pd_dataframe.h:32714

write_int16(static_cast<int16_t>(nvar))

pd_dataframe.h:32875

write_int16(0)

pd_dataframe.h:32916

write_int16(missing_int16)

pd_dataframe.h:32995

write_int16(static_cast<int16_t>(val))

pd_dataframe.h:32998

write_int32(missing_int32)

pd_dataframe.h:32682

write_int32(static_cast<int32_t>(val))

pd_dataframe.h:32684

write_int32(missing_int32)

pd_dataframe.h:32719

write_int32(static_cast<int32_t>(val))

pd_dataframe.h:32722

write_int32(lbl_len)

pd_dataframe.h:32794

write_int32(static_cast<int32_t>(labels.size()))

pd_dataframe.h:32805

write_int32(static_cast<int32_t>(txt_len))

pd_dataframe.h:32808

write_int32(offset)

pd_dataframe.h:32813

write_int32(val)

pd_dataframe.h:32819

write_int32(static_cast<int32_t>(nobs))

pd_dataframe.h:32878

write_int32(static_cast<int32_t>(val))

pd_dataframe.h:32974

write_int32(missing_int32)

pd_dataframe.h:33002

write_int32(static_cast<int32_t>(val))

pd_dataframe.h:33005

write_int32(lbl_len)

pd_dataframe.h:33057

write_int32(static_cast<int32_t>(labels.size()))

pd_dataframe.h:33060

write_int32(static_cast<int32_t>(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<int64_t>(nobs))

pd_dataframe.h:32530

write_le32(body_buffer, static_cast<int32_t>(val))

pd_dataframe.h:39565

write_le32(body_buffer, static_cast<int32_t>(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<int32_t>(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<int64_t>(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("<stata_dta>")

pd_dataframe.h:32505

write_tag("<header>")

pd_dataframe.h:32506

write_tag("<release>")

pd_dataframe.h:32509

write_tag(std::to_string(version))

pd_dataframe.h:32510

write_tag("</release>")

pd_dataframe.h:32511

write_tag("<byteorder>")

pd_dataframe.h:32514

write_tag(big_endian ? "MSF" : "LSF")

pd_dataframe.h:32515

write_tag("</byteorder>")

pd_dataframe.h:32516

write_tag("<K>")

pd_dataframe.h:32519

write_tag("</K>")

pd_dataframe.h:32525

write_tag("<N>")

pd_dataframe.h:32528

write_tag("</N>")

pd_dataframe.h:32534

write_tag("<label>")

pd_dataframe.h:32537

write_tag("</label>")

pd_dataframe.h:32547

write_tag("<timestamp>")

pd_dataframe.h:32550

write_tag("</timestamp>")

pd_dataframe.h:32565

write_tag("</header>")

pd_dataframe.h:32567

write_tag("<map>")

pd_dataframe.h:32571

write_tag("</map>")

pd_dataframe.h:32575

write_tag("<variable_types>")

pd_dataframe.h:32579

write_tag("</variable_types>")

pd_dataframe.h:32583

write_tag("<varnames>")

pd_dataframe.h:32587

write_tag("</varnames>")

pd_dataframe.h:32595

write_tag("<sortlist>")

pd_dataframe.h:32599

write_tag("</sortlist>")

pd_dataframe.h:32603

write_tag("<formats>")

pd_dataframe.h:32607

write_tag("</formats>")

pd_dataframe.h:32611

write_tag("<value_label_names>")

pd_dataframe.h:32615

write_tag("</value_label_names>")

pd_dataframe.h:32624

write_tag("<variable_labels>")

pd_dataframe.h:32628

write_tag("</variable_labels>")

pd_dataframe.h:32632

write_tag("<characteristics>")

pd_dataframe.h:32636

write_tag("</characteristics>")

pd_dataframe.h:32637

write_tag("<data>")

pd_dataframe.h:32641

write_tag("</data>")

pd_dataframe.h:32758

write_tag("<strls>")

pd_dataframe.h:32762

write_tag("</strls>")

pd_dataframe.h:32763

write_tag("<value_labels>")

pd_dataframe.h:32767

write_tag("<lbl>")

pd_dataframe.h:32778

write_tag("</lbl>")

pd_dataframe.h:32830

write_tag("</value_labels>")

pd_dataframe.h:32835

write_tag("</stata_dta>")

pd_dataframe.h:32839

write_u16(static_cast<uint16_t>(entry.name.size()))

pd_excel.h:560

write_u16(static_cast<uint16_t>(entry.name.size()))

pd_excel.h:583

write_u16(static_cast<uint16_t>(zip_entries.size()))

pd_excel.h:600

write_u16(static_cast<uint16_t>(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<uint32_t>(entry.data.size()))

pd_excel.h:558

write_u32(static_cast<uint32_t>(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<uint32_t>(entry.data.size()))

pd_excel.h:581

write_u32(static_cast<uint32_t>(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<uint16_t>(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<uint32_t>(str.size()))

pd_dataframe.h:29778

write_uint32(0)

pd_dataframe.h:29809

write_uint32(static_cast<uint32_t>(ncols()))

pd_dataframe.h:29814

write_uint32(static_cast<uint32_t>(nvar))

pd_dataframe.h:32521

write_uint32(static_cast<uint32_t>(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<int64_t>(page_data.size()))

pd_dataframe.h:29321

write_zigzag_to(page_header, static_cast<int64_t>(page_data.size()))

pd_dataframe.h:29325

write_zigzag_to(page_header, static_cast<int64_t>(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<int64_t>(page_data.size()))

pd_dataframe.h:29464

write_zigzag_to(page_header, static_cast<int64_t>(page_data.size()))

pd_dataframe.h:29468

write_zigzag_to(page_header, static_cast<int64_t>(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<int64_t>(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<int64_t>(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<int64_t>(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.

to_clipboard (pd_test_2_all.cpp:10176)
10166        std::cout << "====================================== [OK] pd_test_swaplevel test suite ========================== " << std::endl;
10167        return 0;
10168    }
10169
10170} // namespace dataframe_tests
10171// ------------------- pd_test_swaplevel.cpp (end) -----------------------------
10172
10173// ------------------- pd_test_to_clipboard.cpp (start) -----------------------------
10174// pd_test_to_clipboard.cpp
10175// Tests for DataFrame.to_clipboard() method
10176
10177#include <iostream>
10178#include <string>
10179#include <vector>
10180#include <map>
10181#include <sstream>
10182#include <stdexcept>
10183#include <limits>
10184
10185#include "../pandas/pd_dataframe.h"
to_datetime (pd_test_3_all.cpp:13652)
13642    }
13643
13644    std::cout << " -> tests passed" << std::endl;
13645}
13646
13647// ============================================================================
13648// To Datetime / To Timedelta Tests
13649// ============================================================================
13650
13651void pd_test_top_level_to_datetime() {
13652    std::cout << "========= to_datetime() ===============================";
13653
13654    std::vector<std::string> dates = {
13655        "2023-01-15",
13656        "2023-06-20",
13657        "2023-12-31"
13658    };
13659
13660    pandas::DatetimeArray result = pandas::to_datetime(dates);
13661
13662    if (result.size() != 3) {
to_datetime (pd_test_3_all.cpp:13652)
13642    }
13643
13644    std::cout << " -> tests passed" << std::endl;
13645}
13646
13647// ============================================================================
13648// To Datetime / To Timedelta Tests
13649// ============================================================================
13650
13651void pd_test_top_level_to_datetime() {
13652    std::cout << "========= to_datetime() ===============================";
13653
13654    std::vector<std::string> dates = {
13655        "2023-01-15",
13656        "2023-06-20",
13657        "2023-12-31"
13658    };
13659
13660    pandas::DatetimeArray result = pandas::to_datetime(dates);
13661
13662    if (result.size() != 3) {
to_datetime_from_columns (pd_test_2_all.cpp:22794)
22784// =====================================================================
22785// DataFrame column assembly tests
22786// =====================================================================
22787
22788void test_to_datetime_from_columns_basic() {
22789    std::cout << "  -- test_to_datetime_from_columns_basic --" << std::endl;
22790    std::vector<int> years  = {2020, 2021, 2022};
22791    std::vector<int> months = {1, 6, 12};
22792    std::vector<int> days   = {15, 20, 25};
22793    auto arr = pandas::to_datetime_from_columns(years, months, days);
22794    check(arr.size() == 3, "size==3");
22795
22796    auto v0 = arr[0];
22797    check(v0.has_value(), "v0_has_value");
22798    if (v0.has_value()) {
22799        pandas::Timestamp ts(v0->getValue());
22800        check(ts.year() == 2020, "v0_year==2020");
22801        check(ts.month() == 1, "v0_month==1");
22802        check(ts.day() == 15, "v0_day==15");
22803        check(ts.hour() == 0, "v0_hour==0");
to_datetime_mixed (pd_test_2_all.cpp:22721)
22711    check(ns_frac == 500000000LL, "fractional==500ms");
22712}
22713
22714// =====================================================================
22715// Mixed format tests
22716// =====================================================================
22717
22718void test_to_datetime_mixed_iso() {
22719    std::cout << "  -- test_to_datetime_mixed_iso --" << std::endl;
22720    std::vector<std::string> vals = {"2020-01-01", "2020/06/15"};
22721    auto arr = pandas::to_datetime_mixed(vals);
22722    check(arr.size() == 2, "size==2");
22723    auto v0 = arr[0];
22724    check(v0.has_value(), "v0_has_value");
22725    if (v0.has_value()) {
22726        pandas::Timestamp ts(v0->getValue());
22727        check(ts.year() == 2020, "v0_year==2020");
22728        check(ts.month() == 1, "v0_month==1");
22729        check(ts.day() == 1, "v0_day==1");
22730    }
22731    auto v1 = arr[1];
to_datetime_numeric (pd_test_2_all.cpp:22585)
22575}
22576
22577// =====================================================================
22578// Numeric epoch tests
22579// =====================================================================
22580
22581void test_to_datetime_numeric_seconds() {
22582    std::cout << "  -- test_to_datetime_numeric_seconds --" << std::endl;
22583    // 1490195805 seconds = 2017-03-22 15:16:45 UTC
22584    std::vector<double> vals = {1490195805.0};
22585    auto arr = pandas::to_datetime_numeric(vals, "s");
22586    check(arr.size() == 1, "size==1");
22587    auto v = arr[0];
22588    check(v.has_value(), "has_value");
22589    if (v.has_value()) {
22590        pandas::Timestamp ts(v->getValue());
22591        check(ts.year() == 2017, "year==2017");
22592        check(ts.month() == 3, "month==3");
22593        check(ts.day() == 22, "day==22");
22594        check(ts.hour() == 15, "hour==15");
22595        check(ts.minute() == 16, "min==16");
to_datetime_numeric (pd_test_2_all.cpp:22585)
22575}
22576
22577// =====================================================================
22578// Numeric epoch tests
22579// =====================================================================
22580
22581void test_to_datetime_numeric_seconds() {
22582    std::cout << "  -- test_to_datetime_numeric_seconds --" << std::endl;
22583    // 1490195805 seconds = 2017-03-22 15:16:45 UTC
22584    std::vector<double> vals = {1490195805.0};
22585    auto arr = pandas::to_datetime_numeric(vals, "s");
22586    check(arr.size() == 1, "size==1");
22587    auto v = arr[0];
22588    check(v.has_value(), "has_value");
22589    if (v.has_value()) {
22590        pandas::Timestamp ts(v->getValue());
22591        check(ts.year() == 2017, "year==2017");
22592        check(ts.month() == 3, "month==3");
22593        check(ts.day() == 22, "day==22");
22594        check(ts.hour() == 15, "hour==15");
22595        check(ts.minute() == 16, "min==16");
to_datetime_scalar (pd_test_2_all.cpp:22696)
22686    }
22687}
22688
22689// =====================================================================
22690// Scalar epoch tests
22691// =====================================================================
22692
22693void test_to_datetime_scalar_int() {
22694    std::cout << "  -- test_to_datetime_scalar_int --" << std::endl;
22695    // 1490195805 seconds
22696    auto ts = pandas::to_datetime_scalar(static_cast<int64_t>(1490195805), "s");
22697    check(ts.year() == 2017, "year==2017");
22698    check(ts.month() == 3, "month==3");
22699    check(ts.day() == 22, "day==22");
22700    check(ts.hour() == 15, "hour==15");
22701}
22702
22703void test_to_datetime_scalar_float() {
22704    std::cout << "  -- test_to_datetime_scalar_float --" << std::endl;
22705    // 1.5 seconds = 1500000000 ns from epoch
22706    auto ts = pandas::to_datetime_scalar(1.5, "s");
to_datetime_scalar (pd_test_2_all.cpp:22696)
22686    }
22687}
22688
22689// =====================================================================
22690// Scalar epoch tests
22691// =====================================================================
22692
22693void test_to_datetime_scalar_int() {
22694    std::cout << "  -- test_to_datetime_scalar_int --" << std::endl;
22695    // 1490195805 seconds
22696    auto ts = pandas::to_datetime_scalar(static_cast<int64_t>(1490195805), "s");
22697    check(ts.year() == 2017, "year==2017");
22698    check(ts.month() == 3, "month==3");
22699    check(ts.day() == 22, "day==22");
22700    check(ts.hour() == 15, "hour==15");
22701}
22702
22703void test_to_datetime_scalar_float() {
22704    std::cout << "  -- test_to_datetime_scalar_float --" << std::endl;
22705    // 1.5 seconds = 1500000000 ns from epoch
22706    auto ts = pandas::to_datetime_scalar(1.5, "s");
to_dict (pd_test_1_all.cpp:13343)
13333        void pd_test_io_to_dict() {
13334            std::cout << "========= to_dict ================================";
13335
13336            std::map<std::string, std::vector<double>> data;
13337            data["A"] = {1.0, 2.0, 3.0};
13338            data["B"] = {4.0, 5.0, 6.0};
13339
13340            pandas::DataFrame df(data);
13341
13342            // Test list orientation
13343            auto dict_list = df.to_dict("list");
13344
13345            bool passed = (dict_list.count("A") > 0 && dict_list.count("B") > 0);
13346            passed = passed && (dict_list["A"].size() == 3);
13347            passed = passed && (dict_list["B"].size() == 3);
13348
13349            if (!passed) {
13350                std::cout << "  [FAIL] : in pd_test_io_to_dict() : to_dict list failed" << std::endl;
13351                throw std::runtime_error("pd_test_io_to_dict failed");
13352            }
to_dict_orient_dict (pd_test_2_all.cpp:10652)
10642            // Create DataFrame with string index
10643            std::map<std::string, std::vector<int>> data = {
10644                {"col1", {1, 2}},
10645                {"col2", {3, 4}}
10646            };
10647            pandas::DataFrame df(data);
10648            std::vector<std::string> idx_vals = {"a", "b"};
10649            df.set_index(std::make_unique<pandas::Index<std::string>>(idx_vals));
10650
10651            // Test orient='dict': {column -> {index -> value}}
10652            auto result = df.to_dict_orient_dict();
10653
10654            // Verify structure
10655            if (result.size() != 2) {
10656                std::cout << "  [FAIL] : in pd_test_to_dict_orient_dict() : expected 2 columns" << std::endl;
10657                throw std::runtime_error("pd_test_to_dict_orient_dict failed: wrong column count");
10658            }
10659
10660            // Verify col1
10661            auto& col1 = result["col1"];
10662            if (col1["a"] != "1" || col1["b"] != "2") {
to_dict_orient_index (pd_test_2_all.cpp:10755)
10745            // Create DataFrame with string index
10746            std::map<std::string, std::vector<int>> data = {
10747                {"col1", {1, 2}},
10748                {"col2", {3, 4}}
10749            };
10750            pandas::DataFrame df(data);
10751            std::vector<std::string> idx_vals = {"row_a", "row_b"};
10752            df.set_index(std::make_unique<pandas::Index<std::string>>(idx_vals));
10753
10754            // Test orient='index': {index -> {column -> value}}
10755            auto result = df.to_dict_orient_index();
10756
10757            // Verify structure
10758            if (result.size() != 2) {
10759                std::cout << "  [FAIL] : in pd_test_to_dict_orient_index() : expected 2 rows" << std::endl;
10760                throw std::runtime_error("pd_test_to_dict_orient_index failed: wrong row count");
10761            }
10762
10763            // Verify row_a
10764            auto& row_a = result["row_a"];
10765            if (row_a["col1"] != "1" || row_a["col2"] != "3") {
to_dict_orient_records (pd_test_2_all.cpp:10688)
10678            std::cout << "========= to_dict_orient_records ================================";
10679
10680            // Create simple DataFrame
10681            std::map<std::string, std::vector<int>> data = {
10682                {"col1", {1, 2}},
10683                {"col2", {3, 4}}
10684            };
10685            pandas::DataFrame df(data);
10686
10687            // Test orient='records': [{column -> value}, ...]
10688            auto result = df.to_dict_orient_records();
10689
10690            // Verify structure - should be list of 2 dicts
10691            if (result.size() != 2) {
10692                std::cout << "  [FAIL] : in pd_test_to_dict_orient_records() : expected 2 records, got " << result.size() << std::endl;
10693                throw std::runtime_error("pd_test_to_dict_orient_records failed: wrong record count");
10694            }
10695
10696            // Verify first record
10697            if (result[0]["col1"] != "1" || result[0]["col2"] != "3") {
10698                std::cout << "  [FAIL] : in pd_test_to_dict_orient_records() : wrong values in first record" << std::endl;
to_dict_orient_series (pd_test_2_all.cpp:10911)
10901        void pd_test_to_dict_orient_series() {
10902            std::cout << "========= to_dict_orient_series =================================";
10903
10904            std::map<std::string, std::vector<int>> data = {
10905                {"col1", {1, 2, 3}},
10906                {"col2", {4, 5, 6}}
10907            };
10908            pandas::DataFrame df(data);
10909
10910            // Test orient='series': {column -> Series}
10911            auto result = df.to_dict_orient_series();
10912
10913            // Verify structure
10914            if (result.size() != 2) {
10915                std::cout << "  [FAIL] : in pd_test_to_dict_orient_series() : expected 2 columns" << std::endl;
10916                throw std::runtime_error("pd_test_to_dict_orient_series failed: wrong column count");
10917            }
10918
10919            // Verify col1 is a valid Series
10920            if (result.find("col1") == result.end() || !result["col1"]) {
10921                std::cout << "  [FAIL] : in pd_test_to_dict_orient_series() : missing or null col1" << std::endl;
to_dict_orient_split (pd_test_2_all.cpp:10791)
10781            std::cout << "========= to_dict_orient_split ==================================";
10782
10783            // Create simple DataFrame
10784            std::map<std::string, std::vector<int>> data = {
10785                {"A", {1, 2}},
10786                {"B", {3, 4}}
10787            };
10788            pandas::DataFrame df(data);
10789
10790            // Test orient='split': {index: [], columns: [], data: [[]]}
10791            auto result = df.to_dict_orient_split();
10792
10793            // Verify index
10794            if (result.index.size() != 2 || result.index[0] != "0" || result.index[1] != "1") {
10795                std::cout << "  [FAIL] : in pd_test_to_dict_orient_split() : wrong index values" << std::endl;
10796                throw std::runtime_error("pd_test_to_dict_orient_split failed: wrong index");
10797            }
10798
10799            // Verify columns
10800            if (result.columns.size() != 2) {
10801                std::cout << "  [FAIL] : in pd_test_to_dict_orient_split() : wrong column count" << std::endl;
to_dict_orient_tight (pd_test_2_all.cpp:10865)
10855            };
10856            pandas::DataFrame df(data);
10857
10858            // Set index with a name
10859            std::vector<std::string> idx_vals = {"x", "y"};
10860            auto idx = std::make_unique<pandas::Index<std::string>>(idx_vals);
10861            idx->set_name("row_idx");
10862            df.set_index(std::move(idx));
10863
10864            // Test orient='tight'
10865            auto result = df.to_dict_orient_tight();
10866
10867            // Verify index
10868            if (result.index.size() != 2 || result.index[0] != "x" || result.index[1] != "y") {
10869                std::cout << "  [FAIL] : in pd_test_to_dict_orient_tight() : wrong index values" << std::endl;
10870                throw std::runtime_error("pd_test_to_dict_orient_tight failed: wrong index");
10871            }
10872
10873            // Verify columns
10874            if (result.columns.size() != 2) {
10875                std::cout << "  [FAIL] : in pd_test_to_dict_orient_tight() : wrong column count" << std::endl;
to_excel (pd_test_2_all.cpp:3427)
3417        std::cout << "====================================== [OK] pd_test_eval test suite ========================== " << std::endl;
3418        return 0;
3419    }
3420
3421} // namespace dataframe_tests
3422// ------------------- pd_test_eval.cpp (end) -----------------------------
3423
3424// ------------------- pd_test_excel.cpp (start) -----------------------------
3425// dataframe_tests/pd_test_excel.cpp
3426// Test file for DataFrame.to_excel() method
3427
3428#include <iostream>
3429#include <fstream>
3430#include <stdexcept>
3431#include <map>
3432#include <vector>
3433#include <string>
3434#include <cmath>
3435#include <limits>
to_excel (pd_test_2_all.cpp:3427)
3417        std::cout << "====================================== [OK] pd_test_eval test suite ========================== " << std::endl;
3418        return 0;
3419    }
3420
3421} // namespace dataframe_tests
3422// ------------------- pd_test_eval.cpp (end) -----------------------------
3423
3424// ------------------- pd_test_excel.cpp (start) -----------------------------
3425// dataframe_tests/pd_test_excel.cpp
3426// Test file for DataFrame.to_excel() method
3427
3428#include <iostream>
3429#include <fstream>
3430#include <stdexcept>
3431#include <map>
3432#include <vector>
3433#include <string>
3434#include <cmath>
3435#include <limits>
to_feather (pd_test_2_all.cpp:11158)
11148        std::cout << "====================================== [OK] pd_test_to_dict test suite ==========================" << std::endl;
11149        return 0;
11150    }
11151
11152} // namespace dataframe_tests
11153// ------------------- pd_test_to_dict.cpp (end) -----------------------------
11154
11155// ------------------- pd_test_to_feather.cpp (start) -----------------------------
11156// dataframe_tests/pd_test_to_feather.cpp
11157// Comprehensive tests for DataFrame.to_feather() method (pandas-compatible)
11158
11159#include <iostream>
11160#include <fstream>
11161#include <sstream>
11162#include <stdexcept>
11163#include <vector>
11164#include <map>
11165#include <string>
11166#include <cmath>
11167#include <limits>
to_hdf (pd_test_2_all.cpp:11613)
11603        std::cout << "====================================== [OK] pd_test_to_feather test suite ==========================" << std::endl;
11604        return 0;
11605    }
11606
11607} // namespace dataframe_tests
11608// ------------------- pd_test_to_feather.cpp (end) -----------------------------
11609
11610// ------------------- pd_test_to_hdf.cpp (start) -----------------------------
11611// dataframe_tests/pd_test_to_hdf.cpp
11612// Tests for DataFrame.to_hdf() method - Updated for real HDF5 format
11613
11614#include <iostream>
11615#include <stdexcept>
11616#include <map>
11617#include <vector>
11618#include <string>
11619#include <fstream>
11620#include <cstdio>
11621
11622#include "../pandas/pd_dataframe.h"
to_html (pd_test_1_all.cpp:13438)
13428        void pd_test_io_to_html() {
13429            std::cout << "========= to_html ================================";
13430
13431            std::map<std::string, std::vector<double>> data;
13432            data["A"] = {1.0, 2.0};
13433            data["B"] = {3.0, 4.0};
13434
13435            pandas::DataFrame df(data);
13436
13437            std::string html = df.to_html();
13438
13439            // Check for key HTML elements
13440            bool has_table = (html.find("<table") != std::string::npos);
13441            bool has_thead = (html.find("<thead>") != std::string::npos);
13442            bool has_tbody = (html.find("<tbody>") != std::string::npos);
13443            bool has_th = (html.find("<th>") != std::string::npos);
13444            bool has_td = (html.find("<td>") != std::string::npos);
13445
13446            bool passed = has_table && has_thead && has_tbody && has_th && has_td;
to_latex (pd_test_2_all.cpp:9446)
9436        void pd_test_styler_to_latex() {
9437            std::cout << "========= to_latex =================================";
9438
9439            std::map<std::string, std::vector<double>> data = {
9440                {"A", {1.0, 2.0, 3.0}},
9441                {"B", {4.0, 5.0, 6.0}}
9442            };
9443            pandas::DataFrame df(data);
9444
9445            auto styler = df.style();
9446            std::string latex = styler.to_latex();
9447
9448            if (!contains(latex, "\\begin{tabular}")) {
9449                std::cout << "  [FAIL] : in pd_test_styler_to_latex() : did not produce tabular environment" << std::endl;
9450                throw std::runtime_error("pd_test_styler_to_latex failed: did not produce tabular environment");
9451            }
9452            if (!contains(latex, "\\end{tabular}")) {
9453                std::cout << "  [FAIL] : in pd_test_styler_to_latex() : did not close tabular environment" << std::endl;
9454                throw std::runtime_error("pd_test_styler_to_latex failed: did not close tabular environment");
9455            }
to_markdown (pd_test_1_all.cpp:13466)
13456        void pd_test_io_to_markdown() {
13457            std::cout << "========= to_markdown ============================";
13458
13459            std::map<std::string, std::vector<double>> data;
13460            data["X"] = {10.0, 20.0};
13461            data["Y"] = {30.0, 40.0};
13462
13463            pandas::DataFrame df(data);
13464
13465            std::string md = df.to_markdown();
13466
13467            // Check for markdown table elements
13468            bool has_pipe = (md.find("|") != std::string::npos);
13469            bool has_separator = (md.find("---") != std::string::npos);
13470
13471            bool passed = has_pipe && has_separator;
13472
13473            if (!passed) {
13474                std::cout << "  [FAIL] : in pd_test_io_to_markdown() : invalid markdown format" << std::endl;
13475                throw std::runtime_error("pd_test_io_to_markdown failed");
to_numeric (pd_test_3_all.cpp:906)
896            throw std::runtime_error("crosstab: expected 2 rows");
897        }
898        if (ct.ncols() != 3) {
899            throw std::runtime_error("crosstab: expected 3 cols");
900        }
901    }
902
903    // Case B: pandas::to_numeric on Series<string> with errors="coerce"
904    {
905        pandas::Series<std::string> s({"1", "2", "'A'", "4.22"}, std::string("col_1"));
906        auto out = pandas::to_numeric(s, "coerce");
907        if (out.size() != 4) {
908            throw std::runtime_error("to_numeric: size mismatch");
909        }
910        if (out[0] != 1.0 || out[1] != 2.0 || out[3] != 4.22) {
911            throw std::runtime_error("to_numeric: parsed values wrong");
912        }
913        if (!std::isnan(out[2])) {
914            throw std::runtime_error("to_numeric coerce: non-numeric did not become NaN");
915        }
916    }
to_numeric (pd_test_3_all.cpp:906)
896            throw std::runtime_error("crosstab: expected 2 rows");
897        }
898        if (ct.ncols() != 3) {
899            throw std::runtime_error("crosstab: expected 3 cols");
900        }
901    }
902
903    // Case B: pandas::to_numeric on Series<string> with errors="coerce"
904    {
905        pandas::Series<std::string> s({"1", "2", "'A'", "4.22"}, std::string("col_1"));
906        auto out = pandas::to_numeric(s, "coerce");
907        if (out.size() != 4) {
908            throw std::runtime_error("to_numeric: size mismatch");
909        }
910        if (out[0] != 1.0 || out[1] != 2.0 || out[3] != 4.22) {
911            throw std::runtime_error("to_numeric: parsed values wrong");
912        }
913        if (!std::isnan(out[2])) {
914            throw std::runtime_error("to_numeric coerce: non-numeric did not become NaN");
915        }
916    }
to_orc (pd_test_2_all.cpp:13769)
13759        std::cout << "====================================== [OK] pd_test_to_markdown test suite ========================== " << std::endl;
13760        return 0;
13761    }
13762
13763} // namespace dataframe_tests
13764// ------------------- pd_test_to_markdown.cpp (end) -----------------------------
13765
13766// ------------------- pd_test_to_orc.cpp (start) -----------------------------
13767// dataframe_tests/pd_test_to_orc.cpp
13768// Tests for DataFrame.to_orc() method
13769
13770#include <iostream>
13771#include <stdexcept>
13772#include <map>
13773#include <vector>
13774#include <string>
13775#include <fstream>
13776#include <cstdio>
13777
13778#include "../pandas/pd_dataframe.h"
to_parquet (pd_test_2_all.cpp:14117)
14107        std::cout << "====================================== [OK] pd_test_to_orc test suite ==========================" << std::endl;
14108        return 0;
14109    }
14110
14111} // namespace dataframe_tests
14112// ------------------- pd_test_to_orc.cpp (end) -----------------------------
14113
14114// ------------------- pd_test_to_parquet.cpp (start) -----------------------------
14115// dataframe_tests/pd_test_to_parquet.cpp
14116// Tests for DataFrame.to_parquet() method
14117
14118#include <iostream>
14119#include <stdexcept>
14120#include <map>
14121#include <vector>
14122#include <string>
14123#include <fstream>
14124#include <cstdio>
14125
14126#include "../pandas/pd_dataframe.h"
to_pickle (pd_test_2_all.cpp:14906)
14896        std::cout << "====================================== [OK] pd_test_to_period test suite ========================== " << std::endl;
14897        return 0;
14898    }
14899
14900} // namespace dataframe_tests
14901// ------------------- pd_test_to_period.cpp (end) -----------------------------
14902
14903// ------------------- pd_test_to_pickle.cpp (start) -----------------------------
14904// dataframe_tests/pd_test_to_pickle.cpp
14905// Tests for DataFrame.to_pickle() method
14906
14907#include <iostream>
14908#include <stdexcept>
14909#include <map>
14910#include <vector>
14911#include <string>
14912#include <fstream>
14913#include <cstdio>
14914
14915#include "../pandas/pd_dataframe.h"
to_pickle (pd_test_2_all.cpp:14906)
14896        std::cout << "====================================== [OK] pd_test_to_period test suite ========================== " << std::endl;
14897        return 0;
14898    }
14899
14900} // namespace dataframe_tests
14901// ------------------- pd_test_to_period.cpp (end) -----------------------------
14902
14903// ------------------- pd_test_to_pickle.cpp (start) -----------------------------
14904// dataframe_tests/pd_test_to_pickle.cpp
14905// Tests for DataFrame.to_pickle() method
14906
14907#include <iostream>
14908#include <stdexcept>
14909#include <map>
14910#include <vector>
14911#include <string>
14912#include <fstream>
14913#include <cstdio>
14914
14915#include "../pandas/pd_dataframe.h"
to_records (pd_test_2_all.cpp:15323)
15313        std::cout << "====================================== [OK] pd_test_to_pickle test suite =========================" << std::endl;
15314        return 0;
15315    }
15316
15317} // namespace dataframe_tests
15318// ------------------- pd_test_to_pickle.cpp (end) -----------------------------
15319
15320// ------------------- pd_test_to_records.cpp (start) -----------------------------
15321// pd_test_to_records.cpp
15322// Tests for DataFrame.to_records() method
15323
15324#include <iostream>
15325#include <string>
15326#include <vector>
15327#include <map>
15328#include <cmath>
15329#include <stdexcept>
15330
15331#include "../pandas/pd_dataframe.h"
to_records_dict (pd_test_1_all.cpp:13491)
13481        void pd_test_io_to_records() {
13482            std::cout << "========= to_records =============================";
13483
13484            std::map<std::string, std::vector<double>> data;
13485            data["name"] = {1.0, 2.0, 3.0};
13486            data["value"] = {10.0, 20.0, 30.0};
13487
13488            pandas::DataFrame df(data);
13489
13490            auto records = df.to_records_dict();
13491
13492            bool passed = (records.size() == 3);
13493            if (passed && records.size() > 0) {
13494                // Each record should have all columns
13495                passed = passed && (records[0].size() == 2);
13496            }
13497
13498            if (!passed) {
13499                std::cout << "  [FAIL] : in pd_test_io_to_records() : wrong number of records" << std::endl;
13500                throw std::runtime_error("pd_test_io_to_records failed");
to_sql (pd_test_2_all.cpp:15576)
15566        std::cout << "====================================== [OK] pd_test_to_records test suite ========================== " << std::endl;
15567        return 0;
15568    }
15569
15570} // namespace dataframe_tests
15571// ------------------- pd_test_to_records.cpp (end) -----------------------------
15572
15573// ------------------- pd_test_to_sql.cpp (start) -----------------------------
15574// dataframe_tests/pd_test_to_sql.cpp
15575// Tests for DataFrame.to_sql() method
15576
15577#include <iostream>
15578#include <stdexcept>
15579#include <map>
15580#include <vector>
15581#include <string>
15582#include <fstream>
15583#include <sstream>
15584#include <cstdio>
to_sql_con (pd_test_3_all.cpp:17647)
17637    bool passed = !str.empty();
17638    if (!passed) {
17639        std::cout << "  [FAIL] : in pd_test_to_string_formatters()" << std::endl;
17640        throw std::runtime_error("pd_test_to_string_formatters failed");
17641    }
17642
17643    std::cout << " -> tests passed" << std::endl;
17644}
17645
17646// ============================================================================
17647// Test to_sql_con (alias for to_sql with con parameter name)
17648// ============================================================================
17649
17650void pd_test_to_sql_con() {
17651    std::cout << "========= DataFrame.to_sql_con() ======================";
17652
17653    std::map<std::string, std::vector<int>> data = {
17654        {"A", {1, 2}},
17655        {"B", {3, 4}}
17656    };
17657    pandas::DataFrame df(data);
to_stata (pd_test_2_all.cpp:16133)
16123        std::cout << "====================================== [OK] pd_test_to_sql test suite ==========================" << std::endl;
16124        return 0;
16125    }
16126
16127} // namespace dataframe_tests
16128// ------------------- pd_test_to_sql.cpp (end) -----------------------------
16129
16130// ------------------- pd_test_to_stata.cpp (start) -----------------------------
16131// pd_test_to_stata.cpp
16132// Tests for DataFrame.to_stata() method
16133
16134#include <iostream>
16135#include <fstream>
16136#include <string>
16137#include <vector>
16138#include <map>
16139#include <cstring>
16140#include <stdexcept>
16141
16142#include "../pandas/pd_dataframe.h"
to_string (pd_test_1_all.cpp:2693)
2683        pandas::PeriodArray arr_m(std::vector<std::string>{
2684            "2020-01",
2685            "NaT",
2686            "2025-06"
2687        }, "M");
2688
2689        // Year
2690        auto years = arr_m.year();
2691        auto y0 = years[0];
2692        if (!y0.has_value() || y0.value() != 2020) {
2693            std::cout << "  [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl;
2694            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]");
2695        }
2696
2697        auto y1 = years[1];
2698        if (y1.has_value()) {
2699            std::cout << "  [FAIL] : year[1] should be NA (NaT)" << std::endl;
2700            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA");
2701        }
2702
2703        auto y2 = years[2];
to_string (pd_test_1_all.cpp:2693)
2683        pandas::PeriodArray arr_m(std::vector<std::string>{
2684            "2020-01",
2685            "NaT",
2686            "2025-06"
2687        }, "M");
2688
2689        // Year
2690        auto years = arr_m.year();
2691        auto y0 = years[0];
2692        if (!y0.has_value() || y0.value() != 2020) {
2693            std::cout << "  [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl;
2694            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]");
2695        }
2696
2697        auto y1 = years[1];
2698        if (y1.has_value()) {
2699            std::cout << "  [FAIL] : year[1] should be NA (NaT)" << std::endl;
2700            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA");
2701        }
2702
2703        auto y2 = years[2];
to_string (pd_test_1_all.cpp:2693)
2683        pandas::PeriodArray arr_m(std::vector<std::string>{
2684            "2020-01",
2685            "NaT",
2686            "2025-06"
2687        }, "M");
2688
2689        // Year
2690        auto years = arr_m.year();
2691        auto y0 = years[0];
2692        if (!y0.has_value() || y0.value() != 2020) {
2693            std::cout << "  [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl;
2694            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]");
2695        }
2696
2697        auto y1 = years[1];
2698        if (y1.has_value()) {
2699            std::cout << "  [FAIL] : year[1] should be NA (NaT)" << std::endl;
2700            throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA");
2701        }
2702
2703        auto y2 = years[2];
to_string_vector (pd_test_1_all.cpp:10871)
10861    std::cout << " -> tests passed" << std::endl;
10862}
10863
10864void pd_test_extension_index_to_string_vector() {
10865    std::cout << "========= to_string_vector =========================";
10866
10867    pandas::CategoricalArray arr({"a", std::nullopt, "c"});
10868    pandas::CategoricalIndex idx(arr);
10869
10870    auto str_vec = idx.to_string_vector();
10871
10872    bool passed = (str_vec.size() == 3 &&
10873                   str_vec[0] == "a" && str_vec[1] == "NA" && str_vec[2] == "c");
10874    if (!passed) {
10875        std::cout << "  [FAIL] : in pd_test_extension_index_to_string_vector() : to_string_vector check failed" << std::endl;
10876        throw std::runtime_error("pd_test_extension_index_to_string_vector failed");
10877    }
10878
10879    std::cout << " -> tests passed" << std::endl;
10880}
to_timedelta (pd_test_3_all.cpp:13691)
13681    numpy::NDArray<numpy::bool_> na_mask2 = result2.isna();
13682    if (!static_cast<bool>(na_mask2.getElementAt({1}))) {
13683        std::cout << "  [FAIL] : in pd_test_top_level_to_datetime() : empty string should be NA" << std::endl;
13684        throw std::runtime_error("pd_test_top_level_to_datetime failed: empty not NA");
13685    }
13686
13687    std::cout << " -> tests passed" << std::endl;
13688}
13689
13690void pd_test_top_level_to_timedelta() {
13691    std::cout << "========= to_timedelta() ==============================";
13692
13693    // Test string version
13694    std::vector<std::string> tds = {
13695        "1 days",
13696        "2 hours",
13697        "30 minutes"
13698    };
13699
13700    pandas::TimedeltaArray result = pandas::to_timedelta(tds);
to_timedelta (pd_test_3_all.cpp:13691)
13681    numpy::NDArray<numpy::bool_> na_mask2 = result2.isna();
13682    if (!static_cast<bool>(na_mask2.getElementAt({1}))) {
13683        std::cout << "  [FAIL] : in pd_test_top_level_to_datetime() : empty string should be NA" << std::endl;
13684        throw std::runtime_error("pd_test_top_level_to_datetime failed: empty not NA");
13685    }
13686
13687    std::cout << " -> tests passed" << std::endl;
13688}
13689
13690void pd_test_top_level_to_timedelta() {
13691    std::cout << "========= to_timedelta() ==============================";
13692
13693    // Test string version
13694    std::vector<std::string> tds = {
13695        "1 days",
13696        "2 hours",
13697        "30 minutes"
13698    };
13699
13700    pandas::TimedeltaArray result = pandas::to_timedelta(tds);
to_xarray (pd_test_2_all.cpp:16928)
16918        std::cout << "====================================== [OK] pd_test_to_timestamp test suite ========================== " << std::endl;
16919        return 0;
16920    }
16921
16922} // namespace dataframe_tests
16923// ------------------- pd_test_to_timestamp.cpp (end) -----------------------------
16924
16925// ------------------- pd_test_to_xarray.cpp (start) -----------------------------
16926// dataframe_tests/pd_test_to_xarray.cpp
16927// Test for DataFrame.to_xarray() - Convert DataFrame to xarray Dataset
16928
16929#include <iostream>
16930#include <stdexcept>
16931#include <string>
16932#include <vector>
16933#include <map>
16934#include <memory>
16935#include <cmath>
16936
16937#include "../pandas/pd_dataframe.h"
align_empty_series_to_index (pd_test_3_all.cpp:23211)
23201        throw std::runtime_error("test_align_string: values[2] should be empty string");
23202    if (!aligned.has_missing)
23203        throw std::runtime_error("test_align_string: has_missing should be true");
23204
23205    std::cout << "    -> test passed" << std::endl;
23206}
23207
23208void test_align_empty() {
23209    std::cout << "========= align_empty_series_to_index =================";
23210
23211    auto aligned = pandas::construct::align_empty_series_to_index<numpy::float64>(4);
23212
23213    if (aligned.values.size() != 4)
23214        throw std::runtime_error("test_align_empty: expected 4 values");
23215    for (size_t i = 0; i < 4; ++i) {
23216        if (!aligned.missing_mask[i])
23217            throw std::runtime_error("test_align_empty: missing_mask[" +
23218                std::to_string(i) + "] should be true");
23219    }
23220    if (!aligned.has_missing)
23221        throw std::runtime_error("test_align_empty: has_missing should be true");
align_series_to_dataframe (pd_test_5_all.cpp:90968)
90958static bool is_nan(double v) {
90959    return v != v;
90960}
90961
90962void case_1_positional_int64() {
90963    int local_fail = 0;
90964    auto df = make_abc_frame();
90965    auto s = make_labelled_series<std::int64_t>(
90966        {10, 20, 30}, {"a", "b", "c"});
90967    auto r = pandas::align_series_to_dataframe<std::int64_t>(
90968        s, df.index(), /*preserve_dtype=*/true);
90969
90970    check_shape("case_1_positional_int64", r, 3,
90971                pandas::SetItemResult::POSITIONAL, local_fail);
90972    pandas_tests::check(r.has_nan_from_upcasting == false,
90973        "case_1_positional_int64.no_nan_introduced", local_fail);
90974    pandas_tests::check(r.dtype_override.has_value(),
90975        "case_1_positional_int64.dtype_override_present", local_fail);
90976    pandas_tests::check(r.aligned_values[0] == 10.0 &&
90977                        r.aligned_values[1] == 20.0 &&
align_series_to_index (pd_test_3_all.cpp:23163)
23153void test_align_float64() {
23154    std::cout << "========= align_series_to_index float64 ===============";
23155
23156    // Series [1,2,3] with index ["a","b","c"] -> target ["a","c","d"] = [1,3,NaN]
23157    pandas::Index<std::string> idx(std::vector<std::string>{"a", "b", "c"});
23158    pandas::Series<numpy::float64> s(
23159        std::vector<numpy::float64>{1.0, 2.0, 3.0}, idx);
23160
23161    std::vector<std::string> target = {"a", "c", "d"};
23162    auto aligned = pandas::construct::align_series_to_index(s, target);
23163
23164    if (aligned.values.size() != 3)
23165        throw std::runtime_error("test_align_float64: expected 3 values");
23166    if (aligned.values[0] != 1.0)
23167        throw std::runtime_error("test_align_float64: values[0] should be 1.0");
23168    if (aligned.values[1] != 3.0)
23169        throw std::runtime_error("test_align_float64: values[1] should be 3.0");
23170    if (!aligned.missing_mask[2])
23171        throw std::runtime_error("test_align_float64: missing_mask[2] should be true");
23172    if (aligned.missing_mask[0] || aligned.missing_mask[1])
concat (pd_test_1_all.cpp:17717)
17707}
17708
17709void pd_test_period_index_concat() {
17710    std::cout << "========= concat factory ==============================";
17711
17712    std::vector<int64_t> ordinals1 = {0, 1};
17713    std::vector<int64_t> ordinals2 = {2, 3};
17714    pandas::PeriodIndex idx1(ordinals1, "D");
17715    pandas::PeriodIndex idx2(ordinals2, "D");
17716
17717    pandas::PeriodIndex concatenated = pandas::PeriodIndex::concat({idx1, idx2});
17718
17719    bool passed = (concatenated.size() == 4);
17720    if (!passed) {
17721        std::cout << "  [FAIL] : in pd_test_period_index_concat()" << std::endl;
17722        throw std::runtime_error("pd_test_period_index_concat failed");
17723    }
17724
17725    std::cout << " -> tests passed" << std::endl;
17726}
concat (pd_test_1_all.cpp:17717)
17707}
17708
17709void pd_test_period_index_concat() {
17710    std::cout << "========= concat factory ==============================";
17711
17712    std::vector<int64_t> ordinals1 = {0, 1};
17713    std::vector<int64_t> ordinals2 = {2, 3};
17714    pandas::PeriodIndex idx1(ordinals1, "D");
17715    pandas::PeriodIndex idx2(ordinals2, "D");
17716
17717    pandas::PeriodIndex concatenated = pandas::PeriodIndex::concat({idx1, idx2});
17718
17719    bool passed = (concatenated.size() == 4);
17720    if (!passed) {
17721        std::cout << "  [FAIL] : in pd_test_period_index_concat()" << std::endl;
17722        throw std::runtime_error("pd_test_period_index_concat failed");
17723    }
17724
17725    std::cout << " -> tests passed" << std::endl;
17726}
concat_bool_partner_kind (pd_test_5_all.cpp:102198)
102188}
102189
102190static void check_partner_kind(const std::string& label,
102191                               const std::vector<std::string>& canon,
102192                               bool expected,
102193                               int& local_fail) {
102194    std::cout << "-- " << label << "\n";
102195    bool got = false;
102196    std::string err;
102197    try {
102198        got = pandas::concat_bool_partner_kind(canon);
102199    } catch (const std::exception& e) {
102200        err = e.what();
102201    } catch (...) {
102202        err = "<unknown>";
102203    }
102204    pandas_tests::check(err.empty(), label + "()_no_throw", local_fail);
102205    if (!err.empty()) {
102206        std::cout << "  err: " << err << "\n";
102207        return;
102208    }
concat_bool_partner_kind (pd_test_5_all.cpp:102198)
102188}
102189
102190static void check_partner_kind(const std::string& label,
102191                               const std::vector<std::string>& canon,
102192                               bool expected,
102193                               int& local_fail) {
102194    std::cout << "-- " << label << "\n";
102195    bool got = false;
102196    std::string err;
102197    try {
102198        got = pandas::concat_bool_partner_kind(canon);
102199    } catch (const std::exception& e) {
102200        err = e.what();
102201    } catch (...) {
102202        err = "<unknown>";
102203    }
102204    pandas_tests::check(err.empty(), label + "()_no_throw", local_fail);
102205    if (!err.empty()) {
102206        std::cout << "  err: " << err << "\n";
102207        return;
102208    }
concat_dispatch (pd_test_5_all.cpp:113473)
113463    check_dtype("concat_dispatch_o7p8q9_disjoint_widening",
113464                df, "float64", local_fail);
113465    bool len_ok = (df.nrows() == 4);
113466    pandas_tests::check(len_ok, "concat_dispatch_o7p8q9_disjoint_widening.nrows_4",
113467          local_fail);
113468}
113469
113470static void f_concat_dispatch_o7p8q9_case_H1_dispatch_empty(int& local_fail) {
113471    std::cout << "-- case_H1_dispatch_empty\n";
113472    std::vector<pandas::FuncArg> inputs;
113473    pandas::Result r = pandas::concat_dispatch(inputs);
113474    bool got = std::holds_alternative<std::unique_ptr<pandas::DataFrame>>(r.value);
113475    pandas_tests::check(got, "case_H1.empty_returns_dataframe", local_fail);
113476    if (!got) return;
113477    auto& dfp = std::get<std::unique_ptr<pandas::DataFrame>>(r.value);
113478    pandas_tests::check(dfp->nrows() == 0, "case_H1.nrows_0", local_fail);
113479}
113480
113481static void f_concat_dispatch_o7p8q9_case_H2_dispatch_empty_axis1(int& local_fail) {
113482    std::cout << "-- case_H2_dispatch_empty_axis1\n";
113483    std::vector<pandas::FuncArg> inputs;
concat_dispatch_series_mixed (pd_test_5_all.cpp:102135)
102125    return std::static_pointer_cast<pandas::NDFrameBase>(s);
102126}
102127
102128static pandas::Result try_concat(
102129        const std::vector<std::shared_ptr<pandas::NDFrameBase>>& inputs,
102130        const std::vector<std::string>& dtypes_full,
102131        std::string& caught_msg,
102132        bool ignore_index = true) {
102133    caught_msg.clear();
102134    try {
102135        return pandas::concat_dispatch_series_mixed(inputs, dtypes_full,
102136                                                    ignore_index);
102137    } catch (const std::exception& e) {
102138        caught_msg = e.what();
102139    } catch (...) {
102140        caught_msg = "<unknown>";
102141    }
102142    return pandas::Result{};
102143}
102144
102145static std::string result_dtype(const pandas::Result& r) {
join_must_be_inner_or_outer_got (pd_test_5_all.cpp:73163)
73153        pandas::error_messages::invalid_join_type("left"),
73154        "case_2.long_form_distinct_from_short_form",
73155        local_fail);
73156}
73157
73158void case_3_join_inner_outer_helper(int& local_fail) {
73159    std::cout << "-- case_3_join_inner_outer_helper\n";
73160    check_eq_str(
73161        "case_3.join_inner_outer_xyz",
73162        "join must be 'inner' or 'outer', got 'xyz'",
73163        pandas::error_messages::join_must_be_inner_or_outer_got("xyz"),
73164        local_fail);
73165    check_eq_str(
73166        "case_3.join_inner_outer_empty",
73167        "join must be 'inner' or 'outer', got ''",
73168        pandas::error_messages::join_must_be_inner_or_outer_got(""),
73169        local_fail);
73170}
73171
73172void case_4_join_outer_inner_left_right(int& local_fail) {
73173    std::cout << "-- case_4_join_outer_inner_left_right\n";
merge (pd_test_1_all.cpp:13639)
13629namespace dataframe_tests {
13630    namespace dataframe_tests_joining {
13631
13632        // Helper to check approximate equality
13633        bool approx_equal(double a, double b, double tol = 1e-9) {
13634            if (std::isnan(a) && std::isnan(b)) return true;
13635            return std::abs(a - b) < tol;
13636        }
13637
13638        // =====================================================================
13639        // merge() Tests
13640        // =====================================================================
13641
13642        void pd_test_joining_merge_inner() {
13643            std::cout << "========= merge inner join ============================";
13644
13645            // Left DataFrame: id, value_left
13646            std::map<std::string, std::vector<double>> left_data = {
13647                {"id", {1.0, 2.0, 3.0, 4.0}},
13648                {"value_left", {10.0, 20.0, 30.0, 40.0}}
13649            };
merge (pd_test_1_all.cpp:13639)
13629namespace dataframe_tests {
13630    namespace dataframe_tests_joining {
13631
13632        // Helper to check approximate equality
13633        bool approx_equal(double a, double b, double tol = 1e-9) {
13634            if (std::isnan(a) && std::isnan(b)) return true;
13635            return std::abs(a - b) < tol;
13636        }
13637
13638        // =====================================================================
13639        // merge() Tests
13640        // =====================================================================
13641
13642        void pd_test_joining_merge_inner() {
13643            std::cout << "========= merge inner join ============================";
13644
13645            // Left DataFrame: id, value_left
13646            std::map<std::string, std::vector<double>> left_data = {
13647                {"id", {1.0, 2.0, 3.0, 4.0}},
13648                {"value_left", {10.0, 20.0, 30.0, 40.0}}
13649            };
merge_asof (pd_test_3_all.cpp:13741)
13731    }
13732
13733    std::cout << " -> tests passed" << std::endl;
13734}
13735
13736// ============================================================================
13737// Merge Asof / Merge Ordered Tests
13738// ============================================================================
13739
13740void pd_test_top_level_merge_asof() {
13741    std::cout << "========= merge_asof() ================================";
13742
13743    // Create left DataFrame
13744    std::map<std::string, std::vector<double>> left_data = {
13745        {"time", {1.0, 5.0, 10.0}},
13746        {"value_left", {100.0, 200.0, 300.0}}
13747    };
13748    pandas::DataFrame left(left_data);
13749
13750    // Create right DataFrame
13751    std::map<std::string, std::vector<double>> right_data = {
merge_ordered (pd_test_3_all.cpp:13775)
13765    // Should have columns from both DataFrames
13766    if (result.ncols() < 3) {
13767        std::cout << "  [FAIL] : in pd_test_top_level_merge_asof() : expected at least 3 columns" << std::endl;
13768        throw std::runtime_error("pd_test_top_level_merge_asof failed: wrong column count");
13769    }
13770
13771    std::cout << " -> tests passed" << std::endl;
13772}
13773
13774void pd_test_top_level_merge_ordered() {
13775    std::cout << "========= merge_ordered() =============================";
13776
13777    std::map<std::string, std::vector<double>> left_data = {
13778        {"key", {1.0, 3.0, 5.0}},
13779        {"val_a", {10.0, 30.0, 50.0}}
13780    };
13781    pandas::DataFrame left(left_data);
13782
13783    std::map<std::string, std::vector<double>> right_data = {
13784        {"key", {2.0, 4.0, 6.0}},
13785        {"val_b", {20.0, 40.0, 60.0}}
melt (pd_test_1_all.cpp:6846)
6836            }
6837
6838            // Test melt
6839            {
6840                std::map<std::string, std::vector<int>> data;
6841                data["id"] = {1, 2};
6842                data["A"] = {10, 20};
6843                data["B"] = {30, 40};
6844                pandas::DataFrame df(data);
6845
6846                auto melted = df.melt({"id"});
6847                if (melted.nrows() != 4) {  // 2 ids * 2 value columns
6848                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl;
6849                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows");
6850                }
6851                if (!melted.has_column("variable")) {
6852                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl;
6853                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column");
6854                }
6855                if (!melted.has_column("value")) {
6856                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl;
melt (pd_test_1_all.cpp:6846)
6836            }
6837
6838            // Test melt
6839            {
6840                std::map<std::string, std::vector<int>> data;
6841                data["id"] = {1, 2};
6842                data["A"] = {10, 20};
6843                data["B"] = {30, 40};
6844                pandas::DataFrame df(data);
6845
6846                auto melted = df.melt({"id"});
6847                if (melted.nrows() != 4) {  // 2 ids * 2 value columns
6848                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl;
6849                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows");
6850                }
6851                if (!melted.has_column("variable")) {
6852                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl;
6853                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column");
6854                }
6855                if (!melted.has_column("value")) {
6856                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl;
melt (pd_test_1_all.cpp:6846)
6836            }
6837
6838            // Test melt
6839            {
6840                std::map<std::string, std::vector<int>> data;
6841                data["id"] = {1, 2};
6842                data["A"] = {10, 20};
6843                data["B"] = {30, 40};
6844                pandas::DataFrame df(data);
6845
6846                auto melted = df.melt({"id"});
6847                if (melted.nrows() != 4) {  // 2 ids * 2 value columns
6848                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt nrows != 4, got " << melted.nrows() << std::endl;
6849                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt nrows");
6850                }
6851                if (!melted.has_column("variable")) {
6852                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'variable' column" << std::endl;
6853                    throw std::runtime_error("pd_test_dataframe_reshape failed: melt variable column");
6854                }
6855                if (!melted.has_column("value")) {
6856                    std::cout << "  [FAIL] : in pd_test_dataframe_reshape() : melt missing 'value' column" << std::endl;
pivot_table_with_grouper (pd_test_2_all.cpp:21310)
21300              << dataframe_tests_misc_migration::g_fail << " failed)" << std::endl;
21301
21302    return dataframe_tests_misc_migration::g_fail;
21303}
21304
21305} // namespace dataframe_tests
21306// ------------------- pd_test_misc_migration.cpp (end) -----------------------------
21307
21308// ------------------- pd_test_pivot_ext.cpp (start) -----------------------------
21309// pd_test_pivot_ext.cpp - Tests for pivot_table extensions
21310// Tests pivot_table_multi_agg(), pivot_table_with_grouper(), auto-detect numeric columns
21311
21312#include <iostream>
21313#include <string>
21314#include <vector>
21315#include <cmath>
21316#include <set>
21317
21318#include "../pandas/pd_dataframe.h"
21319#include "../pandas/pd_groupby.h"
counts (pd_test_1_all.cpp:1394)
1384        pandas::DatetimeArray arr(std::vector<std::string>{
1385            "2023-01-01",
1386            "NaT",
1387            "2023-12-31",
1388            "NaT"
1389        });
1390
1391        // fillna
1392        // Fix A: storage is always ns; the boxed fill scalar comes back at ns
1393        // resolution. Compare ns counts (not toString) to be storage-unit-agnostic.
1394        numpy::datetime64 fill_val("2023-06-15");
1395        auto filled = arr.fillna(fill_val);
1396        if (filled[1].value().toNanoseconds() != fill_val.toNanoseconds()) {
1397            std::cout << "  [FAIL] : fillna: NaT should be replaced" << std::endl;
1398            throw std::runtime_error("pd_test_datetime_array_fillna_dropna failed: fillna");
1399        }
1400
1401        // dropna
1402        auto dropped = arr.dropna();
1403        if (dropped.size() != 2) {
describe_option (pd_test_3_all.cpp:13415)
13405    // Test reset_option
13406    pandas::reset_option("display.max_rows");
13407    max_rows = pandas::get_option<int64_t>("display.max_rows");
13408    if (max_rows != 60) {
13409        std::cout << "  [FAIL] : in pd_test_top_level_options() : reset_option failed" << std::endl;
13410        throw std::runtime_error("pd_test_top_level_options failed: reset_option");
13411    }
13412
13413    // Test describe_option
13414    std::string desc = pandas::describe_option("display.max_rows");
13415    if (desc.empty() || desc.find("display.max_rows") == std::string::npos) {
13416        std::cout << "  [FAIL] : in pd_test_top_level_options() : describe_option empty or missing key" << std::endl;
13417        throw std::runtime_error("pd_test_top_level_options failed: describe_option");
13418    }
13419
13420    // Test invalid option
13421    bool threw = false;
13422    try {
13423        pandas::get_option<int64_t>("invalid.option.name");
13424    } catch (const std::exception&) {
DuplicateLabelError (pd_test_5_all.cpp:72295)
72285}
72286
72287void case_6_throw_via_registry(int& local_fail) {
72288    std::cout << "-- case_6_throw_via_registry\n";
72289    std::string caught;
72290    try {
72291        // DuplicateLabelError currently lives in pandasPython/
72292        // bindings_common.h; plan_88a moves it into pandas::. If
72293        // plan_88a hasn't landed yet this is a compile error and
72294        // documents the dependency.
72295        throw pandas::DuplicateLabelError(
72296            std::string(pandas::error_messages::kCannotReindexDuplicate));
72297    } catch (const std::exception& e) {
72298        caught = e.what();
72299    }
72300    check_eq_str(
72301        "case_6.DuplicateLabelError_round_trip",
72302        "cannot reindex on an axis with duplicate labels",
72303        caught,
72304        local_fail);
72305}
GlobalUnlock (pd_test_2_all.cpp:10220)
10210                return "";
10211            }
10212
10213            char* pszText = static_cast<char*>(GlobalLock(hData));
10214            if (pszText == nullptr) {
10215                CloseClipboard();
10216                return "";
10217            }
10218
10219            std::string text(pszText);
10220            GlobalUnlock(hData);
10221            CloseClipboard();
10222
10223            return text;
10224        }
10225#else
10226        std::string get_clipboard_text() {
10227            // Non-Windows: just return empty (can't easily read clipboard)
10228            return "";
10229        }
10230#endif
IncompatibleDataArgError (pd_test_5_all.cpp:75723)
75713    bool caught_func = false;
75714    try {
75715        throw pandas::IncompatibleFuncArgError("from pd_exceptions.h");
75716    } catch (const pandas::IncompatibleFuncArgError& e) {
75717        caught_func = (std::string(e.what()) == "from pd_exceptions.h");
75718    } catch (...) {}
75719    pandas_tests::check(caught_func, "case_1.func_arg_visible_in_pd_exceptions_h", local_fail);
75720
75721    bool caught_data = false;
75722    try {
75723        throw pandas::IncompatibleDataArgError("from pd_exceptions.h");
75724    } catch (const pandas::IncompatibleDataArgError& e) {
75725        caught_data = (std::string(e.what()) == "from pd_exceptions.h");
75726    } catch (...) {}
75727    pandas_tests::check(caught_data, "case_1.data_arg_visible_in_pd_exceptions_h", local_fail);
75728
75729    if (local_fail > 0) throw std::runtime_error("case_1 failed");
75730    std::cout << " -> case_1 passed\n";
75731}
75732
75733void case_2_exists_via_legacy_dispatch_include() {
IncompatibleFuncArgError (pd_test_5_all.cpp:75705)
75695        throw std::runtime_error("f_test_value_error_messages_3 failed");
75696    }
75697    std::cout << " -> tests passed" << std::endl;
75698}
75699
75700// --- f_test_dispatch_sentinels_3.cpp ---
75701
75702namespace f_test_dispatch_sentinels_3_ns {
75703
75704static void dispatch_call_emulator(const std::string& method) {
75705    throw pandas::IncompatibleFuncArgError(
75706        std::string("FuncDispatcher::call: no registered implementation for '") + method + "'");
75707}
75708
75709void case_1_exists_in_pd_exceptions_h() {
75710    std::cout << "----- case_1_exists_in_pd_exceptions_h -----\n";
75711    int local_fail = 0;
75712
75713    bool caught_func = false;
75714    try {
75715        throw pandas::IncompatibleFuncArgError("from pd_exceptions.h");
IncompatibleFuncArgError (pd_test_5_all.cpp:75705)
75695        throw std::runtime_error("f_test_value_error_messages_3 failed");
75696    }
75697    std::cout << " -> tests passed" << std::endl;
75698}
75699
75700// --- f_test_dispatch_sentinels_3.cpp ---
75701
75702namespace f_test_dispatch_sentinels_3_ns {
75703
75704static void dispatch_call_emulator(const std::string& method) {
75705    throw pandas::IncompatibleFuncArgError(
75706        std::string("FuncDispatcher::call: no registered implementation for '") + method + "'");
75707}
75708
75709void case_1_exists_in_pd_exceptions_h() {
75710    std::cout << "----- case_1_exists_in_pd_exceptions_h -----\n";
75711    int local_fail = 0;
75712
75713    bool caught_func = false;
75714    try {
75715        throw pandas::IncompatibleFuncArgError("from pd_exceptions.h");
Series (pd_test_1_all.cpp:11161)
11151            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0}, "values");
11152
11153            // Pipe applies function to entire Series
11154            auto add_mean = [](const pandas::Series<double>& ser, double offset) {
11155                auto mean_val = ser.mean();
11156                std::vector<double> result;
11157                for (size_t i = 0; i < ser.size(); ++i) {
11158                    result.push_back(ser[i] + mean_val.value_or(0.0) + offset);
11159                }
11160                return pandas::Series<double>(result, ser.name());
11161            };
11162
11163            auto result = s.pipe(add_mean, 10.0);
11164
11165            bool passed = true;
11166            // mean is 2.5, offset is 10.0, so each value + 12.5
11167            std::vector<double> expected = {13.5, 14.5, 15.5, 16.5};
11168            for (size_t i = 0; i < result.size(); ++i) {
11169                if (!approx_equal(result[i], expected[i])) {
11170                    passed = false;
adjoin (pd_test_3_all.cpp:25672)
25662// ------------------- pd_test_index_type_id (end) ------------------
25663
25664// ------------------- pd_test_display_formats (start) -----------------------------
25665// Tests for pandas/pd_display_formats.h formatting utilities
25666
25667namespace dataframe_tests_display_formats {
25668
25669void pd_test_display_formats_adjoin_basic() {
25670    std::cout << "========= display::adjoin basic =======================";
25671    std::vector<std::vector<std::string>> cols = {{"a", "bb"}, {"xxx", "y"}};
25672    std::string result = ::pandas::display::adjoin(1, cols);
25673    std::string expected = "a  xxx\nbb y  ";
25674    if (result != expected) {
25675        throw std::runtime_error("adjoin basic failed: got [" + result + "]");
25676    }
25677    std::cout << " -> tests passed" << std::endl;
25678}
25679
25680void pd_test_display_formats_adjoin_unequal() {
25681    std::cout << "========= display::adjoin unequal lengths =============";
25682    std::vector<std::vector<std::string>> cols = {{"a", "b", "c"}, {"x"}};
all_whole_numbers (pd_test_3_all.cpp:25515)
25505    std::cout << "========= round_ns_1000() ==============================";
25506    int64_t r = pandas::round_ns_1000(1500000000123456789.0);
25507    if (r % 1000 != 0)
25508        throw std::runtime_error("round_ns_1000 failed: not 1000-aligned");
25509    if (pandas::round_ns_1000(0.0) != 0)
25510        throw std::runtime_error("round_ns_1000 failed: zero");
25511    std::cout << " -> tests passed" << std::endl;
25512}
25513
25514void pd_test_value_classify_whole_numbers() {
25515    std::cout << "========= all_whole_numbers() ==========================";
25516    std::vector<double> v1 = {1.0, 2.0, 3.0};
25517    if (!pandas::all_whole_numbers(v1))
25518        throw std::runtime_error("all_whole_numbers failed: all whole");
25519    std::vector<double> v2 = {1.0, 2.5, 3.0};
25520    if (pandas::all_whole_numbers(v2))
25521        throw std::runtime_error("all_whole_numbers failed: has fraction");
25522    std::vector<double> v3 = {1.0, std::numeric_limits<double>::quiet_NaN(), 3.0};
25523    if (!pandas::all_whole_numbers(v3))
25524        throw std::runtime_error("all_whole_numbers failed: NaN ignored");
25525    std::cout << " -> tests passed" << std::endl;
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
arr (pd_test_1_all.cpp:45)
35            std::cout << "  [FAIL] : in pd_test_boolean_array_constructors() : initializer_list size != 4" << std::endl;
36            throw std::runtime_error("pd_test_boolean_array_constructors failed: initializer_list size != 4");
37        }
38
39        std::cout << " -> tests passed" << std::endl;
40    }
41
42    void pd_test_boolean_array_na_handling() {
43        std::cout << "========= BooleanArray: NA handling ======================= ";
44
45        pandas::BooleanArray arr({
46            std::optional<bool>(true),
47            std::nullopt,  // NA at index 1
48            std::optional<bool>(false)
49        });
50
51        if (!arr.is_na(1)) {
52            std::cout << "  [FAIL] : in pd_test_boolean_array_na_handling() : is_na(1) should be true" << std::endl;
53            throw std::runtime_error("pd_test_boolean_array_na_handling failed: is_na(1) should be true");
54        }
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
array (pd_test_1_all.cpp:7343)
7333    };
7334    pandas::DatetimeIndex idx(values, "with_nat");
7335
7336    bool passed = (idx.size() == 3);
7337    if (!passed) {
7338        std::cout << "  [FAIL] : in pd_test_datetime_index_optional_vector_constructor()" << std::endl;
7339        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7340    }
7341
7342    // Check that middle element is NA
7343    bool has_na = idx.array().is_na(1);
7344    passed = passed && has_na;
7345    if (!passed) {
7346        std::cout << "  [FAIL] : NA not preserved" << std::endl;
7347        throw std::runtime_error("pd_test_datetime_index_optional_vector_constructor failed");
7348    }
7349
7350    std::cout << " -> tests passed" << std::endl;
7351}
7352
7353void pd_test_datetime_index_copy_constructor() {
arrays (pd_test_1_all.cpp:10642)
10632    std::cout << " -> tests passed" << std::endl;
10633}
10634
10635// ============================================================================
10636// Set Operations Tests
10637// ============================================================================
10638
10639void pd_test_extension_index_append() {
10640    std::cout << "========= append =========================";
10641
10642    // Use same categories for both arrays (required by CategoricalArray::concat)
10643    std::vector<std::string> cats = {"a", "b", "c", "d"};
10644    pandas::CategoricalArray arr1({"a", "b"}, cats);
10645    pandas::CategoricalIndex idx1(arr1);
10646
10647    pandas::CategoricalArray arr2({"c", "d"}, cats);
10648    pandas::CategoricalIndex idx2(arr2);
10649
10650    auto appended = idx1.append(idx2);
10651
10652    bool passed = (appended.size() == 4);
arrays (pd_test_1_all.cpp:10642)
10632    std::cout << " -> tests passed" << std::endl;
10633}
10634
10635// ============================================================================
10636// Set Operations Tests
10637// ============================================================================
10638
10639void pd_test_extension_index_append() {
10640    std::cout << "========= append =========================";
10641
10642    // Use same categories for both arrays (required by CategoricalArray::concat)
10643    std::vector<std::string> cats = {"a", "b", "c", "d"};
10644    pandas::CategoricalArray arr1({"a", "b"}, cats);
10645    pandas::CategoricalIndex idx1(arr1);
10646
10647    pandas::CategoricalArray arr2({"c", "d"}, cats);
10648    pandas::CategoricalIndex idx2(arr2);
10649
10650    auto appended = idx1.append(idx2);
10651
10652    bool passed = (appended.size() == 4);
arrays (pd_test_1_all.cpp:10642)
10632    std::cout << " -> tests passed" << std::endl;
10633}
10634
10635// ============================================================================
10636// Set Operations Tests
10637// ============================================================================
10638
10639void pd_test_extension_index_append() {
10640    std::cout << "========= append =========================";
10641
10642    // Use same categories for both arrays (required by CategoricalArray::concat)
10643    std::vector<std::string> cats = {"a", "b", "c", "d"};
10644    pandas::CategoricalArray arr1({"a", "b"}, cats);
10645    pandas::CategoricalIndex idx1(arr1);
10646
10647    pandas::CategoricalArray arr2({"c", "d"}, cats);
10648    pandas::CategoricalIndex idx2(arr2);
10649
10650    auto appended = idx1.append(idx2);
10651
10652    bool passed = (appended.size() == 4);
axis_must_be_0_or_1_got (pd_test_5_all.cpp:72732)
72722        "axis must be 'index', 'columns', '0', or '1'",
72723        std::string(pandas::error_messages::kAxisMustBeIndexColumnsOrStr01),
72724        local_fail);
72725}
72726
72727void case_3_axis_format_helper(int& local_fail) {
72728    std::cout << "-- case_3_axis_format_helper\n";
72729    check_eq_str(
72730        "case_3.axis_got_2",
72731        "axis must be 0 or 1, got 2",
72732        pandas::error_messages::axis_must_be_0_or_1_got(2),
72733        local_fail);
72734    // Negative value pass-through — `std::to_string(long long)` handles
72735    // negatives uniformly; this guards future replacement with an
72736    // unsigned formatter.
72737    check_eq_str(
72738        "case_3.axis_got_neg7",
72739        "axis must be 0 or 1, got -7",
72740        pandas::error_messages::axis_must_be_0_or_1_got(-7),
72741        local_fail);
72742    // Large-int pass-through.
bdate_range (pd_test_3_all.cpp:1357)
1347    }
1348
1349    std::cout << " -> tests passed" << std::endl;
1350}
1351
1352// ============================================================================
1353// Category 8: DateTime Functions
1354// ============================================================================
1355
1356void pd_test_3_all_bdate_range() {
1357    std::cout << "========= bdate_range() ==============================";
1358
1359    // Create a business date range using start and end dates (not periods)
1360    // This avoids the incomplete periods implementation
1361    pandas::DatetimeIndex result = pandas::bdate_range(
1362        "2024-01-01",  // Monday
1363        "2024-01-05",  // Friday (5 weekdays: Mon-Fri)
1364        std::nullopt,  // Use end date, not periods
1365        "B",
1366        std::nullopt,
1367        true,
build_multiindex_from_string_arrays (pd_test_3_all.cpp:23316)
23306    if (!mi_names[0].has_value() || *mi_names[0] != "first") throw std::runtime_error("wrong name 0");
23307    if (!mi_names[1].has_value() || *mi_names[1] != "second") throw std::runtime_error("wrong name 1");
23308
23309    std::cout << "    -> test passed" << std::endl;
23310}
23311
23312void test_build_multiindex_from_arrays() {
23313    std::cout << "========= build_multiindex_from_arrays ================";
23314
23315    std::vector<std::vector<std::string>> arrays = {{"a", "a", "b"}, {"x", "y", "x"}};
23316    pandas::MultiIndex mi = pandas::construct_helpers::build_multiindex_from_string_arrays(arrays);
23317
23318    if (mi.size() != 3) throw std::runtime_error("expected size 3, got " + std::to_string(mi.size()));
23319    if (mi.nlevels() != 2) throw std::runtime_error("expected 2 levels, got " + std::to_string(mi.nlevels()));
23320
23321    auto tup = mi.get_tuple_str(1);
23322    if (tup[0] != "a" || tup[1] != "y") throw std::runtime_error("wrong tuple at index 1");
23323
23324    std::cout << "    -> test passed" << std::endl;
23325}
cannot_astype_convert (pd_test_5_all.cpp:74129)
74119    static_assert(
74120        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype(std::string{})),
74121                       std::string>,
74122        "unsupported_dtype must return std::string");
74123    static_assert(
74124        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_quoted(std::string{},
74125                                                                                 std::string{})),
74126                       std::string>,
74127        "unsupported_dtype_quoted must return std::string");
74128    static_assert(
74129        std::is_same_v<decltype(pandas::error_messages::cannot_astype_convert(std::string{},
74130                                                                              std::string{})),
74131                       std::string>,
74132        "cannot_astype_convert must return std::string");
74133    static_assert(
74134        std::is_same_v<decltype(pandas::error_messages::cannot_convert_index_to_dtype(std::string{},
74135                                                                                      std::string{})),
74136                       std::string>,
74137        "cannot_convert_index_to_dtype must return std::string");
74138    static_assert(
74139        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_for_multiindex(std::string{})),
cannot_cast (pd_test_5_all.cpp:72236)
72226    check_eq_str(
72227        "case_3.cat5_TypeError.unsupported_op",
72228        "unsupported operand type for +: 'object'",
72229        pandas::error_messages::unsupported_op("+", "object"),
72230        local_fail);
72231
72232    // Category 6: dtype — cannot cast.
72233    check_eq_str(
72234        "case_3.cat6_dtype.cannot_cast",
72235        "Cannot cast float64 to int64",
72236        pandas::error_messages::cannot_cast("float64", "int64"),
72237        local_fail);
72238
72239    // Category 7: UndefinedVariableError (eval/query).
72240    check_eq_str(
72241        "case_3.cat7_UndefinedVariable.undefined_variable",
72242        "name 'x' is not defined",
72243        pandas::error_messages::undefined_variable("x"),
72244        local_fail);
72245
72246    // Category 8: UnsortedIndexError — MultiIndex lexsort.
cannot_coerce_index (pd_test_5_all.cpp:88527)
88517    pandas::RangeIndex ri(0, 5, 1);
88518    auto v = pandas::coerce_to_vector<double>(
88519        static_cast<const pandas::IndexBase&>(ri));
88520    bool ok = (v.size() == 5) && (v[0] == 0.0) && (v[1] == 1.0) &&
88521              (v[2] == 2.0) && (v[3] == 3.0) && (v[4] == 4.0);
88522    pandas_tests::check(ok, "case_27_rangeindex_to_double()", local_fail);
88523}
88524
88525void case_28_error_message_byte_exact(int& local_fail) {
88526    std::cout << "-- case_28_error_message_byte_exact\n";
88527    std::string got = pandas::error_messages::cannot_coerce_index(
88528        "Index<string>", "int64_t");
88529    std::string expected = "Cannot coerce Index<string> to vector<int64_t>";
88530    bool ok = (got == expected);
88531    pandas_tests::check(ok, "case_28_error_message_byte_exact()", local_fail);
88532    if (!ok) std::cout << "  expected=[" << expected << "] got=[" << got
88533                       << "]\n";
88534}
88535
88536void case_29_error_message_different_kinds(int& local_fail) {
88537    std::cout << "-- case_29_error_message_different_kinds\n";
cannot_compare_types (pd_test_5_all.cpp:74699)
74689    // Format helpers exist and return std::string.
74690    static_assert(
74691        std::is_same_v<decltype(pandas::error_messages::numeric_only_false(std::string{})),
74692                       std::string>,
74693        "numeric_only_false must return std::string");
74694    static_assert(
74695        std::is_same_v<decltype(pandas::error_messages::numeric_only_false_sum_hint(std::string{})),
74696                       std::string>,
74697        "numeric_only_false_sum_hint must return std::string");
74698    static_assert(
74699        std::is_same_v<decltype(pandas::error_messages::cannot_compare_types(std::string{},
74700                                                                             std::string{})),
74701                       std::string>,
74702        "cannot_compare_types must return std::string");
74703    static_assert(
74704        std::is_same_v<decltype(pandas::error_messages::unsupported_binop(std::string{},
74705                                                                          std::string{},
74706                                                                          std::string{})),
74707                       std::string>,
74708        "unsupported_binop must return std::string");
cannot_convert_index_to_dtype (pd_test_5_all.cpp:74134)
74124        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_quoted(std::string{},
74125                                                                                 std::string{})),
74126                       std::string>,
74127        "unsupported_dtype_quoted must return std::string");
74128    static_assert(
74129        std::is_same_v<decltype(pandas::error_messages::cannot_astype_convert(std::string{},
74130                                                                              std::string{})),
74131                       std::string>,
74132        "cannot_astype_convert must return std::string");
74133    static_assert(
74134        std::is_same_v<decltype(pandas::error_messages::cannot_convert_index_to_dtype(std::string{},
74135                                                                                      std::string{})),
74136                       std::string>,
74137        "cannot_convert_index_to_dtype must return std::string");
74138    static_assert(
74139        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_for_multiindex(std::string{})),
74140                       std::string>,
74141        "unsupported_dtype_for_multiindex must return std::string");
74142    static_assert(
74143        std::is_same_v<decltype(pandas::error_messages::cannot_convert_value_in_column(
74144            std::string{}, std::string{}, std::string{}, std::size_t{0}, std::string{})),
cannot_convert_value_in_column (pd_test_5_all.cpp:74143)
74133    static_assert(
74134        std::is_same_v<decltype(pandas::error_messages::cannot_convert_index_to_dtype(std::string{},
74135                                                                                      std::string{})),
74136                       std::string>,
74137        "cannot_convert_index_to_dtype must return std::string");
74138    static_assert(
74139        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_for_multiindex(std::string{})),
74140                       std::string>,
74141        "unsupported_dtype_for_multiindex must return std::string");
74142    static_assert(
74143        std::is_same_v<decltype(pandas::error_messages::cannot_convert_value_in_column(
74144            std::string{}, std::string{}, std::string{}, std::size_t{0}, std::string{})),
74145                       std::string>,
74146        "cannot_convert_value_in_column must return std::string");
74147
74148    pandas_tests::check(true, "case_1.cat6_constants_and_helpers_type_pinned",
74149                        local_fail);
74150}
74151
74152void case_2_byte_exact_wording(int& local_fail) {
74153    std::cout << "-- case_2_byte_exact_wording\n";
canonical_dtype_name (pd_test_5_all.cpp:86367)
86357void case_1_series_complex_dtype_name(int& local_fail) {
86358    std::cout << "-- case_1_series_complex_dtype_name\n";
86359    pandas::Series<cdouble> s({cdouble(1.0, 2.0), cdouble(3.0, 4.0)});
86360    const std::string dt = s.dtype_name();
86361    pandas_tests::check(dt == "complex128",
86362          "case_1_series_complex_dtype_name.dtype_is_complex128_got_" + dt, local_fail);
86363}
86364
86365void case_2_series_canonical_dtype_name(int& local_fail) {
86366    std::cout << "-- case_2_series_canonical_dtype_name\n";
86367    const std::string canon = pandas::Series<cdouble>::canonical_dtype_name();
86368    pandas_tests::check(canon == "complex128",
86369          "case_2_canonical_dtype_name_is_complex128_got_" + canon, local_fail);
86370}
86371
86372void case_3_empty_series_complex_dtype(int& local_fail) {
86373    std::cout << "-- case_3_empty_series_complex_dtype\n";
86374    pandas::Series<cdouble> s(std::vector<cdouble>{});
86375    const std::string dt = s.dtype_name();
86376    pandas_tests::check(dt == "complex128",
86377          "case_3_empty_series_complex_dtype.dtype_is_complex128_got_" + dt, local_fail);
canonicalise_axis (pd_test_5_all.cpp:92263)
92253        "case_12_cond_series_broadcast_other_callable.ncols_eq_3",
92254        local_fail);
92255    pandas_tests::check(!result.to_string().empty(),
92256        "case_12_cond_series_broadcast_other_callable.to_string_nonempty",
92257        local_fail);
92258}
92259
92260void case_13_canonicalise_axis_string_index() {
92261    std::cout << "-- case_13_canonicalise_axis_string_index\n";
92262    int local_fail = 0;
92263    int got = pandas::canonicalise_axis(std::string("index"));
92264    pandas_tests::check(got == 0,
92265        "case_13_canonicalise_axis_string_index.eq_0", local_fail);
92266    // Sanity: distinct invocation should be stable.
92267    int got2 = pandas::canonicalise_axis(std::string("index"));
92268    pandas_tests::check(got2 == 0,
92269        "case_13_canonicalise_axis_string_index.stable_eq_0", local_fail);
92270    pandas_tests::check(got == got2,
92271        "case_13_canonicalise_axis_string_index.idempotent", local_fail);
92272}
canonicalise_axis (pd_test_5_all.cpp:92263)
92253        "case_12_cond_series_broadcast_other_callable.ncols_eq_3",
92254        local_fail);
92255    pandas_tests::check(!result.to_string().empty(),
92256        "case_12_cond_series_broadcast_other_callable.to_string_nonempty",
92257        local_fail);
92258}
92259
92260void case_13_canonicalise_axis_string_index() {
92261    std::cout << "-- case_13_canonicalise_axis_string_index\n";
92262    int local_fail = 0;
92263    int got = pandas::canonicalise_axis(std::string("index"));
92264    pandas_tests::check(got == 0,
92265        "case_13_canonicalise_axis_string_index.eq_0", local_fail);
92266    // Sanity: distinct invocation should be stable.
92267    int got2 = pandas::canonicalise_axis(std::string("index"));
92268    pandas_tests::check(got2 == 0,
92269        "case_13_canonicalise_axis_string_index.stable_eq_0", local_fail);
92270    pandas_tests::check(got == got2,
92271        "case_13_canonicalise_axis_string_index.idempotent", local_fail);
92272}
canonicalize_dtype_for_promote (pd_test_5_all.cpp:144807)
144797                  << "] got=[" << out << "]\n";
144798    }
144799}
144800
144801static void expect_canon(const std::string& tag,
144802                         std::string_view src,
144803                         const std::string& expected,
144804                         int& local_fail) {
144805    std::string out;
144806    try {
144807        out = pandas::detail::canonicalize_dtype_for_promote(src);
144808    } catch (const std::exception& e) {
144809        std::cout << "  exception: " << e.what() << "\n";
144810        out = "<exc>";
144811    }
144812    bool ok = (out == expected);
144813    pandas_tests::check(ok, "canonicalize_" + tag + "()", local_fail);
144814    if (!ok) {
144815        std::cout << "  src=[" << src << "] expected=[" << expected
144816                  << "] got=[" << out << "]\n";
144817    }
categorical_categories_dtype_from_np_dtype (pd_test_5_all.cpp:102945)
102935// --- f_test_C_26g_categorical_helpers_9.cpp ---
102936
102937namespace f_test_C_26g_categorical_helpers_9_ns {
102938
102939static void expect_categories_dtype(const std::string& label,
102940                                    std::string_view input_np_dtype,
102941                                    const std::string& expected,
102942                                    int& local_fail) {
102943    std::cout << "-- " << label << "\n";
102944    std::string got = pandas::detail::categorical_categories_dtype_from_np_dtype(input_np_dtype);
102945    pandas_tests::check(got == expected,
102946        label + "()_value", local_fail);
102947    if (got != expected) {
102948        std::cout << "  got=[" << got << "] expected=[" << expected << "]\n";
102949    }
102950}
102951
102952static void expect_value_to_str_some(const std::string& label,
102953                                     const pandas::CoreValueKind& v,
102954                                     const std::string& expected,
cell_to_dtype_kind (pd_test_5_all.cpp:93104)
93094void case_1_of_float(int& local_fail) {
93095    std::cout << "-- case_1_of_float\n";
93096    pandas::ApplyCellResult r = pandas::ApplyCellResult::of_float(3.14);
93097    pandas_tests::check(r.kind == pandas::ApplyCellResult::Kind::Float,
93098        "C_26_apply_cell_result_case_1_of_float()_kind",
93099        local_fail);
93100    pandas_tests::check(r.flt == 3.14,
93101        "C_26_apply_cell_result_case_1_of_float()_payload",
93102        local_fail);
93103    char k = pandas::cell_to_dtype_kind(r);
93104    pandas_tests::check(k == 'f',
93105        "C_26_apply_cell_result_case_1_of_float()_dtype_kind",
93106        local_fail);
93107    if (k != 'f') std::cout << "  got=[" << k << "] expected=[f]\n";
93108}
93109
93110void case_2_of_int(int& local_fail) {
93111    std::cout << "-- case_2_of_int\n";
93112    pandas::ApplyCellResult r = pandas::ApplyCellResult::of_int(
93113        static_cast<int64_t>(42));
classify_dtype (pd_test_5_all.cpp:87626)
87616// --- f_test_06_dtype_string_canonicalize_9.cpp ---
87617
87618namespace f_test_06_dtype_string_canonicalize_9_ns {
87619
87620static void check_classify(const std::string& label,
87621                           const std::string& input,
87622                           pandas::DTypeCategory expected_cat,
87623                           const std::string& expected_p1,
87624                           const std::string& expected_p2,
87625                           int& local_fail) {
87626    pandas::DTypeInfo info = pandas::classify_dtype(input);
87627    bool ok = (info.cat == expected_cat) &&
87628              (info.param1 == expected_p1) &&
87629              (info.param2 == expected_p2);
87630    pandas_tests::check(ok, label, local_fail);
87631    if (!ok) {
87632        std::cout << "  input    = [" << input << "]\n"
87633                  << "  expected = (cat=" << static_cast<int>(expected_cat)
87634                  << ", p1=[" << expected_p1 << "]"
87635                  << ", p2=[" << expected_p2 << "])\n"
87636                  << "  actual   = (cat=" << static_cast<int>(info.cat)
classify_value_dtype (pd_test_3_all.cpp:25475)
25465    return dataframe_tests_dst_offset::pd_test_dst_timezone_main();
25466}
25467// ------------------- pd_test_dst_timezone (end) ------------------
25468
25469// ------------------- pd_test_value_classify (start) ------------------
25470#include "../pandas/pd_value_classify.h"
25471
25472namespace dataframe_tests_value_classify {
25473
25474void pd_test_value_classify_dtype() {
25475    std::cout << "========= classify_value_dtype() =======================";
25476
25477    auto r1 = pandas::classify_value_dtype("datetime64[ns, US/Eastern]");
25478    if (r1.kind != pandas::ValueKind::DatetimeTZ || r1.tz != "US/Eastern")
25479        throw std::runtime_error("classify_value_dtype failed: DatetimeTZ");
25480    auto r2 = pandas::classify_value_dtype("datetime64[ns]");
25481    if (r2.kind != pandas::ValueKind::DatetimeNaive)
25482        throw std::runtime_error("classify_value_dtype failed: DatetimeNaive");
25483    auto r3 = pandas::classify_value_dtype("timedelta64[ns]");
25484    if (r3.kind != pandas::ValueKind::Timedelta)
25485        throw std::runtime_error("classify_value_dtype failed: Timedelta");
clear_cache (pd_test_1_all.cpp:19413)
19403            s.mean();
19404            s.min();
19405            s.max();
19406
19407            passed = s.has_cached_values() == true;
19408            if (!passed) {
19409                std::cout << "  [FAIL] : in pd_test_series_cache() : cache not populated" << std::endl;
19410                throw std::runtime_error("pd_test_series_cache failed: cache not populated");
19411            }
19412
19413            s.clear_cache();
19414            passed = s.has_cached_values() == false;
19415            if (!passed) {
19416                std::cout << "  [FAIL] : in pd_test_series_cache() : cache not cleared" << std::endl;
19417                throw std::runtime_error("pd_test_series_cache failed: cache not cleared");
19418            }
19419
19420            std::cout << " -> tests passed" << std::endl;
19421        }
19422
19423        void pd_test_series_string_repr() {
col_data (pd_test_4_all.cpp:5286)
5276namespace {
5277
5278// Build a DataFrame matching the original fixture *after* the sliced setitem.
5279// override_fn(orig) computes the replacement value for every row whose
5280// C-level (third level of the row MultiIndex) is "C1" or "C3".
5281template <typename Fn>
5282pandas::DataFrame build_slicer_post_state(Fn override_fn) {
5283    constexpr size_t N_ROWS = 64;  // 4 * 2 * 4 * 2
5284    constexpr size_t N_COLS = 4;
5285
5286    std::vector<std::vector<int64_t>> col_data(N_COLS);
5287    for (auto& v : col_data) v.reserve(N_ROWS);
5288
5289    for (size_t r = 0; r < N_ROWS; ++r) {
5290        // r decomposes as a*16 + b*8 + c*2 + d  (strides for 4·2·4·2)
5291        size_t c_lvl = (r / 2) % 4;            // 0..3 → C0..C3
5292        bool overridden = (c_lvl == 1 || c_lvl == 3);
5293        for (size_t c = 0; c < N_COLS; ++c) {
5294            int64_t orig = static_cast<int64_t>(r * N_COLS + c);
5295            col_data[c].push_back(overridden ? override_fn(orig) : orig);
5296        }
col_data (pd_test_4_all.cpp:5286)
5276namespace {
5277
5278// Build a DataFrame matching the original fixture *after* the sliced setitem.
5279// override_fn(orig) computes the replacement value for every row whose
5280// C-level (third level of the row MultiIndex) is "C1" or "C3".
5281template <typename Fn>
5282pandas::DataFrame build_slicer_post_state(Fn override_fn) {
5283    constexpr size_t N_ROWS = 64;  // 4 * 2 * 4 * 2
5284    constexpr size_t N_COLS = 4;
5285
5286    std::vector<std::vector<int64_t>> col_data(N_COLS);
5287    for (auto& v : col_data) v.reserve(N_ROWS);
5288
5289    for (size_t r = 0; r < N_ROWS; ++r) {
5290        // r decomposes as a*16 + b*8 + c*2 + d  (strides for 4·2·4·2)
5291        size_t c_lvl = (r / 2) % 4;            // 0..3 → C0..C3
5292        bool overridden = (c_lvl == 1 || c_lvl == 3);
5293        for (size_t c = 0; c < N_COLS; ++c) {
5294            int64_t orig = static_cast<int64_t>(r * N_COLS + c);
5295            col_data[c].push_back(overridden ? override_fn(orig) : orig);
5296        }
collect_index_union (pd_test_3_all.cpp:23100)
23090    std::cout << "========= collect_index_union basic ===================";
23091
23092    // Build two Index<string> with overlapping labels: ["a","b","c"] + ["b","c","d"]
23093    pandas::Index<std::string> idx1(std::vector<std::string>{"a", "b", "c"});
23094    pandas::Index<std::string> idx2(std::vector<std::string>{"b", "c", "d"});
23095
23096    std::vector<pandas::construct::SeriesInfo> infos = {
23097        {3, &idx1, false},
23098        {3, &idx2, false}
23099    };
23100    auto result = pandas::construct::collect_index_union(infos);
23101
23102    if (result.union_index.size() != 4)
23103        throw std::runtime_error("test_collect_union_basic: expected 4 labels, got " +
23104            std::to_string(result.union_index.size()));
23105    std::vector<std::string> expected = {"a", "b", "c", "d"};
23106    if (result.union_index != expected)
23107        throw std::runtime_error("test_collect_union_basic: wrong union labels");
23108    if (!result.has_series_with_index)
23109        throw std::runtime_error("test_collect_union_basic: has_series_with_index should be true");
23110    if (result.max_len != 3)
columns (pd_test_1_all.cpp:6220)
6210                throw std::runtime_error("pd_test_dataframe_properties failed: should be empty");
6211            }
6212
6213            // Test nbytes > 0 for non-empty
6214            if (df.nbytes() == 0) {
6215                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : nbytes should be > 0" << std::endl;
6216                throw std::runtime_error("pd_test_dataframe_properties failed: nbytes should be > 0");
6217            }
6218
6219            // Test columns index
6220            if (df.columns().size() != 3) {
6221                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : columns size != 3" << std::endl;
6222                throw std::runtime_error("pd_test_dataframe_properties failed: columns size != 3");
6223            }
6224
6225            // Test dtypes
6226            auto dtypes = df.dtypes();
6227            if (dtypes.size() != 3) {
6228                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : dtypes size != 3" << std::endl;
6229                throw std::runtime_error("pd_test_dataframe_properties failed: dtypes size != 3");
6230            }
columns (pd_test_1_all.cpp:6220)
6210                throw std::runtime_error("pd_test_dataframe_properties failed: should be empty");
6211            }
6212
6213            // Test nbytes > 0 for non-empty
6214            if (df.nbytes() == 0) {
6215                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : nbytes should be > 0" << std::endl;
6216                throw std::runtime_error("pd_test_dataframe_properties failed: nbytes should be > 0");
6217            }
6218
6219            // Test columns index
6220            if (df.columns().size() != 3) {
6221                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : columns size != 3" << std::endl;
6222                throw std::runtime_error("pd_test_dataframe_properties failed: columns size != 3");
6223            }
6224
6225            // Test dtypes
6226            auto dtypes = df.dtypes();
6227            if (dtypes.size() != 3) {
6228                std::cout << "  [FAIL] : in pd_test_dataframe_properties() : dtypes size != 3" << std::endl;
6229                throw std::runtime_error("pd_test_dataframe_properties failed: dtypes size != 3");
6230            }
compose_override (pd_test_5_all.cpp:93541)
93531void case_23_is_object_bool_false_for_object_int(int& local_fail) {
93532    std::cout << "-- case_23_is_object_bool_false_for_object_int\n";
93533    bool got = pandas::is_object_bool(std::string_view("object:int"));
93534    pandas_tests::check(got == false,
93535        "C_26_dtype_override_case_23_is_object_bool_false_for_object_int()_false",
93536        local_fail);
93537}
93538
93539void case_24_compose_object_bool_first(int& local_fail) {
93540    std::cout << "-- case_24_compose_object_bool_first\n";
93541    std::string got = pandas::compose_override(
93542        std::string_view("object:bool"),
93543        std::string_view("first"),
93544        std::string_view("bool"));
93545    bool ok = (got == "object");
93546    pandas_tests::check(ok,
93547        "C_26_dtype_override_case_24_compose_object_bool_first()_value",
93548        local_fail);
93549    if (!ok) std::cout << "  got=[" << got << "] expected=[object]\n";
93550}
current (pd_test_4_all.cpp:1140)
1130                      const std::string& actual) {
1131    int _f = 0;
1132    pandas_tests::check_str_ws(label, expected, actual, _f);
1133    if (_f > 0) throw std::runtime_error(label + ": str mismatch");
1134}
1135
1136// ----------------------------------------------------------------------------
1137// Case 1 — dtype.int32_df_nsmallest
1138// ----------------------------------------------------------------------------
1139void dtype_int32_df_nsmallest() {
1140    // Strategy B: synthesize the current (buggy) post-nsmallest state.
1141    // Column A is double because int32 is silently promoted inside
1142    // pandas::DataFrame::nsmallest today. Column B (from range(10)) stays
1143    // int64. Row index labels "2","6","4" are the original positions of the
1144    // 3 smallest A values, ties broken by first-occurrence.
1145    pandas::DataFrame df;
1146    df.add_column<double>("A", std::vector<double>{1.0, 2.0, 3.0});
1147    df.add_column<int64_t>("B", std::vector<int64_t>{2, 6, 4});
1148    df.set_index(std::make_unique<pandas::Index<std::string>>(
1149        std::vector<std::string>{"2", "6", "4"}));
1150    apply_default_display(df);
cut (pd_test_3_all.cpp:13483)
13473    }
13474
13475    std::cout << " -> tests passed" << std::endl;
13476}
13477
13478// ============================================================================
13479// Cut and Qcut Tests
13480// ============================================================================
13481
13482void pd_test_top_level_cut() {
13483    std::cout << "========= cut() =======================================";
13484
13485    std::vector<double> x = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
13486
13487    // Test cut with number of bins
13488    pandas::CutResult<double> result = pandas::cut<double>(x, 4);
13489    if (result.bins.size() != 4) {
13490        std::cout << "  [FAIL] : in pd_test_top_level_cut() : expected 4 bins, got " << result.bins.size() << std::endl;
13491        throw std::runtime_error("pd_test_top_level_cut failed: wrong bin count");
13492    }
13493    if (result.labels.size() != 4) {
date_range (pd_test_1_all.cpp:7908)
7898    }
7899
7900    std::cout << " -> tests passed" << std::endl;
7901}
7902
7903// ============================================================================
7904// Factory Function Tests
7905// ============================================================================
7906
7907void pd_test_datetime_index_date_range_start_end() {
7908    std::cout << "========= date_range (start, end) =====================";
7909
7910    auto idx = pandas::date_range("2020-01-01", "2020-01-10");
7911
7912    bool passed = (idx.size() == 10);
7913    if (!passed) {
7914        std::cout << "  [FAIL] : expected 10 elements, got " << idx.size() << std::endl;
7915        throw std::runtime_error("pd_test_datetime_index_date_range_start_end failed");
7916    }
7917
7918    std::cout << " -> tests passed" << std::endl;
date_range (pd_test_1_all.cpp:7908)
7898    }
7899
7900    std::cout << " -> tests passed" << std::endl;
7901}
7902
7903// ============================================================================
7904// Factory Function Tests
7905// ============================================================================
7906
7907void pd_test_datetime_index_date_range_start_end() {
7908    std::cout << "========= date_range (start, end) =====================";
7909
7910    auto idx = pandas::date_range("2020-01-01", "2020-01-10");
7911
7912    bool passed = (idx.size() == 10);
7913    if (!passed) {
7914        std::cout << "  [FAIL] : expected 10 elements, got " << idx.size() << std::endl;
7915        throw std::runtime_error("pd_test_datetime_index_date_range_start_end failed");
7916    }
7917
7918    std::cout << " -> tests passed" << std::endl;
date_range_with_offset (pd_test_3_all.cpp:24739)
24729int pd_test_rolling_time_main() {
24730    return dataframe_tests_rolling_time::pd_test_rolling_time_main();
24731}
24732// ------------------- pd_test_rolling_time (end) ---------------------------
24733
24734// ------------------- pd_test_date_range_offset (start) ---------------------------
24735namespace dataframe_tests_date_range_offset {
24736
24737void pd_test_date_range_offset_with_periods() {
24738    std::cout << "========= date_range_with_offset (periods) =======================";
24739    // BusinessDay(1) from 2024-01-01 (Mon) with periods=5 => Mon-Fri
24740    pandas::BusinessDay bday(1);
24741    auto dti = pandas::date_range_with_offset(
24742        bday, "2024-01-01", std::nullopt, std::optional<size_t>(5));
24743    if (dti.size() != 5)
24744        throw std::runtime_error("expected 5 dates, got " + std::to_string(dti.size()));
24745    // Verify all 5 are weekdays Mon(0)-Fri(4)
24746    for (size_t i = 0; i < dti.size(); ++i) {
24747        auto val = dti.array()[i];
24748        if (!val.has_value())
datetime64_to_ns (pd_test_3_all.cpp:22775)
22765        throw std::runtime_error("test_time_unit_factor: Day factor wrong");
22766
22767    std::cout << "    -> test passed" << std::endl;
22768}
22769
22770void test_datetime64_to_ns() {
22771    std::cout << "  test_datetime64_to_ns" << std::endl;
22772
22773    // 5 microseconds = 5000 nanoseconds
22774    numpy::datetime64 dt_us(5, numpy::DateTimeUnit::Microsecond);
22775    int64_t ns_us = pandas::construct_helpers::datetime64_to_ns(dt_us);
22776    if (ns_us != 5000LL)
22777        throw std::runtime_error("test_datetime64_to_ns: 5 us should be 5000 ns, got " + std::to_string(ns_us));
22778
22779    // 1 second = 1e9 nanoseconds
22780    numpy::datetime64 dt_s(1, numpy::DateTimeUnit::Second);
22781    int64_t ns_s = pandas::construct_helpers::datetime64_to_ns(dt_s);
22782    if (ns_s != 1000000000LL)
22783        throw std::runtime_error("test_datetime64_to_ns: 1 s should be 1e9 ns, got " + std::to_string(ns_s));
22784
22785    // 2 nanoseconds = 2 nanoseconds (identity)
datetime_unit_to_ns_multiplier (pd_test_2_all.cpp:22559)
22549        ++g_fail;
22550    }
22551}
22552
22553// =====================================================================
22554// Unit multiplier tests
22555// =====================================================================
22556
22557void test_datetime_unit_ns_multiplier() {
22558    std::cout << "  -- test_datetime_unit_ns_multiplier --" << std::endl;
22559    check(pandas::datetime_unit_to_ns_multiplier("ns") == 1, "ns");
22560    check(pandas::datetime_unit_to_ns_multiplier("nanoseconds") == 1, "nanoseconds");
22561    check(pandas::datetime_unit_to_ns_multiplier("us") == 1000, "us");
22562    check(pandas::datetime_unit_to_ns_multiplier("microseconds") == 1000, "microseconds");
22563    check(pandas::datetime_unit_to_ns_multiplier("ms") == 1000000, "ms");
22564    check(pandas::datetime_unit_to_ns_multiplier("milliseconds") == 1000000, "milliseconds");
22565    check(pandas::datetime_unit_to_ns_multiplier("s") == 1000000000LL, "s");
22566    check(pandas::datetime_unit_to_ns_multiplier("seconds") == 1000000000LL, "seconds");
22567    check(pandas::datetime_unit_to_ns_multiplier("sec") == 1000000000LL, "sec");
22568    check(pandas::datetime_unit_to_ns_multiplier("m") == 60LL * 1000000000LL, "m");
22569    check(pandas::datetime_unit_to_ns_multiplier("min") == 60LL * 1000000000LL, "min");
day_of_week (pd_test_3_all.cpp:22018)
22008void test_dt_aliases() {
22009    std::cout << "========= dt accessor aliases ====================";
22010
22011    std::vector<numpy::datetime64> dates = {
22012        numpy::datetime64("2023-01-15"),
22013        numpy::datetime64("2023-06-20")
22014    };
22015    pandas::Series<numpy::datetime64> s(dates);
22016
22017    auto dow1 = s.dt().dayofweek();
22018    auto dow2 = s.dt().day_of_week();
22019    auto dow3 = s.dt().weekday();
22020
22021    if (dow1[0] != dow2[0] || dow1[0] != dow3[0]) {
22022        throw std::runtime_error("dt aliases: dayofweek/day_of_week/weekday mismatch");
22023    }
22024
22025    auto doy1 = s.dt().dayofyear();
22026    auto doy2 = s.dt().day_of_year();
22027
22028    if (doy1[0] != doy2[0]) {
days_in_month (pd_test_1_all.cpp:2766)
2756            std::cout << "  [FAIL] : day[0] should be 15" << std::endl;
2757            throw std::runtime_error("pd_test_period_array_day_components failed: day[0]");
2758        }
2759        auto d1 = days[1];
2760        if (!d1.has_value() || d1.value() != 25) {
2761            std::cout << "  [FAIL] : day[1] should be 25" << std::endl;
2762            throw std::runtime_error("pd_test_period_array_day_components failed: day[1]");
2763        }
2764
2765        // Days in month
2766        auto dim = arr.days_in_month();
2767        auto dim0 = dim[0];
2768        if (!dim0.has_value() || dim0.value() != 31) {
2769            std::cout << "  [FAIL] : days_in_month[0] should be 31 (March)" << std::endl;
2770            throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[0]");
2771        }
2772        auto dim1 = dim[1];
2773        if (!dim1.has_value() || dim1.value() != 31) {
2774            std::cout << "  [FAIL] : days_in_month[1] should be 31 (December)" << std::endl;
2775            throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[1]");
2776        }
days_in_month (pd_test_1_all.cpp:2766)
2756            std::cout << "  [FAIL] : day[0] should be 15" << std::endl;
2757            throw std::runtime_error("pd_test_period_array_day_components failed: day[0]");
2758        }
2759        auto d1 = days[1];
2760        if (!d1.has_value() || d1.value() != 25) {
2761            std::cout << "  [FAIL] : day[1] should be 25" << std::endl;
2762            throw std::runtime_error("pd_test_period_array_day_components failed: day[1]");
2763        }
2764
2765        // Days in month
2766        auto dim = arr.days_in_month();
2767        auto dim0 = dim[0];
2768        if (!dim0.has_value() || dim0.value() != 31) {
2769            std::cout << "  [FAIL] : days_in_month[0] should be 31 (March)" << std::endl;
2770            throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[0]");
2771        }
2772        auto dim1 = dim[1];
2773        if (!dim1.has_value() || dim1.value() != 31) {
2774            std::cout << "  [FAIL] : days_in_month[1] should be 31 (December)" << std::endl;
2775            throw std::runtime_error("pd_test_period_array_day_components failed: days_in_month[1]");
2776        }
detect_int_columns (pd_test_3_all.cpp:22937)
22927    col4.name = "D";
22928    col4.string_data = {"x", "y"};
22929    col4.is_numeric = false;
22930
22931    // Empty numeric -> is_int = false
22932    pandas::construct_helpers::RecordColumn col5;
22933    col5.name = "E";
22934    col5.is_numeric = true;
22935
22936    std::vector<pandas::construct_helpers::RecordColumn> cols = {col1, col2, col3, col4, col5};
22937    pandas::construct_helpers::detect_int_columns(cols);
22938
22939    if (!cols[0].is_int)
22940        throw std::runtime_error("test_detect_int_columns: [1.0,2.0,3.0] should be is_int=true");
22941    if (cols[1].is_int)
22942        throw std::runtime_error("test_detect_int_columns: [1.5,2.0,3.0] should be is_int=false");
22943    if (cols[2].is_int)
22944        throw std::runtime_error("test_detect_int_columns: [1.0,NaN] should be is_int=false");
22945    if (cols[3].is_int)
22946        throw std::runtime_error("test_detect_int_columns: string col should be is_int=false");
22947    if (cols[4].is_int)
detect_tuple_key_levels (pd_test_3_all.cpp:22998)
22988        throw std::runtime_error("test_records_to_dataframe: column Y should not have int64 override");
22989
22990    std::cout << "    -> test passed" << std::endl;
22991}
22992
22993void test_detect_tuple_keys() {
22994    std::cout << "========= detect_tuple_key_levels ====================";
22995
22996    // All 2-tuples -> {true, 2}
22997    std::vector<std::pair<bool, size_t>> keys1 = {{true, 2}, {true, 2}, {true, 2}};
22998    auto info1 = pandas::construct_helpers::detect_tuple_key_levels(keys1);
22999    if (!info1.all_tuple_keys || info1.tuple_len != 2)
23000        throw std::runtime_error("test_detect_tuple_keys: all 2-tuples should be {true, 2}");
23001
23002    // Mixed lengths -> {false, 0}
23003    std::vector<std::pair<bool, size_t>> keys2 = {{true, 2}, {true, 3}};
23004    auto info2 = pandas::construct_helpers::detect_tuple_key_levels(keys2);
23005    if (info2.all_tuple_keys || info2.tuple_len != 0)
23006        throw std::runtime_error("test_detect_tuple_keys: mixed lengths should be {false, 0}");
23007
23008    // Non-tuple key -> {false, 0}
detect_tz_uniformity (pd_test_3_all.cpp:27218)
27208    check(std::abs(result[2] - 3.0) < 1e-10, "sqrt(9)==3");
27209    check(result.name() == "data", "name preserved");
27210}
27211
27212// Test 8: detect_tz_uniformity
27213void pd_test_detect_tz_uniformity() {
27214    std::cout << "  -- pd_test_detect_tz_uniformity --" << std::endl;
27215    // Uniform case
27216    {
27217        std::vector<std::string> tz_strings = {"UTC", "UTC", "UTC"};
27218        auto [uniform, tz] = ::pandas::detect_tz_uniformity(tz_strings);
27219        check(uniform, "all UTC -> uniform");
27220        check(tz == "UTC", "common tz == UTC");
27221    }
27222    // Non-uniform case
27223    {
27224        std::vector<std::string> tz_strings = {"UTC", "US/Eastern", "UTC"};
27225        auto [uniform, tz] = ::pandas::detect_tz_uniformity(tz_strings);
27226        check(!uniform, "mixed tz -> not uniform");
27227    }
27228    // Empty first entry
dt (pd_test_3_all.cpp:18239)
18229    if (offset.freqstr() != "D") {
18230        std::cout << "  [FAIL] : Day freqstr() failed" << std::endl;
18231        throw std::runtime_error("pd_test_day_offset: freqstr() failed");
18232    }
18233    if (offset.name() != "Day") {
18234        std::cout << "  [FAIL] : Day name() failed" << std::endl;
18235        throw std::runtime_error("pd_test_day_offset: name() failed");
18236    }
18237
18238    // Test apply
18239    numpy::datetime64 dt("2020-01-15");
18240    auto result = offset.apply(dt);
18241    std::tm tm = result.toTm();
18242    if (tm.tm_mday != 20) {
18243        std::cout << "  [FAIL] : Day apply() failed, got day " << tm.tm_mday << std::endl;
18244        throw std::runtime_error("pd_test_day_offset: apply() failed");
18245    }
18246
18247    std::cout << " -> tests passed" << std::endl;
18248}
dt (pd_test_3_all.cpp:18239)
18229    if (offset.freqstr() != "D") {
18230        std::cout << "  [FAIL] : Day freqstr() failed" << std::endl;
18231        throw std::runtime_error("pd_test_day_offset: freqstr() failed");
18232    }
18233    if (offset.name() != "Day") {
18234        std::cout << "  [FAIL] : Day name() failed" << std::endl;
18235        throw std::runtime_error("pd_test_day_offset: name() failed");
18236    }
18237
18238    // Test apply
18239    numpy::datetime64 dt("2020-01-15");
18240    auto result = offset.apply(dt);
18241    std::tm tm = result.toTm();
18242    if (tm.tm_mday != 20) {
18243        std::cout << "  [FAIL] : Day apply() failed, got day " << tm.tm_mday << std::endl;
18244        throw std::runtime_error("pd_test_day_offset: apply() failed");
18245    }
18246
18247    std::cout << " -> tests passed" << std::endl;
18248}
dt_idx (pd_test_1_all.cpp:15618)
15608void pd_test_is_all_dates() {
15609    std::cout << "========= is_all_dates() =========================";
15610
15611    // DatetimeIndex
15612    numpy::NDArray<numpy::datetime64> dt_data(std::vector<size_t>{1});
15613    dt_data.setElementAt({0}, numpy::datetime64(1000LL, numpy::DateTimeUnit::Nanosecond));
15614    numpy::NDArray<numpy::bool_> dt_mask(std::vector<size_t>{1});
15615    dt_mask.setElementAt({0}, numpy::bool_(false));
15616    pandas::DatetimeArray dt_arr(dt_data, dt_mask);
15617    pandas::DatetimeIndexBase dt_idx(dt_arr);
15618
15619    // TimedeltaIndex
15620    numpy::NDArray<numpy::timedelta64> td_data(std::vector<size_t>{1});
15621    td_data.setElementAt({0}, numpy::timedelta64(1000LL, numpy::DateTimeUnit::Nanosecond));
15622    numpy::NDArray<numpy::bool_> td_mask(std::vector<size_t>{1});
15623    td_mask.setElementAt({0}, numpy::bool_(false));
15624    pandas::TimedeltaArray td_arr(td_data, td_mask);
15625    pandas::TimedeltaIndexBase td_idx(td_arr);
15626
15627    // PeriodIndex
dt_idx (pd_test_1_all.cpp:15618)
15608void pd_test_is_all_dates() {
15609    std::cout << "========= is_all_dates() =========================";
15610
15611    // DatetimeIndex
15612    numpy::NDArray<numpy::datetime64> dt_data(std::vector<size_t>{1});
15613    dt_data.setElementAt({0}, numpy::datetime64(1000LL, numpy::DateTimeUnit::Nanosecond));
15614    numpy::NDArray<numpy::bool_> dt_mask(std::vector<size_t>{1});
15615    dt_mask.setElementAt({0}, numpy::bool_(false));
15616    pandas::DatetimeArray dt_arr(dt_data, dt_mask);
15617    pandas::DatetimeIndexBase dt_idx(dt_arr);
15618
15619    // TimedeltaIndex
15620    numpy::NDArray<numpy::timedelta64> td_data(std::vector<size_t>{1});
15621    td_data.setElementAt({0}, numpy::timedelta64(1000LL, numpy::DateTimeUnit::Nanosecond));
15622    numpy::NDArray<numpy::bool_> td_mask(std::vector<size_t>{1});
15623    td_mask.setElementAt({0}, numpy::bool_(false));
15624    pandas::TimedeltaArray td_arr(td_data, td_mask);
15625    pandas::TimedeltaIndexBase td_idx(td_arr);
15626
15627    // PeriodIndex
dtype_category_to_canonical_string (pd_test_5_all.cpp:87650)
87640}
87641
87642static void check_reverse(const std::string& label,
87643                          pandas::DTypeCategory cat,
87644                          const std::string& p1,
87645                          const std::string& p2,
87646                          const std::string& expected,
87647                          int& local_fail) {
87648    pandas::DTypeInfo info{cat, p1, p2};
87649    std::string actual =
87650        pandas::dtype_category_to_canonical_string(cat, info);
87651    bool ok = (actual == expected);
87652    pandas_tests::check(ok, label, local_fail);
87653    if (!ok) {
87654        std::cout << "  cat      = " << static_cast<int>(cat)
87655                  << " p1=[" << p1 << "] p2=[" << p2 << "]\n"
87656                  << "  expected = [" << expected << "]\n"
87657                  << "  actual   = [" << actual << "]\n";
87658    }
87659}
ensure_dtype_can_hold_na (pd_test_5_all.cpp:56410)
56400static std::string mp(std::string_view dt, pandas::detail::FillKind k, bool has_missing) {
56401    return pandas::detail::maybe_promote(dt, k, has_missing);
56402}
56403
56404static std::string mp_float(std::string_view dt, double fv) {
56405    return pandas::detail::maybe_promote(dt, pandas::detail::FillKind::Float, true, fv);
56406}
56407
56408static std::string ehd(std::string_view dt) {
56409    return pandas::detail::ensure_dtype_can_hold_na(dt);
56410}
56411
56412void pd_promote_9_413721_case_1_ehd_bool_promotes_to_object(int& local_fail) {
56413    std::cout << "----- case_1_ehd_bool_promotes_to_object -----\n";
56414    check_str("pd_promote.ehd_bool",           "object", ehd("bool"),        local_fail);
56415    check_str("pd_promote.ehd_object_bool",    "object", ehd("object:bool"), local_fail);
56416}
56417
56418void pd_promote_9_413721_case_2_ehd_native_int_promotes_to_float64(int& local_fail) {
56419    std::cout << "----- case_2_ehd_native_int_promotes_to_float64 -----\n";
extract_date_if_midnight (pd_test_3_all.cpp:25167)
25157    std::cout << "========= nanos_to_timestamp_str: pre-epoch 1960 =======";
25158    int64_t ns = pandas::Timestamp::componentsToNanos(1960, 1, 1, 0, 0, 0, 0, 0);
25159    auto result = pandas::datetime_utils::nanos_to_timestamp_str(ns);
25160    if (result != "1960-01-01 00:00:00")
25161        throw std::runtime_error("nanos_to_str pre-epoch: got " + result);
25162    std::cout << " -> tests passed" << std::endl;
25163}
25164
25165void pd_test_datetime_utils_midnight() {
25166    std::cout << "========= extract_date_if_midnight: midnight ===========";
25167    auto r = pandas::datetime_utils::extract_date_if_midnight("2000-01-06 00:00:00");
25168    if (r != "2000-01-06")
25169        throw std::runtime_error("extract_date midnight: got " + r);
25170    std::cout << " -> tests passed" << std::endl;
25171}
25172
25173void pd_test_datetime_utils_midnight_nanos() {
25174    std::cout << "========= extract_date_if_midnight: midnight+nanos =====";
25175    auto r = pandas::datetime_utils::extract_date_if_midnight("2000-01-06 00:00:00.000000000");
25176    if (r != "2000-01-06")
25177        throw std::runtime_error("extract_date midnight nanos: got " + r);
extract_epoch_seconds (pd_test_3_all.cpp:24668)
24658void pd_test_rolling_time_epoch_seconds() {
24659    std::cout << "========= extract_epoch_seconds ====================";
24660    // Create a 3-date DatetimeIndex: 2023-01-01, 2023-01-02, 2023-01-03
24661    std::vector<numpy::datetime64> dates = {
24662        numpy::datetime64("2023-01-01"),
24663        numpy::datetime64("2023-01-02"),
24664        numpy::datetime64("2023-01-03")
24665    };
24666    pandas::DatetimeIndex dti(dates);
24667    auto epochs = pandas::extract_epoch_seconds(dti);
24668    if (epochs.size() != 3)
24669        throw std::runtime_error("expected 3 epoch values");
24670    // Consecutive days should be 86400s apart
24671    if (epochs[1] - epochs[0] != 86400)
24672        throw std::runtime_error("expected 86400s between day 1 and day 2");
24673    if (epochs[2] - epochs[1] != 86400)
24674        throw std::runtime_error("expected 86400s between day 2 and day 3");
24675    std::cout << " -> tests passed" << std::endl;
24676}
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
file (pd_test_2_all.cpp:3463)
3453                {"C", {100, 200, 300, 400, 500}}
3454            };
3455
3456            pandas::DataFrame df(data);
3457
3458            // Export to Excel
3459            std::string filepath = "temp/pd_test_excel_basic.xlsx";
3460            df.to_excel(filepath);
3461
3462            // Verify file was created
3463            std::ifstream file(filepath, std::ios::binary);
3464            if (!file.good()) {
3465                std::cout << "  [FAIL] : in pd_test_excel_basic() : File was not created" << std::endl;
3466                throw std::runtime_error("pd_test_excel_basic failed: file not created");
3467            }
3468
3469            // Check file size is reasonable (valid XLSX should be > 1KB)
3470            file.seekg(0, std::ios::end);
3471            auto size = file.tellg();
3472            if (size < 1000) {
3473                std::cout << "  [FAIL] : in pd_test_excel_basic() : File size too small: " << size << std::endl;
find_common_type (pd_test_5_all.cpp:39698)
39688}
39689
39690static pandas::DataFrame concat_axis1(const pandas::DataFrame& a,
39691                                      const pandas::DataFrame& b) {
39692    std::vector<pandas::DataFrame> frames{a, b};
39693    return pandas::concat(frames, /*axis=*/1);
39694}
39695
39696void f_concat_df_bool_int_524871_case_1_helper_bool_int8_object(int& local_fail) {
39697    std::cout << "-- case_1_helper_bool_int8_object\n";
39698    auto got = pandas::detail::find_common_type({"bool", "int8"});
39699    pandas_tests::check(got == "object",
39700        "case_1.find_common_type({bool,int8}) == object (got '" + got + "')",
39701        local_fail);
39702}
39703
39704void f_concat_df_bool_int_524871_case_2_helper_bool_int16_object(int& local_fail) {
39705    std::cout << "-- case_2_helper_bool_int16_object\n";
39706    auto got = pandas::detail::find_common_type({"bool", "int16"});
39707    pandas_tests::check(got == "object",
39708        "case_2.find_common_type({bool,int16}) == object (got '" + got + "')",
flatten_dict (pd_test_5_all.cpp:81031)
81021}
81022
81023// --- f_test_plan_06_normalize_jsonvalue_9.cpp ---
81024
81025namespace f_test_plan_06_normalize_jsonvalue_9_ns {
81026
81027struct PIO {
81028    static std::string json_value_to_string(const pandas::io::JsonValue& v) {
81029        return pandas::io::json_value_to_string(v);
81030    }
81031    static void flatten_dict(const pandas::io::JsonObject& d,
81032                             const std::string& prefix,
81033                             const std::string& sep,
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
81039    static const pandas::io::JsonValue* lookup_path(
81040            const pandas::io::JsonObject& root,
81041            const std::vector<std::string>& path) {
flatten_dict (pd_test_5_all.cpp:81031)
81021}
81022
81023// --- f_test_plan_06_normalize_jsonvalue_9.cpp ---
81024
81025namespace f_test_plan_06_normalize_jsonvalue_9_ns {
81026
81027struct PIO {
81028    static std::string json_value_to_string(const pandas::io::JsonValue& v) {
81029        return pandas::io::json_value_to_string(v);
81030    }
81031    static void flatten_dict(const pandas::io::JsonObject& d,
81032                             const std::string& prefix,
81033                             const std::string& sep,
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
81039    static const pandas::io::JsonValue* lookup_path(
81040            const pandas::io::JsonObject& root,
81041            const std::vector<std::string>& path) {
flatten_dict (pd_test_5_all.cpp:81031)
81021}
81022
81023// --- f_test_plan_06_normalize_jsonvalue_9.cpp ---
81024
81025namespace f_test_plan_06_normalize_jsonvalue_9_ns {
81026
81027struct PIO {
81028    static std::string json_value_to_string(const pandas::io::JsonValue& v) {
81029        return pandas::io::json_value_to_string(v);
81030    }
81031    static void flatten_dict(const pandas::io::JsonObject& d,
81032                             const std::string& prefix,
81033                             const std::string& sep,
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
81039    static const pandas::io::JsonValue* lookup_path(
81040            const pandas::io::JsonObject& root,
81041            const std::vector<std::string>& path) {
format_duplicate_label_error (pd_test_2_all.cpp:21263)
21253// =====================================================================
21254// 7F: Duplicate label error formatter
21255// =====================================================================
21256
21257void test_format_duplicate_label_error() {
21258    std::cout << "  -- test_format_duplicate_label_error --" << std::endl;
21259
21260    pandas::Index<std::string> idx({"a", "b", "a", "c", "b"});
21261
21262    std::string msg = pandas::format_duplicate_label_error(idx);
21263
21264    check(msg.find("Index has duplicates.") != std::string::npos, "has_header");
21265    check(msg.find("positions") != std::string::npos, "has_positions_header");
21266    check(msg.find("label") != std::string::npos, "has_label_header");
21267    // "a" appears at positions 0, 2
21268    check(msg.find("[0, 2]") != std::string::npos, "a_positions");
21269    // "b" appears at positions 1, 4
21270    check(msg.find("[1, 4]") != std::string::npos, "b_positions");
21271}
format_float (pd_test_5_all.cpp:57514)
57504    std::vector<double> v = {1.5, 2.25};
57505    int p = pandas::detail::infer_float_repr_precision(std::span<const double>(v));
57506    // Plan 14 Case 27 inverted: helper returns 2 (1.5 -> 1dp, 2.25 -> 2dp,
57507    // max = 2).
57508    pandas_tests::check(p == 2,
57509        "format_helpers_coverage_8b2f47_case_Plan14_27.infer_two_decimals", local_fail);
57510}
57511
57512static void f_format_helpers_coverage_8b2f47_case_B01_nan_prec0(int& local_fail) {
57513    std::cout << "-- case_B01_nan_prec0\n";
57514    std::string s = pandas::detail::format_float(
57515        std::numeric_limits<double>::quiet_NaN(), 0);
57516    pandas_tests::check(s == "NaN",
57517        "format_helpers_coverage_8b2f47_case_B01.NaN_prec0", local_fail);
57518}
57519
57520static void f_format_helpers_coverage_8b2f47_case_B02_nan_prec5(int& local_fail) {
57521    std::cout << "-- case_B02_nan_prec5\n";
57522    std::string s = pandas::detail::format_float(
57523        std::numeric_limits<double>::quiet_NaN(), 5);
57524    pandas_tests::check(s == "NaN",
format_pivot_cell_value (pd_test_2_all.cpp:21231)
21221    check(result.find("X") != std::string::npos, "contains_X");
21222    check(result.find("Y") != std::string::npos, "contains_Y");
21223    check(result.find("row1") != std::string::npos, "contains_row1");
21224    check(result.find("idx") != std::string::npos, "contains_idx");
21225}
21226
21227void test_format_pivot_cell_int() {
21228    std::cout << "  -- test_format_pivot_cell_int --" << std::endl;
21229
21230    // sum with integer value -> integer string
21231    check(pandas::display::format_pivot_cell_value(42.0, "42.0", "sum") == "42",
21232          "sum_int");
21233    // count with integer value -> integer string
21234    check(pandas::display::format_pivot_cell_value(7.0, "7.0", "count") == "7",
21235          "count_int");
21236    // min with integer -> integer string
21237    check(pandas::display::format_pivot_cell_value(3.0, "3.0", "min") == "3",
21238          "min_int");
21239    // max with integer -> integer string
21240    check(pandas::display::format_pivot_cell_value(100.0, "100.0", "max") == "100",
21241          "max_int");
format_pivot_multi_aggfunc (pd_test_2_all.cpp:21214)
21204    std::vector<std::string> sub_cols = {"X", "Y"};
21205
21206    // 4 data columns: (sum, X), (sum, Y), (mean, X), (mean, Y)
21207    std::vector<std::vector<std::string>> str_data = {
21208        {"10", "20"},   // sum, X
21209        {"30", "40"},   // sum, Y
21210        {"1.5", "2.5"}, // mean, X
21211        {"3.5", "4.5"}  // mean, Y
21212    };
21213
21214    std::string result = pandas::display::format_pivot_multi_aggfunc(
21215        idx_vals, idx_names, col_lvl, aggfuncs, sub_cols, str_data);
21216
21217    // Should produce a non-empty formatted string with hierarchical headers
21218    check(!result.empty(), "result_not_empty");
21219    check(result.find("sum") != std::string::npos, "contains_sum");
21220    check(result.find("mean") != std::string::npos, "contains_mean");
21221    check(result.find("X") != std::string::npos, "contains_X");
21222    check(result.find("Y") != std::string::npos, "contains_Y");
21223    check(result.find("row1") != std::string::npos, "contains_row1");
21224    check(result.find("idx") != std::string::npos, "contains_idx");
format_quantile_label (pd_test_3_all.cpp:25776)
25766int pd_test_display_formats_main() {
25767    return dataframe_tests_display_formats::pd_test_display_formats_main();
25768}
25769// ------------------- pd_test_display_formats (end) -----------------------------
25770
25771// ------------------- pd_test_series_format_helpers (begin) ---------------------
25772namespace dataframe_tests_series_format_helpers {
25773
25774void pd_test_series_format_helpers_quantile_label() {
25775    std::cout << "  format_quantile_label... ";
25776    std::string r1 = ::pandas::display::format_quantile_label(0.25);
25777    if (r1 != "0.25") throw std::runtime_error("Expected '0.25', got '" + r1 + "'");
25778    std::string r2 = ::pandas::display::format_quantile_label(0.5);
25779    if (r2 != "0.5") throw std::runtime_error("Expected '0.5', got '" + r2 + "'");
25780    std::string r3 = ::pandas::display::format_quantile_label(0.75);
25781    if (r3 != "0.75") throw std::runtime_error("Expected '0.75', got '" + r3 + "'");
25782    std::cout << "PASSED" << std::endl;
25783}
25784
25785void pd_test_series_format_helpers_quantile_list() {
25786    std::cout << "  quantile_list... ";
found (pd_test_2_all.cpp:13553)
13543            // Should have formatted values with 2 decimal places
13544            bool passed = md.find("3.14") != std::string::npos;
13545            if (!passed) {
13546                std::cout << "  [FAIL] : in pd_test_to_markdown_float_format() : formatted value not found" << std::endl;
13547                throw std::runtime_error("pd_test_to_markdown_float_format failed");
13548            }
13549
13550            // Should NOT have full precision
13551            passed = md.find("3.14159265") == std::string::npos;
13552            if (!passed) {
13553                std::cout << "  [FAIL] : in pd_test_to_markdown_float_format() : full precision found (should be formatted)" << std::endl;
13554                throw std::runtime_error("pd_test_to_markdown_float_format failed");
13555            }
13556
13557            std::cout << " -> tests passed" << std::endl;
13558        }
13559
13560        // Test custom column alignment
13561        void pd_test_to_markdown_colalign() {
13562            std::cout << "========= custom column alignment ===================";
found (pd_test_2_all.cpp:13553)
13543            // Should have formatted values with 2 decimal places
13544            bool passed = md.find("3.14") != std::string::npos;
13545            if (!passed) {
13546                std::cout << "  [FAIL] : in pd_test_to_markdown_float_format() : formatted value not found" << std::endl;
13547                throw std::runtime_error("pd_test_to_markdown_float_format failed");
13548            }
13549
13550            // Should NOT have full precision
13551            passed = md.find("3.14159265") == std::string::npos;
13552            if (!passed) {
13553                std::cout << "  [FAIL] : in pd_test_to_markdown_float_format() : full precision found (should be formatted)" << std::endl;
13554                throw std::runtime_error("pd_test_to_markdown_float_format failed");
13555            }
13556
13557            std::cout << " -> tests passed" << std::endl;
13558        }
13559
13560        // Test custom column alignment
13561        void pd_test_to_markdown_colalign() {
13562            std::cout << "========= custom column alignment ===================";
freq_to_seconds (pd_test_5_all.cpp:89804)
89794    df_in.add_column<double>("value", {1.0, 2.0, 3.0});
89795
89796    auto df = df_in.groupby("group").resample("D").sum();
89797    pandas_tests::check(df.nrows() == 3,
89798                        "case_12_aggregate_string_daily.nrows==3", local_fail);
89799}
89800
89801void case_13_aggregate_string_ms_nonempty(int& local_fail) {
89802    std::cout << "-- case_13_aggregate_string_ms_nonempty\n";
89803    // Sub-second source spans 5 ms. aggregate_string_cols_ today computes
89804    // `period_sec = freq_to_seconds("ms") * 1 = 0` and the inner
89805    // `i >= period_start && i < period_start + 0` filter never matches.
89806    // Combined with the resampler's own ms short-circuit, the whole
89807    // result frame is empty (nrows == 0). Post-fix, ms buckets carry
89808    // the source's tag values.
89809    pandas::DataFrame df_in;
89810    df_in.set_index(std::make_shared<pandas::DatetimeIndex>(
89811        mk_idx({"2020-01-01T00:00:00.000",
89812                "2020-01-01T00:00:00.002",
89813                "2020-01-01T00:00:00.005"})));
89814    df_in.add_column<std::string>("group", {"g", "g", "g"});
has_cached_values (pd_test_1_all.cpp:19395)
19385            }
19386
19387            std::cout << " -> tests passed" << std::endl;
19388        }
19389
19390        void pd_test_series_cache() {
19391            std::cout << "========= cache management =========================================";
19392
19393            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
19394
19395            bool passed = s.has_cached_values() == false;
19396            if (!passed) {
19397                std::cout << "  [FAIL] : in pd_test_series_cache() : initial cache not empty" << std::endl;
19398                throw std::runtime_error("pd_test_series_cache failed: initial cache not empty");
19399            }
19400
19401            // Trigger cache
19402            s.sum();
19403            s.mean();
19404            s.min();
19405            s.max();
infer_column_dtype (pd_test_5_all.cpp:81044)
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
81039    static const pandas::io::JsonValue* lookup_path(
81040            const pandas::io::JsonObject& root,
81041            const std::vector<std::string>& path) {
81042        return pandas::io::lookup_path(root, path);
81043    }
81044    static std::string infer_column_dtype(const std::vector<std::string>& vals,
81045                                          bool has_nan_token = true) {
81046        return pandas::io::infer_column_dtype(vals, has_nan_token);
81047    }
81048};
81049
81050using JsonValue  = pandas::io::JsonValue;
81051using JsonObject = pandas::io::JsonObject;
81052using JsonArray  = pandas::io::JsonArray;
81053
81054static void check_str(const std::string& label,
infer_dtype_override (pd_test_3_all.cpp:22817)
22807        throw std::runtime_error("test_timedelta64_to_ns: 2 h should be 7200000000000 ns, got " + std::to_string(ns_h));
22808
22809    std::cout << "    -> test passed" << std::endl;
22810}
22811
22812void test_infer_int_override() {
22813    std::cout << "  test_infer_int_override" << std::endl;
22814
22815    // Column [1.0, 2.0, 3.0] -- all whole numbers, should be int64
22816    std::vector<double> vals1{1.0, 2.0, 3.0};
22817    auto result1 = pandas::construct_helpers::infer_dtype_override(vals1, false);
22818    if (result1 != "int64")
22819        throw std::runtime_error("test_infer_int_override: [1.0,2.0,3.0] should infer as int64, got '" + result1 + "'");
22820
22821    // Column [1.5, 2.0] -- not all whole numbers
22822    std::vector<double> vals2{1.5, 2.0};
22823    auto result2 = pandas::construct_helpers::infer_dtype_override(vals2, false);
22824    if (result2 != "")
22825        throw std::runtime_error("test_infer_int_override: [1.5,2.0] should NOT infer as int, got '" + result2 + "'");
22826
22827    // Column [1.0, NaN] -- has NaN, should stay float64
infer_dtype_override_from_kinds (pd_test_5_all.cpp:94339)
94329    df.add_column<std::string>("s", { std::string("x"), std::string("y") });
94330    KVec col = { kv_str("a"), kv_str("b") };
94331    df.set_column_resolved("s", col);
94332    pandas_tests::check(df.column_dtype_override("s") == "string",
94333        "C_26h_case_159_set_column_string_replace()_dtype", local_fail);
94334}
94335
94336void case_200_inf_pure_int(int& local_fail) {
94337    std::cout << "-- case_200_inf_pure_int\n";
94338    KVec col = { kv_int(1) };
94339    std::string s = pandas::construct_helpers::infer_dtype_override_from_kinds(col);
94340    pandas_tests::check(s == "int64",
94341        "C_26h_case_200_inf_pure_int()_dtype", local_fail);
94342}
94343
94344void case_201_inf_int_with_na(int& local_fail) {
94345    std::cout << "-- case_201_inf_int_with_na\n";
94346    KVec col = { kv_int(1), kv_na() };
94347    std::string s = pandas::construct_helpers::infer_dtype_override_from_kinds(col);
94348    pandas_tests::check(s == "Int64",
94349        "C_26h_case_201_inf_int_with_na()_dtype", local_fail);
infer_float_repr_precision (pd_test_5_all.cpp:57296)
57286    f_test_astype_reindex_chain_coverage_23_main_ns::f_test_astype_reindex_chain_coverage_23_main();
57287}
57288
57289
57290// --- f_test_format_helpers_coverage_9.cpp ---
57291namespace f_test_format_helpers_coverage_9_main_ns {
57292
57293static void f_format_helpers_coverage_8b2f47_case_A01_empty_span_returns_min(int& local_fail) {
57294    std::cout << "-- case_A01_empty_span_returns_min\n";
57295    std::vector<double> v;
57296    int p = pandas::detail::infer_float_repr_precision(std::span<const double>(v));
57297    pandas_tests::check(p == 1,
57298        "format_helpers_coverage_8b2f47_case_A01.empty_returns_min1", local_fail);
57299}
57300
57301static void f_format_helpers_coverage_8b2f47_case_A02_all_integer_returns_min(int& local_fail) {
57302    std::cout << "-- case_A02_all_integer_returns_min\n";
57303    std::vector<double> v = {1.0, 2.0, 3.0};
57304    int p = pandas::detail::infer_float_repr_precision(std::span<const double>(v));
57305    pandas_tests::check(p == 1,
57306        "format_helpers_coverage_8b2f47_case_A02.all_integer_returns_min1", local_fail);
infer_freq (pd_test_3_all.cpp:9209)
9199    // Check 10 % 3 = 1
9200    if (std::abs(remainders[static_cast<size_t>(1)] - 1.0) > 0.001) {
9201        std::cout << "  [FAIL] : in pd_test_3_all_series_rdivmod() : remainder[1] wrong" << std::endl;
9202        throw std::runtime_error("pd_test_3_all_series_rdivmod failed: remainder");
9203    }
9204
9205    std::cout << " -> tests passed" << std::endl;
9206}
9207
9208// ============================================================================
9209// Category 36: Plan 10 - infer_freq()
9210// ============================================================================
9211
9212void pd_test_3_all_infer_freq() {
9213    std::cout << "========= infer_freq() daily ======================";
9214
9215    // Create a DatetimeIndex with daily frequency
9216    constexpr int64_t NS_PER_DAY = 24LL * 60 * 60 * 1000000000LL;
9217    int64_t base_ns = 0;  // 1970-01-01
9218
9219    std::vector<numpy::datetime64> dates;
info (pd_test_1_all.cpp:7122)
7112            }
7113            if (!empty_params_error) {
7114                std::cout << "  [FAIL] : select_dtypes empty params should throw" << std::endl;
7115                throw std::runtime_error("pd_test_dataframe_select_dtypes failed: empty params error");
7116            }
7117
7118            std::cout << " -> tests passed" << std::endl;
7119        }
7120
7121        // =====================================================================
7122        // Test: info() method
7123        // =====================================================================
7124        void pd_test_dataframe_info() {
7125            std::cout << "========= info ========================";
7126
7127            // Test basic info() with stringstream
7128            std::map<std::string, std::vector<int>> data = {
7129                {"A", {1, 2, 3, 4, 5}},
7130                {"B", {10, 20, 30, 40, 50}},
7131                {"C", {100, 200, 300, 400, 500}}
7132            };
interval_range (pd_test_3_all.cpp:13614)
13604    }
13605
13606    std::cout << " -> tests passed" << std::endl;
13607}
13608
13609// ============================================================================
13610// Interval Range Tests
13611// ============================================================================
13612
13613void pd_test_top_level_interval_range() {
13614    std::cout << "========= interval_range() ============================";
13615
13616    // Test with start, end, periods
13617    pandas::IntervalArray<double> result = pandas::interval_range<double>(
13618        std::optional<double>(0.0),
13619        std::optional<double>(10.0),
13620        std::optional<int>(5),
13621        std::nullopt,
13622        "right"
13623    );
invalid_join_type (pd_test_5_all.cpp:73122)
73112    if (s.empty()) return true;
73113    char back = s.back();
73114    return !(back == ' ' || back == '\t' || back == '\n' || back == '\r');
73115}
73116
73117void case_1_invalid_join_type_format(int& local_fail) {
73118    std::cout << "-- case_1_invalid_join_type_format\n";
73119    check_eq_str(
73120        "case_1.invalid_join_type_left",
73121        "Invalid join type: left",
73122        pandas::error_messages::invalid_join_type("left"),
73123        local_fail);
73124    check_eq_str(
73125        "case_1.invalid_join_type_outer",
73126        "Invalid join type: outer",
73127        pandas::error_messages::invalid_join_type("outer"),
73128        local_fail);
73129    // Empty pass-through — guards against future refactors that would
73130    // crash on empty input.
73131    check_eq_str(
73132        "case_1.invalid_join_type_empty",
invalid_join_type_with_valid_set (pd_test_5_all.cpp:73143)
73133        "Invalid join type: ",
73134        pandas::error_messages::invalid_join_type(""),
73135        local_fail);
73136}
73137
73138void case_2_invalid_join_type_long_form(int& local_fail) {
73139    std::cout << "-- case_2_invalid_join_type_long_form\n";
73140    check_eq_str(
73141        "case_2.invalid_join_type_with_valid_set_foo",
73142        "Invalid join type: foo. Must be 'left', 'right', 'inner', or 'outer'.",
73143        pandas::error_messages::invalid_join_type_with_valid_set("foo"),
73144        local_fail);
73145    check_eq_str(
73146        "case_2.invalid_join_type_with_valid_set_left",
73147        "Invalid join type: left. Must be 'left', 'right', 'inner', or 'outer'.",
73148        pandas::error_messages::invalid_join_type_with_valid_set("left"),
73149        local_fail);
73150    // Asymmetry pin: the long-form variant must NOT equal the short form.
73151    pandas_tests::check(
73152        pandas::error_messages::invalid_join_type_with_valid_set("left") !=
73153        pandas::error_messages::invalid_join_type("left"),
iss (pd_test_2_all.cpp:10348)
10338            try {
10339                df.to_clipboard(true, '\t', false);  // index=false
10340            } catch (const std::exception& e) {
10341                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl;
10342                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10343            }
10344
10345#ifdef _WIN32
10346            std::string clipboard = get_clipboard_text_with_retry();
10347            // Without index, first line should be just "A"
10348            std::istringstream iss(clipboard);
10349            std::string first_line;
10350            std::getline(iss, first_line);
10351            passed = first_line == "A";
10352            if (!passed) {
10353                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl;
10354                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10355            }
10356#endif
10357
10358            std::cout << " -> tests passed" << std::endl;
iss (pd_test_2_all.cpp:10348)
10338            try {
10339                df.to_clipboard(true, '\t', false);  // index=false
10340            } catch (const std::exception& e) {
10341                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl;
10342                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10343            }
10344
10345#ifdef _WIN32
10346            std::string clipboard = get_clipboard_text_with_retry();
10347            // Without index, first line should be just "A"
10348            std::istringstream iss(clipboard);
10349            std::string first_line;
10350            std::getline(iss, first_line);
10351            passed = first_line == "A";
10352            if (!passed) {
10353                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl;
10354                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10355            }
10356#endif
10357
10358            std::cout << " -> tests passed" << std::endl;
iss (pd_test_2_all.cpp:10348)
10338            try {
10339                df.to_clipboard(true, '\t', false);  // index=false
10340            } catch (const std::exception& e) {
10341                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : exception: " << e.what() << std::endl;
10342                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10343            }
10344
10345#ifdef _WIN32
10346            std::string clipboard = get_clipboard_text_with_retry();
10347            // Without index, first line should be just "A"
10348            std::istringstream iss(clipboard);
10349            std::string first_line;
10350            std::getline(iss, first_line);
10351            passed = first_line == "A";
10352            if (!passed) {
10353                std::cout << "  [FAIL] : in pd_test_to_clipboard_no_index() : first line was '" << first_line << "', expected 'A'" << std::endl;
10354                throw std::runtime_error("pd_test_to_clipboard_no_index failed");
10355            }
10356#endif
10357
10358            std::cout << " -> tests passed" << std::endl;
json_normalize (pd_test_3_all.cpp:9344)
9334    // Should have data columns: A, B (id and year are in the MultiIndex)
9335    if (result.ncols() != 2) {
9336        std::cout << "  [FAIL] : in pd_test_3_all_wide_to_long() : expected 2 columns, got " << result.ncols() << std::endl;
9337        throw std::runtime_error("pd_test_3_all_wide_to_long failed: ncols");
9338    }
9339
9340    std::cout << " -> tests passed" << std::endl;
9341}
9342
9343void pd_test_3_all_json_normalize() {
9344    std::cout << "========= json_normalize() ========================";
9345
9346    // Test with single row to verify basic functionality
9347    // (json_normalize only extracts numeric columns to DataFrame)
9348    // Note: Multi-row test skipped due to padding logic issue in implementation
9349    std::vector<std::map<std::string, std::variant<double, std::string, std::vector<double>>>> data = {
9350        {{"id", 1.0}, {"score", 95.0}, {"age", 25.0}}
9351    };
9352
9353    pandas::DataFrame result = pandas::json_normalize(data);
json_normalize (pd_test_3_all.cpp:9344)
9334    // Should have data columns: A, B (id and year are in the MultiIndex)
9335    if (result.ncols() != 2) {
9336        std::cout << "  [FAIL] : in pd_test_3_all_wide_to_long() : expected 2 columns, got " << result.ncols() << std::endl;
9337        throw std::runtime_error("pd_test_3_all_wide_to_long failed: ncols");
9338    }
9339
9340    std::cout << " -> tests passed" << std::endl;
9341}
9342
9343void pd_test_3_all_json_normalize() {
9344    std::cout << "========= json_normalize() ========================";
9345
9346    // Test with single row to verify basic functionality
9347    // (json_normalize only extracts numeric columns to DataFrame)
9348    // Note: Multi-row test skipped due to padding logic issue in implementation
9349    std::vector<std::map<std::string, std::variant<double, std::string, std::vector<double>>>> data = {
9350        {{"id", 1.0}, {"score", 95.0}, {"age", 25.0}}
9351    };
9352
9353    pandas::DataFrame result = pandas::json_normalize(data);
json_value_to_string (pd_test_5_all.cpp:81028)
81018        throw std::runtime_error("f_test_plan_08_table_read_table_9 failed");
81019    }
81020    std::cout << " -> tests passed" << std::endl;
81021}
81022
81023// --- f_test_plan_06_normalize_jsonvalue_9.cpp ---
81024
81025namespace f_test_plan_06_normalize_jsonvalue_9_ns {
81026
81027struct PIO {
81028    static std::string json_value_to_string(const pandas::io::JsonValue& v) {
81029        return pandas::io::json_value_to_string(v);
81030    }
81031    static void flatten_dict(const pandas::io::JsonObject& d,
81032                             const std::string& prefix,
81033                             const std::string& sep,
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
json_value_to_string (pd_test_5_all.cpp:81028)
81018        throw std::runtime_error("f_test_plan_08_table_read_table_9 failed");
81019    }
81020    std::cout << " -> tests passed" << std::endl;
81021}
81022
81023// --- f_test_plan_06_normalize_jsonvalue_9.cpp ---
81024
81025namespace f_test_plan_06_normalize_jsonvalue_9_ns {
81026
81027struct PIO {
81028    static std::string json_value_to_string(const pandas::io::JsonValue& v) {
81029        return pandas::io::json_value_to_string(v);
81030    }
81031    static void flatten_dict(const pandas::io::JsonObject& d,
81032                             const std::string& prefix,
81033                             const std::string& sep,
81034                             int max_level,
81035                             int level,
81036                             std::vector<std::pair<std::string, std::string>>& out) {
81037        pandas::io::flatten_dict(d, prefix, sep, max_level, level, out);
81038    }
label_not_found (pd_test_5_all.cpp:72206)
72196    check_eq_str(
72197        "case_3.cat1_DuplicateLabel.kCannotReindexDuplicate",
72198        "cannot reindex on an axis with duplicate labels",
72199        std::string(pandas::error_messages::kCannotReindexDuplicate),
72200        local_fail);
72201
72202    // Category 2: IndexingError — "[<label>] not in index".
72203    check_eq_str(
72204        "case_3.cat2_Indexing.label_not_found_foo",
72205        "[foo] not in index",
72206        pandas::error_messages::label_not_found("foo"),
72207        local_fail);
72208
72209    // Category 3: MergeError — no common columns. Prefix match is the
72210    // plan_91a contract; the trailing kwargs are stable too.
72211    {
72212        std::string m = std::string(pandas::error_messages::kMergeNoCommonColumns);
72213        bool prefix_ok = m.rfind("No common columns to perform merge on", 0) == 0;
72214        pandas_tests::check(prefix_ok, "case_3.cat3_Merge.kMergeNoCommonColumns_prefix",
72215                            local_fail);
72216    }
lreshape (pd_test_3_all.cpp:9281)
9271    }
9272
9273    std::cout << " -> tests passed" << std::endl;
9274}
9275
9276// ============================================================================
9277// Category 37: Plan 09 - Reshape Functions (lreshape, wide_to_long, json_normalize)
9278// ============================================================================
9279
9280void pd_test_3_all_lreshape() {
9281    std::cout << "========= lreshape() ==============================";
9282
9283    // Create wide-format data
9284    std::map<std::string, std::vector<double>> data = {
9285        {"id", {1.0, 2.0}},
9286        {"A1", {10.0, 20.0}},
9287        {"A2", {11.0, 21.0}},
9288        {"B1", {100.0, 200.0}},
9289        {"B2", {101.0, 201.0}}
9290    };
9291    pandas::DataFrame df(data);
make_offset_from_string (pd_test_3_all.cpp:24530)
24520int pd_test_boolean_mask_kleene_main() {
24521    return dataframe_tests_boolean_mask_kleene::pd_test_boolean_mask_kleene_main();
24522}
24523// ------------------- pd_test_boolean_mask_kleene.cpp (end) ---------------------------
24524
24525// ------------------- pd_test_shift_freq (start) ---------------------------
24526namespace dataframe_tests_shift_freq {
24527
24528void pd_test_shift_freq_make_offset() {
24529    std::cout << "========= make_offset_from_string ========================";
24530    auto d = pandas::shift_helpers::make_offset_from_string("D", 5);
24531    if (d->name() != "Day" || d->n() != 5)
24532        throw std::runtime_error("Day offset failed");
24533    auto b = pandas::shift_helpers::make_offset_from_string("B", 1);
24534    if (b->name() != "BusinessDay")
24535        throw std::runtime_error("BusinessDay offset failed");
24536    auto h = pandas::shift_helpers::make_offset_from_string("h", 2);
24537    if (h->name() != "Hour")
24538        throw std::runtime_error("Hour offset failed");
24539    auto m = pandas::shift_helpers::make_offset_from_string("min", 3);
24540    if (m->name() != "Minute")
make_series_from_data_arg (pd_test_5_all.cpp:76074)
76064    pandas::DataArg data;               // kind defaults to DataArgKind::Unknown
76065    pandas::DTypeHint dt;
76066    pandas::IndexHint ih;
76067    pandas::NameHint nh;
76068
76069    bool caught_typed = false;
76070    bool caught_wrong_sibling = false;
76071    bool caught_fallback = false;
76072    std::string captured_what;
76073    try {
76074        (void)pandas::make_series_from_data_arg(data, dt, ih, nh);
76075    } catch (const pandas::IncompatibleDataArgError& e) {
76076        caught_typed = true;
76077        captured_what = e.what();
76078    } catch (const pandas::IncompatibleFuncArgError&) {
76079        caught_wrong_sibling = true;
76080    } catch (const std::exception&) {
76081        caught_fallback = true;
76082    }
76083    pandas_tests::check(caught_typed, "case_14.real_factory_throws_typed_data_sentinel", local_fail);
76084    pandas_tests::check(!caught_wrong_sibling, "case_14.real_factory_not_caught_as_func_sibling", local_fail);
maybe_promote (pd_test_5_all.cpp:54766)
54756    while ((pos = rep.find("False", pos)) != std::string::npos) {
54757        ++n_false; ++pos;
54758    }
54759    pandas_tests::check(n_false == 1,
54760          "25b.repr has exactly one 'False' (the original), not 3", local_fail);
54761}
54762
54763void case_25_c_maybe_promote_bool_int(int& local_fail) {
54764    std::cout << "---- 25c maybe_promote_bool_int\n";
54765
54766    std::string got = ::pandas::detail::maybe_promote(
54767        "bool", ::pandas::detail::FillKind::Int, /*has_missing=*/true);
54768    pandas_tests::check(got == "object",
54769          "25c.maybe_promote(bool,Int,true)=='object' (got '" + got + "')",
54770          local_fail);
54771
54772    // Sanity: with has_missing=false, dtype is preserved.
54773    std::string got2 = ::pandas::detail::maybe_promote(
54774        "bool", ::pandas::detail::FillKind::Int, /*has_missing=*/false);
54775    pandas_tests::check(got2 == "bool",
54776          "25c.maybe_promote(bool,Int,false)=='bool' (no missing -> no promo)",
memory_usage (pd_test_1_all.cpp:27063)
27053        }
27054
27055        std::cout << "====================================== [OK] pd_test_value_counts test suite ========================== " << std::endl;
27056        return 0;
27057    }
27058
27059} // namespace dataframe_tests
27060// ------------------- pd_test_value_counts.cpp (end) -----------------------------
27061
27062// ------------------- pd_test_memory_usage.cpp (start) -----------------------------
27063// Tests for DataFrame.memory_usage() - pandas-compatible memory usage reporting
27064
27065namespace dataframe_tests {
27066    namespace dataframe_tests_memory_usage {
27067
27068        void pd_test_memory_usage_basic() {
27069            std::cout << "========= basic memory_usage =======================";
27070
27071            // Create a simple DataFrame with multiple columns
27072            std::map<std::string, std::vector<double>> data;
27073            data["A"] = {1.0, 2.0, 3.0, 4.0, 5.0};
memory_usage_total (pd_test_1_all.cpp:27203)
27193        void pd_test_memory_usage_total() {
27194            std::cout << "========= memory_usage_total ========================";
27195
27196            std::map<std::string, std::vector<double>> data;
27197            data["A"] = {1.0, 2.0, 3.0};
27198            data["B"] = {4.0, 5.0, 6.0};
27199
27200            pandas::DataFrame df(data);
27201
27202            size_t total = df.memory_usage_total();
27203
27204            // Total should be positive
27205            bool passed = (total > 0);
27206            if (!passed) {
27207                std::cout << "  [FAIL] : in pd_test_memory_usage_total() : Total memory should be positive" << std::endl;
27208                throw std::runtime_error("pd_test_memory_usage_total failed");
27209            }
27210
27211            std::cout << " -> tests passed" << std::endl;
27212        }
mi (pd_test_3_all.cpp:797)
787    numpy::NDArray<numpy::int64> codes1(std::vector<size_t>{4});
788    codes1.setElementAt({0}, 0);  // x
789    codes1.setElementAt({1}, 1);  // y
790    codes1.setElementAt({2}, 1);  // y
791    codes1.setElementAt({3}, 0);  // x
792
793    std::vector<numpy::NDArray<numpy::int64>> codes = {codes0, codes1};
794    std::vector<std::optional<std::string>> names = {"level_0", "level_1"};
795
796    pandas::MultiIndex mi(std::move(levels), std::move(codes), names);
797
798    // Remove unused levels
799    pandas::MultiIndex result = mi.remove_unused_levels();
800
801    // Result should have same size
802    if (result.size() != 4) {
803        std::cout << "  [FAIL] : in pd_test_3_all_multiindex_remove_unused() : size should be 4" << std::endl;
804        throw std::runtime_error("pd_test_3_all_multiindex_remove_unused failed: size");
805    }
mi (pd_test_3_all.cpp:797)
787    numpy::NDArray<numpy::int64> codes1(std::vector<size_t>{4});
788    codes1.setElementAt({0}, 0);  // x
789    codes1.setElementAt({1}, 1);  // y
790    codes1.setElementAt({2}, 1);  // y
791    codes1.setElementAt({3}, 0);  // x
792
793    std::vector<numpy::NDArray<numpy::int64>> codes = {codes0, codes1};
794    std::vector<std::optional<std::string>> names = {"level_0", "level_1"};
795
796    pandas::MultiIndex mi(std::move(levels), std::move(codes), names);
797
798    // Remove unused levels
799    pandas::MultiIndex result = mi.remove_unused_levels();
800
801    // Result should have same size
802    if (result.size() != 4) {
803        std::cout << "  [FAIL] : in pd_test_3_all_multiindex_remove_unused() : size should be 4" << std::endl;
804        throw std::runtime_error("pd_test_3_all_multiindex_remove_unused failed: size");
805    }
name (pd_test_1_all.cpp:295)
285            throw std::runtime_error("pd_test_boolean_array_reductions failed: mean");
286        }
287
288        std::cout << " -> tests passed" << std::endl;
289    }
290
291    void pd_test_boolean_array_dtype() {
292        std::cout << "========= BooleanArray: dtype ======================= ";
293
294        pandas::BooleanArray arr;
295        if (arr.dtype().name() != "boolean") {
296            std::cout << "  [FAIL] : in pd_test_boolean_array_dtype() : dtype name should be 'boolean'" << std::endl;
297            throw std::runtime_error("pd_test_boolean_array_dtype failed: dtype name");
298        }
299
300        if (arr.dtype().kind() != "b") {
301            std::cout << "  [FAIL] : in pd_test_boolean_array_dtype() : dtype kind should be 'b'" << std::endl;
302            throw std::runtime_error("pd_test_boolean_array_dtype failed: dtype kind");
303        }
304
305        std::cout << " -> tests passed" << std::endl;
name (pd_test_1_all.cpp:295)
285            throw std::runtime_error("pd_test_boolean_array_reductions failed: mean");
286        }
287
288        std::cout << " -> tests passed" << std::endl;
289    }
290
291    void pd_test_boolean_array_dtype() {
292        std::cout << "========= BooleanArray: dtype ======================= ";
293
294        pandas::BooleanArray arr;
295        if (arr.dtype().name() != "boolean") {
296            std::cout << "  [FAIL] : in pd_test_boolean_array_dtype() : dtype name should be 'boolean'" << std::endl;
297            throw std::runtime_error("pd_test_boolean_array_dtype failed: dtype name");
298        }
299
300        if (arr.dtype().kind() != "b") {
301            std::cout << "  [FAIL] : in pd_test_boolean_array_dtype() : dtype kind should be 'b'" << std::endl;
302            throw std::runtime_error("pd_test_boolean_array_dtype failed: dtype kind");
303        }
304
305        std::cout << " -> tests passed" << std::endl;
nanos_to_timestamp_str (pd_test_3_all.cpp:25141)
25131} // namespace dataframe_tests
25132
25133#include "../pandas/pd_datetime_utils.h"
25134#include "../pandas/pd_timestamp.h"
25135
25136namespace dataframe_tests {
25137namespace dataframe_tests_datetime_utils {
25138
25139void pd_test_datetime_utils_nanos_epoch() {
25140    std::cout << "========= nanos_to_timestamp_str: epoch ================";
25141    auto result = pandas::datetime_utils::nanos_to_timestamp_str(0);
25142    if (result != "1970-01-01 00:00:00")
25143        throw std::runtime_error("nanos_to_str epoch: got " + result);
25144    std::cout << " -> tests passed" << std::endl;
25145}
25146
25147void pd_test_datetime_utils_nanos_simple() {
25148    std::cout << "========= nanos_to_timestamp_str: 2023-06-15 12:30:45 ==";
25149    int64_t ns = pandas::Timestamp::componentsToNanos(2023, 6, 15, 12, 30, 45, 0, 0);
25150    auto result = pandas::datetime_utils::nanos_to_timestamp_str(ns);
25151    if (result != "2023-06-15 12:30:45")
normalize_date_string (pd_test_3_all.cpp:10607)
10597// Category 45: Period Range Parsing (Plan G3)
10598// ============================================================================
10599
10600namespace dataframe_tests_period_range_parsing {
10601
10602void pd_test_period_range_parsing_normalize() {
10603    std::cout << "========= normalize_date_string =======================";
10604    bool passed = true;
10605
10606    // US date: 1/1/2011 -> 2011-01-01
10607    std::string r1 = pandas::normalize_date_string("1/1/2011");
10608    if (r1 != "2011-01-01") {
10609        std::cout << "  [FAIL] : 1/1/2011 -> " << r1 << " (expected 2011-01-01)" << std::endl;
10610        passed = false;
10611    }
10612
10613    // 2-digit year: 12/31/99 -> 2099-12-31
10614    std::string r2 = pandas::normalize_date_string("12/31/99");
10615    if (r2 != "2099-12-31") {
10616        std::cout << "  [FAIL] : 12/31/99 -> " << r2 << " (expected 2099-12-31)" << std::endl;
10617        passed = false;
numeric_only_false (pd_test_5_all.cpp:74691)
74681                  "kPeriodFreqMismatch must be const std::string_view");
74682    static_assert(std::is_same_v<decltype(pandas::error_messages::kStrAccessorRequiresString),
74683                                 const std::string_view>,
74684                  "kStrAccessorRequiresString must be const std::string_view");
74685
74686    constexpr std::string_view k = pandas::error_messages::kAxisMustBe0Or1;
74687    static_assert(k.size() > 0, "kAxisMustBe0Or1 must have content");
74688
74689    // Format helpers exist and return std::string.
74690    static_assert(
74691        std::is_same_v<decltype(pandas::error_messages::numeric_only_false(std::string{})),
74692                       std::string>,
74693        "numeric_only_false must return std::string");
74694    static_assert(
74695        std::is_same_v<decltype(pandas::error_messages::numeric_only_false_sum_hint(std::string{})),
74696                       std::string>,
74697        "numeric_only_false_sum_hint must return std::string");
74698    static_assert(
74699        std::is_same_v<decltype(pandas::error_messages::cannot_compare_types(std::string{},
74700                                                                             std::string{})),
74701                       std::string>,
numeric_only_false_sum_hint (pd_test_5_all.cpp:74695)
74685    constexpr std::string_view k = pandas::error_messages::kAxisMustBe0Or1;
74686    static_assert(k.size() > 0, "kAxisMustBe0Or1 must have content");
74687
74688    // Format helpers exist and return std::string.
74689    static_assert(
74690        std::is_same_v<decltype(pandas::error_messages::numeric_only_false(std::string{})),
74691                       std::string>,
74692        "numeric_only_false must return std::string");
74693    static_assert(
74694        std::is_same_v<decltype(pandas::error_messages::numeric_only_false_sum_hint(std::string{})),
74695                       std::string>,
74696        "numeric_only_false_sum_hint must return std::string");
74697    static_assert(
74698        std::is_same_v<decltype(pandas::error_messages::cannot_compare_types(std::string{},
74699                                                                             std::string{})),
74700                       std::string>,
74701        "cannot_compare_types must return std::string");
74702    static_assert(
74703        std::is_same_v<decltype(pandas::error_messages::unsupported_binop(std::string{},
74704                                                                          std::string{},
ordinal_to_string (pd_test_3_all.cpp:22154)
22144void test_dt_to_period() {
22145    std::cout << "========= dt.to_period ===========================";
22146
22147    std::vector<numpy::datetime64> dates = {
22148        numpy::datetime64("2023-06-15")
22149    };
22150    pandas::Series<numpy::datetime64> s(dates);
22151
22152    auto result_d = s.dt().to_period("D");
22153    auto d_str = pandas::ordinal_to_string(result_d.at(0), result_d.freq());
22154    if (d_str != "2023-06-15") {
22155        throw std::runtime_error("dt.to_period(D): expected 2023-06-15, got " + d_str);
22156    }
22157
22158    auto result_m = s.dt().to_period("M");
22159    auto m_str = pandas::ordinal_to_string(result_m.at(0), result_m.freq());
22160    if (m_str != "2023-06") {
22161        throw std::runtime_error("dt.to_period(M): expected 2023-06, got " + m_str);
22162    }
out (pd_test_5_all.cpp:41536)
41526    for (size_t i = 0; i < v.size(); ++i) {
41527        if (i > 0) out += ", ";
41528        if (is_nan_d(v[i])) out += "NaT";
41529        else out += std::to_string(v[i]);
41530    }
41531    out += "]";
41532    return out;
41533}
41534
41535static std::vector<double> series_data(const pandas::Series<numpy::float64>& s) {
41536    std::vector<double> out(s.size());
41537    for (size_t i = 0; i < s.size(); ++i) {
41538        out[i] = static_cast<double>(s[i]);
41539    }
41540    return out;
41541}
41542
41543static void diag_pair(const pandas::Series<numpy::float64>& src,
41544                      const pandas::Series<numpy::float64>& res,
41545                      const char* tag) {
41546    std::cout << "  " << tag << " source dtype="
out (pd_test_5_all.cpp:41536)
41526    for (size_t i = 0; i < v.size(); ++i) {
41527        if (i > 0) out += ", ";
41528        if (is_nan_d(v[i])) out += "NaT";
41529        else out += std::to_string(v[i]);
41530    }
41531    out += "]";
41532    return out;
41533}
41534
41535static std::vector<double> series_data(const pandas::Series<numpy::float64>& s) {
41536    std::vector<double> out(s.size());
41537    for (size_t i = 0; i < s.size(); ++i) {
41538        out[i] = static_cast<double>(s[i]);
41539    }
41540    return out;
41541}
41542
41543static void diag_pair(const pandas::Series<numpy::float64>& src,
41544                      const pandas::Series<numpy::float64>& res,
41545                      const char* tag) {
41546    std::cout << "  " << tag << " source dtype="
pairwise_common_type (pd_test_5_all.cpp:40076)
40066    std::cout << "-- case_41_axis1_bool_int_B_int64\n";
40067    auto out = concat_axis1(df1<bool>("A", true), df1<std::int64_t>("B", 1));
40068    auto got = col_dtype(out, "B");
40069    pandas_tests::check(got == "int64",
40070        "case_41.axis1.B == int64 (got '" + got + "')",
40071        local_fail);
40072}
40073
40074void f_concat_df_bool_int_524871_case_42_series_helper_bool_int8_object(int& local_fail) {
40075    std::cout << "-- case_42_series_helper_bool_int8_object\n";
40076    auto got = pandas::detail::pairwise_common_type("bool", "int8");
40077    pandas_tests::check(got == "object",
40078        "case_42.pairwise(bool,int8) == object (got '" + got + "')",
40079        local_fail);
40080}
40081
40082void f_concat_df_bool_int_524871_case_43_series_helper_bool_int16_object(int& local_fail) {
40083    std::cout << "-- case_43_series_helper_bool_int16_object\n";
40084    auto got = pandas::detail::pairwise_common_type("bool", "int16");
40085    pandas_tests::check(got == "object",
40086        "case_43.pairwise(bool,int16) == object (got '" + got + "')",
parse_base_freq (pd_test_5_all.cpp:101481)
101471    const pandas::Hour* h = dynamic_cast<const pandas::Hour*>(off.get());
101472    pandas_tests::check(h != nullptr,
101473        "f_core_02_freq_factory_c02f7a_case_70.5H_is_Hour", local_fail);
101474    if (h) {
101475        pandas_tests::check(h->n() == 5,
101476            "f_core_02_freq_factory_c02f7a_case_70.5H_n5", local_fail);
101477    }
101478    // The legacy resampler classifier strips the multiplier itself; pass the
101479    // bare unit to mirror its call site.
101480    pandas_tests::check(
101481        pandas::parse_base_freq("H") == pandas::ResampleFreq::HOURLY,
101482        "f_core_02_freq_factory_c02f7a_case_70.H_resample_enum", local_fail);
101483}
101484
101485void f_core_02_freq_factory_c02f7a_case_71_sweep_resampler_Y(int& local_fail) {
101486    std::cout << "-- case_71_sweep_resampler_Y\n";
101487    // Yearly. Factory's ParsedFreq.base must be in the YEARLY-equivalent
101488    // set the legacy resampler if-chain matches against.
101489    pandas::DateOffset::ParsedFreq p =
101490        pandas::DateOffset::parse_freq_string("Y");
101491    bool yearly_base =
parse_closed_param (pd_test_3_all.cpp:24646)
24636}
24637// ------------------- pd_test_shift_freq (end) ---------------------------
24638
24639// ------------------- pd_test_rolling_time (begin) ---------------------------
24640#include "../pandas/pd_rolling.h"
24641
24642namespace dataframe_tests_rolling_time {
24643
24644void pd_test_rolling_time_parse_closed() {
24645    std::cout << "========= parse_closed_param =======================";
24646    if (pandas::parse_closed_param("") != 0)
24647        throw std::runtime_error("empty string should map to 0");
24648    if (pandas::parse_closed_param("right") != 0)
24649        throw std::runtime_error("'right' should map to 0");
24650    if (pandas::parse_closed_param("left") != 1)
24651        throw std::runtime_error("'left' should map to 1");
24652    if (pandas::parse_closed_param("both") != 2)
24653        throw std::runtime_error("'both' should map to 2");
24654    if (pandas::parse_closed_param("neither") != 3)
24655        throw std::runtime_error("'neither' should map to 3");
24656    std::cout << " -> tests passed" << std::endl;
parse_interval_closed (pd_test_5_all.cpp:69015)
69005        []() {
69006            (void)pandas::parse_period_freq("not_a_freq");
69007        },
69008        local_fail);
69009}
69010
69011void f_pybind_type_error_translator_9_5832641_case_18_interval_closed_invalid(int& local_fail) {
69012    std::cout << "-- f_pybind_type_error_translator_9_5832641_case_18_interval_closed_invalid\n";
69013    expect_invalid_argument("case_18_interval_closed_invalid",
69014        []() {
69015            (void)pandas::parse_interval_closed("invalid");
69016        },
69017        local_fail);
69018}
69019
69020void f_pybind_type_error_translator_9_5832641_case_19_timedelta_unknown_unit(int& local_fail) {
69021    std::cout << "-- f_pybind_type_error_translator_9_5832641_case_19_timedelta_unknown_unit\n";
69022    expect_invalid_argument("case_19_timedelta_unknown_unit",
69023        []() {
69024            (void)pandas::Timedelta("5zz");
69025        },
parse_offset_to_seconds (pd_test_5_all.cpp:101504)
101494    pandas_tests::check(yearly_base,
101495        "f_core_02_freq_factory_c02f7a_case_71.Y_yearly_base", local_fail);
101496    pandas_tests::check(
101497        pandas::parse_base_freq("Y") == pandas::ResampleFreq::YEARLY,
101498        "f_core_02_freq_factory_c02f7a_case_71.Y_resample_enum", local_fail);
101499}
101500
101501void f_core_02_freq_factory_c02f7a_case_72_sweep_offset_utils_D(int& local_fail) {
101502    std::cout << "-- case_72_sweep_offset_utils_D\n";
101503    // Target 6 of the Change Core-2.5 sweep: pd_offset_utils.h:38-55
101504    // parse_offset_to_seconds(). Factory must accept "D" and produce a
101505    // Day subclass; legacy classifier must return 86400 (24*60*60).
101506    std::unique_ptr<pandas::DateOffset> off =
101507        pandas::DateOffset::from_freq_string("D");
101508    pandas_tests::check(off != nullptr,
101509        "f_core_02_freq_factory_c02f7a_case_72.D_not_null", local_fail);
101510    pandas_tests::check(dynamic_cast<const pandas::Day*>(off.get()) != nullptr,
101511        "f_core_02_freq_factory_c02f7a_case_72.D_is_Day", local_fail);
101512    // Legacy parse_offset_to_seconds in pd_offset_utils.h must still agree.
101513    pandas_tests::check(
101514        pandas::parse_offset_to_seconds("D") == 86400LL,
parse_period_freq (pd_test_5_all.cpp:69006)
68996            // Same name twice — must throw on the uniqueness check.
68997            (void)ca.rename_categories(std::vector<std::string>{"dup", "dup"});
68998        },
68999        local_fail);
69000}
69001
69002void f_pybind_type_error_translator_9_5832641_case_17_period_freq_invalid(int& local_fail) {
69003    std::cout << "-- f_pybind_type_error_translator_9_5832641_case_17_period_freq_invalid\n";
69004    expect_invalid_argument("case_17_period_freq_invalid",
69005        []() {
69006            (void)pandas::parse_period_freq("not_a_freq");
69007        },
69008        local_fail);
69009}
69010
69011void f_pybind_type_error_translator_9_5832641_case_18_interval_closed_invalid(int& local_fail) {
69012    std::cout << "-- f_pybind_type_error_translator_9_5832641_case_18_interval_closed_invalid\n";
69013    expect_invalid_argument("case_18_interval_closed_invalid",
69014        []() {
69015            (void)pandas::parse_interval_closed("invalid");
69016        },
partial_string_getitem (pd_test_3_all.cpp:25296)
25286        std::cout << "  [FAIL] : expected 0 entries, got " << result.size() << std::endl;
25287        throw std::runtime_error("slice_by_ns_range empty failed");
25288    }
25289    std::cout << " -> tests passed" << std::endl;
25290}
25291
25292void pd_test_datetime_range_partial_year() {
25293    std::cout << "========= partial_string_getitem year ====================";
25294    auto s = make_hourly_series(48);
25295    const auto* dti = dynamic_cast<const pandas::DatetimeIndex*>(&s.index());
25296    auto r = pandas::datetime_utils::partial_string_getitem(s, *dti, "2013");
25297    if (r.kind != pandas::datetime_utils::PartialDateResult::Kind::RANGE) {
25298        std::cout << "  [FAIL] : expected RANGE" << std::endl;
25299        throw std::runtime_error("partial year kind failed");
25300    }
25301    if (r.range_series.size() != 48) {
25302        std::cout << "  [FAIL] : expected 48 entries, got " << r.range_series.size() << std::endl;
25303        throw std::runtime_error("partial year count failed");
25304    }
25305    std::cout << " -> tests passed" << std::endl;
25306}
period_idx (pd_test_2_all.cpp:16556)
16546#include "../pandas/pd_dataframe.h"
16547
16548namespace dataframe_tests {
16549    namespace dataframe_tests_to_timestamp {
16550
16551        void pd_test_to_timestamp_basic() {
16552            std::cout << "========= basic to_timestamp functionality =============";
16553
16554            // Create a PeriodIndex with yearly periods
16555            std::vector<std::string> periods = {"2023", "2024", "2025"};
16556            pandas::PeriodIndex period_idx(periods, "Y", "year_idx");
16557
16558            // Create DataFrame with PeriodIndex
16559            std::map<std::string, std::vector<double>> data;
16560            data["col1"] = {1.0, 2.0, 3.0};
16561            data["col2"] = {4.0, 5.0, 6.0};
16562            pandas::DataFrame df(data);
16563            df.set_index(std::make_unique<pandas::PeriodIndex>(period_idx));
16564
16565            // Verify it's a PeriodIndex
16566            const pandas::PeriodIndex* pidx = dynamic_cast<const pandas::PeriodIndex*>(&df.index());
period_idx (pd_test_2_all.cpp:16556)
16546#include "../pandas/pd_dataframe.h"
16547
16548namespace dataframe_tests {
16549    namespace dataframe_tests_to_timestamp {
16550
16551        void pd_test_to_timestamp_basic() {
16552            std::cout << "========= basic to_timestamp functionality =============";
16553
16554            // Create a PeriodIndex with yearly periods
16555            std::vector<std::string> periods = {"2023", "2024", "2025"};
16556            pandas::PeriodIndex period_idx(periods, "Y", "year_idx");
16557
16558            // Create DataFrame with PeriodIndex
16559            std::map<std::string, std::vector<double>> data;
16560            data["col1"] = {1.0, 2.0, 3.0};
16561            data["col2"] = {4.0, 5.0, 6.0};
16562            pandas::DataFrame df(data);
16563            df.set_index(std::make_unique<pandas::PeriodIndex>(period_idx));
16564
16565            // Verify it's a PeriodIndex
16566            const pandas::PeriodIndex* pidx = dynamic_cast<const pandas::PeriodIndex*>(&df.index());
pluralize_offset_name (pd_test_5_all.cpp:124417)
124407    } catch (const std::exception& e) {
124408        std::cout << "  oracle load failed: " << e.what() << "\n";
124409        ok = false;
124410    }
124411    pandas_tests::check(ok, "f_dateoffset_repr_226538_case_34.oracle_csv", local_fail);
124412}
124413
124414void f_dateoffset_repr_226538_case_35_virtual_dispatch(int& local_fail) {
124415    std::cout << "-- case_35_virtual_dispatch\n";
124416    // Plain default-inherited path: Day(2) reached via DateOffset* must use
124417    // pluralize_offset_name(name(), n_) and produce "<2 * Days>".
124418    std::unique_ptr<pandas::DateOffset> p = std::make_unique<pandas::Day>(2);
124419    std::string via_base   = p->repr();
124420    std::string via_static = pandas::Day(2).repr();
124421    // Anchored override path: YearEnd(1, month=6) reached via DateOffset*
124422    // must dispatch to YearEnd::repr() and produce "<YearEnd: month=6>".
124423    std::unique_ptr<pandas::DateOffset> q = std::make_unique<pandas::YearEnd>(1, false, 6);
124424    std::string anchored = q->repr();
124425    bool ok = (via_base == "<2 * Days>")
124426           && (via_static == "<2 * Days>")
124427           && (anchored == "<YearEnd: month=6>");
promote_for_fill (pd_test_5_all.cpp:97421)
97411};
97412
97413static void expect_promote(const std::string& tag,
97414                           std::string_view src,
97415                           pandas::FillValue fv,
97416                           bool has_missing,
97417                           const std::string& expected,
97418                           int& local_fail) {
97419    std::string out;
97420    try {
97421        out = pandas::detail::promote_for_fill(src, fv, has_missing);
97422    } catch (const std::exception& e) {
97423        std::cout << "  exception: " << e.what() << "\n";
97424        out = "<exc>";
97425    }
97426    bool ok = (out == expected);
97427    pandas_tests::check(ok, "promote_for_fill_" + tag + "()", local_fail);
97428    if (!ok) {
97429        std::cout << "  src=[" << src << "] expected=[" << expected
97430                  << "] got=[" << out << "]\n";
97431    }
propagate_aligned_dtype (pd_test_5_all.cpp:93017)
93007    std::cout << "-- case_27_propagate_dtype_nan_suppresses()\n";
93008    int local_fail = 0;
93009    auto df = make_1row_df();
93010    std::string col_before = df.dtype_string("x");
93011
93012    pandas::AlignmentResult ar;
93013    ar.kind = pandas::SetItemResult::PARTIAL_ALIGN;
93014    ar.has_nan_from_upcasting = true;
93015    ar.aligned_values = {std::numeric_limits<double>::quiet_NaN()};
93016
93017    pandas::propagate_aligned_dtype<std::int64_t>(df, std::string("x"), ar,
93018                                                  std::string("int64"));
93019    std::string col_after = df.dtype_string("x");
93020    pandas_tests::check(col_before == col_after,
93021        "f_test_25_propagate_dtype_nan_suppresses_604113.dtype_unchanged",
93022        local_fail);
93023}
93024
93025void case_28_propagate_dtype_no_nan_writes() {
93026    // has_nan_from_upcasting=false => propagation occurs; column dtype set.
93027    std::cout << "-- case_28_propagate_dtype_no_nan_writes()\n";
qcut (pd_test_3_all.cpp:13518)
13508    pandas::CutResult<double> result3 = pandas::cut<double>(x, edges, true, custom_labels);
13509    if (result3.labels[0] != "low" || result3.labels[1] != "medium" || result3.labels[2] != "high") {
13510        std::cout << "  [FAIL] : in pd_test_top_level_cut() : custom labels not applied" << std::endl;
13511        throw std::runtime_error("pd_test_top_level_cut failed: custom labels");
13512    }
13513
13514    std::cout << " -> tests passed" << std::endl;
13515}
13516
13517void pd_test_top_level_qcut() {
13518    std::cout << "========= qcut() ======================================";
13519
13520    std::vector<double> x = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
13521
13522    // Test qcut with 4 quantiles (quartiles)
13523    pandas::CutResult<double> result = pandas::qcut<double>(x, 4);
13524    // Should have approximately 4 bins (may be fewer if duplicates)
13525    if (result.bins.size() < 2) {
13526        std::cout << "  [FAIL] : in pd_test_top_level_qcut() : qcut should create bins" << std::endl;
13527        throw std::runtime_error("pd_test_top_level_qcut failed: no bins created");
13528    }
qcut (pd_test_3_all.cpp:13518)
13508    pandas::CutResult<double> result3 = pandas::cut<double>(x, edges, true, custom_labels);
13509    if (result3.labels[0] != "low" || result3.labels[1] != "medium" || result3.labels[2] != "high") {
13510        std::cout << "  [FAIL] : in pd_test_top_level_cut() : custom labels not applied" << std::endl;
13511        throw std::runtime_error("pd_test_top_level_cut failed: custom labels");
13512    }
13513
13514    std::cout << " -> tests passed" << std::endl;
13515}
13516
13517void pd_test_top_level_qcut() {
13518    std::cout << "========= qcut() ======================================";
13519
13520    std::vector<double> x = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
13521
13522    // Test qcut with 4 quantiles (quartiles)
13523    pandas::CutResult<double> result = pandas::qcut<double>(x, 4);
13524    // Should have approximately 4 bins (may be fewer if duplicates)
13525    if (result.bins.size() < 2) {
13526        std::cout << "  [FAIL] : in pd_test_top_level_qcut() : qcut should create bins" << std::endl;
13527        throw std::runtime_error("pd_test_top_level_qcut failed: no bins created");
13528    }
r (pd_test_3_all.cpp:11063)
11053}
11054
11055void pd_test_3_all_groupby_column_transform() {
11056    std::cout << "========= GroupBy.column<T>().transform() ===============";
11057    pandas::DataFrame df;
11058    df.add_column<std::string>("Sector", {"Tech","Tech","Fin","Fin"});
11059    df.add_column<double>("Return", {10.0, 20.0, 30.0, 40.0});
11060    auto demeaned = df.groupby("Sector").column<double>("Return").transform(
11061        [](const std::vector<double>& x) {
11062            double m = 0; for (double v : x) m += v; m /= x.size();
11063            std::vector<double> r(x.size());
11064            for (size_t i = 0; i < x.size(); ++i) r[i] = x[i] - m;
11065            return r;
11066        });
11067    if (demeaned.size() != 4 || std::abs(demeaned[0] - (-5.0)) > 1e-9) {
11068        std::cout << "  [FAIL] : in pd_test_3_all_groupby_column_transform()" << std::endl;
11069        throw std::runtime_error("groupby column transform failed");
11070    }
11071    std::cout << " -> tests passed" << std::endl;
11072}
read_clipboard (pd_test_3_all.cpp:13846)
13836        try {
13837            func();
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
read_csv (pd_test_1_all.cpp:13388)
13378        }
13379
13380        void pd_test_io_read_csv() {
13381            std::cout << "========= read_csv ===============================";
13382
13383            std::string csv_data = "name,value,count\n"
13384                                   "alpha,10.5,100\n"
13385                                   "beta,20.3,200\n"
13386                                   "gamma,30.1,300\n";
13387
13388            pandas::DataFrame df = pandas::DataFrame::read_csv(csv_data);
13389
13390            bool passed = (df.nrows() == 3 && df.ncols() == 3);
13391
13392            const auto& cols = df.columns();
13393            bool has_name = false, has_value = false, has_count = false;
13394            for (size_t i = 0; i < cols.size(); ++i) {
13395                std::string c = cols[i];
13396                if (c == "name") has_name = true;
13397                if (c == "value") has_value = true;
13398                if (c == "count") has_count = true;
read_csv (pd_test_1_all.cpp:13388)
13378        }
13379
13380        void pd_test_io_read_csv() {
13381            std::cout << "========= read_csv ===============================";
13382
13383            std::string csv_data = "name,value,count\n"
13384                                   "alpha,10.5,100\n"
13385                                   "beta,20.3,200\n"
13386                                   "gamma,30.1,300\n";
13387
13388            pandas::DataFrame df = pandas::DataFrame::read_csv(csv_data);
13389
13390            bool passed = (df.nrows() == 3 && df.ncols() == 3);
13391
13392            const auto& cols = df.columns();
13393            bool has_name = false, has_value = false, has_count = false;
13394            for (size_t i = 0; i < cols.size(); ++i) {
13395                std::string c = cols[i];
13396                if (c == "name") has_name = true;
13397                if (c == "value") has_value = true;
13398                if (c == "count") has_count = true;
read_csv (pd_test_1_all.cpp:13388)
13378        }
13379
13380        void pd_test_io_read_csv() {
13381            std::cout << "========= read_csv ===============================";
13382
13383            std::string csv_data = "name,value,count\n"
13384                                   "alpha,10.5,100\n"
13385                                   "beta,20.3,200\n"
13386                                   "gamma,30.1,300\n";
13387
13388            pandas::DataFrame df = pandas::DataFrame::read_csv(csv_data);
13389
13390            bool passed = (df.nrows() == 3 && df.ncols() == 3);
13391
13392            const auto& cols = df.columns();
13393            bool has_name = false, has_value = false, has_count = false;
13394            for (size_t i = 0; i < cols.size(); ++i) {
13395                std::string c = cols[i];
13396                if (c == "name") has_name = true;
13397                if (c == "value") has_value = true;
13398                if (c == "count") has_count = true;
read_csv (pd_test_1_all.cpp:13388)
13378        }
13379
13380        void pd_test_io_read_csv() {
13381            std::cout << "========= read_csv ===============================";
13382
13383            std::string csv_data = "name,value,count\n"
13384                                   "alpha,10.5,100\n"
13385                                   "beta,20.3,200\n"
13386                                   "gamma,30.1,300\n";
13387
13388            pandas::DataFrame df = pandas::DataFrame::read_csv(csv_data);
13389
13390            bool passed = (df.nrows() == 3 && df.ncols() == 3);
13391
13392            const auto& cols = df.columns();
13393            bool has_name = false, has_value = false, has_count = false;
13394            for (size_t i = 0; i < cols.size(); ++i) {
13395                std::string c = cols[i];
13396                if (c == "name") has_name = true;
13397                if (c == "value") has_value = true;
13398                if (c == "count") has_count = true;
read_excel (pd_test_3_all.cpp:13847)
13837            func();
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
read_excel (pd_test_3_all.cpp:13847)
13837            func();
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
read_excel (pd_test_3_all.cpp:13847)
13837            func();
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
read_excel (pd_test_3_all.cpp:13847)
13837            func();
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
read_feather (pd_test_3_all.cpp:13848)
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
read_feather (pd_test_3_all.cpp:13848)
13838            std::cout << "  [FAIL] : " << name << " should throw" << std::endl;
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
read_hdf (pd_test_2_all.cpp:11643)
11633            std::map<std::string, std::vector<double>> data = {
11634                {"col1", {1.0, 2.0}},
11635                {"col2", {4.0, 3.0}}
11636            };
11637            pandas::DataFrame df(data);
11638
11639            std::string temp_path = "temp/test_hdf5_basic.h5";
11640            df.to_hdf(temp_path, "my_key", "w");
11641
11642            // Read back and verify
11643            pandas::DataFrame df2 = pandas::DataFrame::read_hdf(temp_path, "my_key");
11644
11645            if (df2.nrows() != 2 || df2.ncols() != 2) {
11646                std::cout << "  [FAIL] : wrong dimensions" << std::endl;
11647                std::remove(temp_path.c_str());
11648                throw std::runtime_error("pd_test_to_hdf_basic failed");
11649            }
11650
11651            std::remove(temp_path.c_str());
11652            std::cout << " -> tests passed" << std::endl;
11653        }
read_hdf (pd_test_2_all.cpp:11643)
11633            std::map<std::string, std::vector<double>> data = {
11634                {"col1", {1.0, 2.0}},
11635                {"col2", {4.0, 3.0}}
11636            };
11637            pandas::DataFrame df(data);
11638
11639            std::string temp_path = "temp/test_hdf5_basic.h5";
11640            df.to_hdf(temp_path, "my_key", "w");
11641
11642            // Read back and verify
11643            pandas::DataFrame df2 = pandas::DataFrame::read_hdf(temp_path, "my_key");
11644
11645            if (df2.nrows() != 2 || df2.ncols() != 2) {
11646                std::cout << "  [FAIL] : wrong dimensions" << std::endl;
11647                std::remove(temp_path.c_str());
11648                throw std::runtime_error("pd_test_to_hdf_basic failed");
11649            }
11650
11651            std::remove(temp_path.c_str());
11652            std::cout << " -> tests passed" << std::endl;
11653        }
read_json (pd_test_1_all.cpp:13416)
13406            std::cout << " -> tests passed" << std::endl;
13407        }
13408
13409        void pd_test_io_read_json() {
13410            std::cout << "========= read_json ==============================";
13411
13412            // Columns orientation JSON
13413            std::string json_data = "{\"A\":[1,2,3],\"B\":[4,5,6]}";
13414
13415            pandas::DataFrame df = pandas::DataFrame::read_json(json_data, "columns");
13416
13417            bool passed = (df.nrows() == 3 && df.ncols() == 2);
13418
13419            if (!passed) {
13420                std::cout << "  [FAIL] : in pd_test_io_read_json() : read_json failed, rows="
13421                          << df.nrows() << " cols=" << df.ncols() << std::endl;
13422                throw std::runtime_error("pd_test_io_read_json failed");
13423            }
13424
13425            std::cout << " -> tests passed" << std::endl;
read_json (pd_test_1_all.cpp:13416)
13406            std::cout << " -> tests passed" << std::endl;
13407        }
13408
13409        void pd_test_io_read_json() {
13410            std::cout << "========= read_json ==============================";
13411
13412            // Columns orientation JSON
13413            std::string json_data = "{\"A\":[1,2,3],\"B\":[4,5,6]}";
13414
13415            pandas::DataFrame df = pandas::DataFrame::read_json(json_data, "columns");
13416
13417            bool passed = (df.nrows() == 3 && df.ncols() == 2);
13418
13419            if (!passed) {
13420                std::cout << "  [FAIL] : in pd_test_io_read_json() : read_json failed, rows="
13421                          << df.nrows() << " cols=" << df.ncols() << std::endl;
13422                throw std::runtime_error("pd_test_io_read_json failed");
13423            }
13424
13425            std::cout << " -> tests passed" << std::endl;
read_json (pd_test_1_all.cpp:13416)
13406            std::cout << " -> tests passed" << std::endl;
13407        }
13408
13409        void pd_test_io_read_json() {
13410            std::cout << "========= read_json ==============================";
13411
13412            // Columns orientation JSON
13413            std::string json_data = "{\"A\":[1,2,3],\"B\":[4,5,6]}";
13414
13415            pandas::DataFrame df = pandas::DataFrame::read_json(json_data, "columns");
13416
13417            bool passed = (df.nrows() == 3 && df.ncols() == 2);
13418
13419            if (!passed) {
13420                std::cout << "  [FAIL] : in pd_test_io_read_json() : read_json failed, rows="
13421                          << df.nrows() << " cols=" << df.ncols() << std::endl;
13422                throw std::runtime_error("pd_test_io_read_json failed");
13423            }
13424
13425            std::cout << " -> tests passed" << std::endl;
read_json (pd_test_1_all.cpp:13416)
13406            std::cout << " -> tests passed" << std::endl;
13407        }
13408
13409        void pd_test_io_read_json() {
13410            std::cout << "========= read_json ==============================";
13411
13412            // Columns orientation JSON
13413            std::string json_data = "{\"A\":[1,2,3],\"B\":[4,5,6]}";
13414
13415            pandas::DataFrame df = pandas::DataFrame::read_json(json_data, "columns");
13416
13417            bool passed = (df.nrows() == 3 && df.ncols() == 2);
13418
13419            if (!passed) {
13420                std::cout << "  [FAIL] : in pd_test_io_read_json() : read_json failed, rows="
13421                          << df.nrows() << " cols=" << df.ncols() << std::endl;
13422                throw std::runtime_error("pd_test_io_read_json failed");
13423            }
13424
13425            std::cout << " -> tests passed" << std::endl;
read_parquet (pd_test_3_all.cpp:13849)
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
read_parquet (pd_test_3_all.cpp:13849)
13839            return false;
13840        } catch (const std::exception&) {
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
read_pickle (pd_test_3_all.cpp:13851)
13841            return true;
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
read_sas (pd_test_3_all.cpp:13852)
13842        }
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
read_spss (pd_test_3_all.cpp:13853)
13843    };
13844
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
13863}
read_sql (pd_test_3_all.cpp:13855)
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
13863}
13864
13865// ============================================================================
read_sql (pd_test_3_all.cpp:13855)
13845    bool all_passed = true;
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
13863}
13864
13865// ============================================================================
read_stata (pd_test_3_all.cpp:13854)
13844    bool all_passed = true;
13845    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13846    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13847    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13848    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13849    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13850    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13851    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13852    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13853    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13854    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13855    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13856
13857    if (!all_passed) {
13858        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13859    }
13860
13861    std::cout << " -> tests passed" << std::endl;
13862}
read_stata (pd_test_3_all.cpp:13854)
13844    bool all_passed = true;
13845    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13846    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13847    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13848    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13849    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13850    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13851    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13852    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13853    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13854    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13855    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13856
13857    if (!all_passed) {
13858        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13859    }
13860
13861    std::cout << " -> tests passed" << std::endl;
13862}
read_table (pd_test_5_all.cpp:80121)
80111    std::cout << " -> tests passed" << std::endl;
80112}
80113
80114// --- f_test_plan_08_table_read_table_9.cpp ---
80115
80116namespace f_test_plan_08_table_read_table_9_ns {
80117
80118struct Detect {
80119    template <class S>
80120    static auto detect_options_map_2arg(int) -> decltype(
80121        pandas::read_table(
80122            std::declval<const S&>(),
80123            std::declval<const std::map<std::string,
80124                                        pandas::DataFrame::CsvOption>&>()),
80125        std::true_type{});
80126
80127    template <class S>
80128    static auto detect_options_map_2arg(...) -> std::false_type;
80129
80130    static constexpr bool has_options_map_overload =
80131        decltype(detect_options_map_2arg<std::string>(0))::value;
read_table (pd_test_5_all.cpp:80121)
80111    std::cout << " -> tests passed" << std::endl;
80112}
80113
80114// --- f_test_plan_08_table_read_table_9.cpp ---
80115
80116namespace f_test_plan_08_table_read_table_9_ns {
80117
80118struct Detect {
80119    template <class S>
80120    static auto detect_options_map_2arg(int) -> decltype(
80121        pandas::read_table(
80122            std::declval<const S&>(),
80123            std::declval<const std::map<std::string,
80124                                        pandas::DataFrame::CsvOption>&>()),
80125        std::true_type{});
80126
80127    template <class S>
80128    static auto detect_options_map_2arg(...) -> std::false_type;
80129
80130    static constexpr bool has_options_map_overload =
80131        decltype(detect_options_map_2arg<std::string>(0))::value;
read_xml (pd_test_3_all.cpp:13856)
13846    all_passed &= test_throws("read_clipboard", []() { pandas::read_clipboard(); });
13847    all_passed &= test_throws("read_excel", []() { pandas::read_excel("test.xlsx"); });
13848    all_passed &= test_throws("read_feather", []() { pandas::read_feather("test.feather"); });
13849    all_passed &= test_throws("read_parquet", []() { pandas::read_parquet("test.parquet"); });
13850    all_passed &= test_throws("read_hdf", []() { pandas::read_hdf("test.h5"); });
13851    all_passed &= test_throws("read_pickle", []() { pandas::read_pickle("test.pkl"); });
13852    all_passed &= test_throws("read_sas", []() { pandas::read_sas("test.sas7bdat"); });
13853    all_passed &= test_throws("read_spss", []() { pandas::read_spss("test.sav"); });
13854    all_passed &= test_throws("read_stata", []() { pandas::read_stata("test.dta"); });
13855    all_passed &= test_throws("read_sql", []() { pandas::read_sql("SELECT 1", "conn"); });
13856    all_passed &= test_throws("read_xml", []() { pandas::read_xml("test.xml"); });
13857
13858    if (!all_passed) {
13859        throw std::runtime_error("pd_test_top_level_read_stubs failed");
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
13863}
13864
13865// ============================================================================
13866// Set Eng Float Format Test
reconstruct_multiindex_from_levels_codes (pd_test_3_all.cpp:23292)
23282    std::cout << "    -> test passed" << std::endl;
23283}
23284
23285void test_reconstruct_multiindex() {
23286    std::cout << "========= reconstruct_multiindex ======================";
23287
23288    std::vector<std::vector<std::string>> levels = {{"a", "b"}, {"x", "y", "z"}};
23289    std::vector<std::vector<int64_t>> codes = {{0, 0, 1}, {0, 1, 2}};
23290    std::vector<std::optional<std::string>> names = {"first", "second"};
23291
23292    pandas::MultiIndex mi = pandas::construct_helpers::reconstruct_multiindex_from_levels_codes(levels, codes, names);
23293
23294    if (mi.size() != 3) throw std::runtime_error("expected size 3, got " + std::to_string(mi.size()));
23295    if (mi.nlevels() != 2) throw std::runtime_error("expected 2 levels");
23296
23297    auto tup0 = mi.get_tuple_str(0);
23298    if (tup0[0] != "a" || tup0[1] != "x") throw std::runtime_error("wrong tuple at 0");
23299    auto tup1 = mi.get_tuple_str(1);
23300    if (tup1[0] != "a" || tup1[1] != "y") throw std::runtime_error("wrong tuple at 1");
23301    auto tup2 = mi.get_tuple_str(2);
23302    if (tup2[0] != "b" || tup2[1] != "z") throw std::runtime_error("wrong tuple at 2");
records_to_dataframe (pd_test_3_all.cpp:22975)
22965    col2.is_numeric = true;
22966    col2.is_int = false;
22967
22968    pandas::construct_helpers::RecordColumn col3;
22969    col3.name = "Z";
22970    col3.string_data = {"a", "b", "c"};
22971    col3.is_numeric = false;
22972    col3.is_int = false;
22973
22974    std::vector<pandas::construct_helpers::RecordColumn> cols = {col1, col2, col3};
22975    pandas::DataFrame df = pandas::construct_helpers::records_to_dataframe<pandas::DataFrame>(cols);
22976
22977    // Check shape
22978    auto sh = df.shape();
22979    if (sh[0] != 3 || sh[1] != 3)
22980        throw std::runtime_error("test_records_to_dataframe: expected shape (3,3), got (" +
22981            std::to_string(sh[0]) + "," + std::to_string(sh[1]) + ")");
22982
22983    // Check int column dtype override
22984    if (df.column_dtype_override("X") != "int64")
22985        throw std::runtime_error("test_records_to_dataframe: column X should have dtype override int64");
repr (pd_test_1_all.cpp:10906)
10896    std::cout << " -> tests passed" << std::endl;
10897}
10898
10899void pd_test_extension_index_repr() {
10900    std::cout << "========= repr =========================";
10901
10902    pandas::CategoricalArray arr({"a", "b", "c"});
10903    // Use ExtensionIndex<CategoricalArray> directly to test base class repr
10904    pandas::ExtensionIndex<pandas::CategoricalArray> idx(arr, "test");
10905
10906    std::string repr_str = idx.repr();
10907
10908    bool passed = (!repr_str.empty() && repr_str.find("ExtensionIndex") != std::string::npos);
10909    if (!passed) {
10910        std::cout << "  [FAIL] : in pd_test_extension_index_repr() : repr check failed" << std::endl;
10911        throw std::runtime_error("pd_test_extension_index_repr failed");
10912    }
10913
10914    std::cout << " -> tests passed" << std::endl;
10915}
reset_option (pd_test_3_all.cpp:13407)
13397    // Test set_option
13398    pandas::set_option<int64_t>("display.max_rows", 100);
13399    int64_t new_max_rows = pandas::get_option<int64_t>("display.max_rows");
13400    if (new_max_rows != 100) {
13401        std::cout << "  [FAIL] : in pd_test_top_level_options() : set_option failed" << std::endl;
13402        throw std::runtime_error("pd_test_top_level_options failed: set_option");
13403    }
13404
13405    // Test reset_option
13406    pandas::reset_option("display.max_rows");
13407    max_rows = pandas::get_option<int64_t>("display.max_rows");
13408    if (max_rows != 60) {
13409        std::cout << "  [FAIL] : in pd_test_top_level_options() : reset_option failed" << std::endl;
13410        throw std::runtime_error("pd_test_top_level_options failed: reset_option");
13411    }
13412
13413    // Test describe_option
13414    std::string desc = pandas::describe_option("display.max_rows");
13415    if (desc.empty() || desc.find("display.max_rows") == std::string::npos) {
13416        std::cout << "  [FAIL] : in pd_test_top_level_options() : describe_option empty or missing key" << std::endl;
resolve_result_dtype (pd_test_5_all.cpp:151761)
151751    check_pwc("dtype_resolve_437102_case_62_int8_uint64_widens_f64",
151752              "int8", "uint64", "float64", local_fail);
151753    check_pwc("dtype_resolve_437102_case_62_int64_uint64_widens_f64",
151754              "int64", "uint64", "float64", local_fail);
151755}
151756
151757void f_dtype_resolve_437102_case_63_resolve_result_dtype(int& local_fail) {
151758    std::cout << "-- case_63_resolve_result_dtype\n";
151759    bool threw_empty = false;
151760    try {
151761        (void)pandas::detail::resolve_result_dtype({}, "sum", false);
151762    } catch (const std::invalid_argument&) {
151763        threw_empty = true;
151764    }
151765    pandas_tests::check(threw_empty,
151766          "dtype_resolve_437102_case_63_resolve_empty_throws", local_fail);
151767
151768    bool threw_object_mean = false;
151769    try {
151770        (void)pandas::detail::resolve_result_dtype({"object"}, "mean", false);
151771    } catch (const std::invalid_argument&) {
resolve_series_ctor_target_dtype (pd_test_5_all.cpp:129248)
129238    return h;
129239}
129240
129241static void expect_target(const std::string& tag,
129242                          const Hist& hist,
129243                          const std::string& src,
129244                          const std::string& expected,
129245                          int& local_fail) {
129246    std::string out;
129247    try {
129248        out = pandas::resolve_series_ctor_target_dtype(hist, src);
129249    } catch (const std::exception& e) {
129250        std::cout << "  exception: " << e.what() << "\n";
129251        out = "<exc>";
129252    }
129253    bool ok = (out == expected);
129254    pandas_tests::check(ok, "resolve_series_ctor_target_dtype_" + tag + "()", local_fail);
129255    if (!ok) {
129256        std::cout << "  src=[" << src << "] expected=[" << expected
129257                  << "] got=[" << out << "]\n";
129258    }
resolve_string_endpoint_ns (pd_test_3_all.cpp:25267)
25257    dti->set_freq("D");
25258    s.set_index(std::move(dti));
25259    return s;
25260}
25261
25262void pd_test_datetime_range_slice_basic() {
25263    std::cout << "========= slice_by_ns_range basic =======================";
25264    auto s = make_hourly_series(48);
25265    const auto* dti = dynamic_cast<const pandas::DatetimeIndex*>(&s.index());
25266    // Slice to first day: 2013-01-01 00:00 .. 2013-01-01 23:59:59.999999999
25267    int64_t start_ns = pandas::datetime_utils::resolve_string_endpoint_ns("2013-01-01", "left");
25268    int64_t end_ns   = pandas::datetime_utils::resolve_string_endpoint_ns("2013-01-01", "right");
25269    auto result = pandas::datetime_utils::slice_by_ns_range(s, *dti, start_ns, end_ns);
25270    if (result.size() != 24) {
25271        std::cout << "  [FAIL] : expected 24 entries, got " << result.size() << std::endl;
25272        throw std::runtime_error("slice_by_ns_range basic failed");
25273    }
25274    std::cout << " -> tests passed" << std::endl;
25275}
25276
25277void pd_test_datetime_range_slice_empty() {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
result (pd_test_1_all.cpp:15406)
15396    data.setElementAt({0}, numpy::datetime64(100LL, numpy::DateTimeUnit::Nanosecond));
15397    data.setElementAt({1}, numpy::datetime64(200LL, numpy::DateTimeUnit::Nanosecond));
15398
15399    numpy::NDArray<numpy::bool_> mask(std::vector<size_t>{2});
15400    mask.setElementAt({0}, numpy::bool_(false));
15401    mask.setElementAt({1}, numpy::bool_(false));
15402
15403    pandas::DatetimeArray arr(data, mask);
15404    pandas::DatetimeIndexBase idx(arr, "original");
15405
15406    // Create join result (int64 values)
15407    numpy::NDArray<numpy::int64> join_result(std::vector<size_t>{3});
15408    join_result.setElementAt({0}, numpy::int64(500LL));
15409    join_result.setElementAt({1}, numpy::int64(600LL));
15410    join_result.setElementAt({2}, numpy::int64(700LL));
15411
15412    auto new_idx = idx._from_join_target(join_result);
15413
15414    bool passed = (new_idx.size() == 3 &&
15415                   new_idx.name().has_value() && *new_idx.name() == "original");
15416    if (!passed) {
round_ns_1000 (pd_test_3_all.cpp:25505)
25495        throw std::runtime_error("classify_value_dtype failed: int32");
25496    if (pandas::classify_value_dtype("Int64[pyarrow]").kind != pandas::ValueKind::IntNullable)
25497        throw std::runtime_error("classify_value_dtype failed: Int64[pyarrow]");
25498    if (pandas::classify_value_dtype("float64").kind != pandas::ValueKind::Float)
25499        throw std::runtime_error("classify_value_dtype failed: float64");
25500
25501    std::cout << " -> tests passed" << std::endl;
25502}
25503
25504void pd_test_value_classify_round_ns() {
25505    std::cout << "========= round_ns_1000() ==============================";
25506    int64_t r = pandas::round_ns_1000(1500000000123456789.0);
25507    if (r % 1000 != 0)
25508        throw std::runtime_error("round_ns_1000 failed: not 1000-aligned");
25509    if (pandas::round_ns_1000(0.0) != 0)
25510        throw std::runtime_error("round_ns_1000 failed: zero");
25511    std::cout << " -> tests passed" << std::endl;
25512}
25513
25514void pd_test_value_classify_whole_numbers() {
25515    std::cout << "========= all_whole_numbers() ==========================";
route_extension_dtype (pd_test_5_all.cpp:40863)
40853namespace f_test_08a_router_9_ns {
40854
40855static void expect_route(const std::string& dtype_label,
40856                         const std::string& expected_storage,
40857                         const std::string& expected_override,
40858                         bool expected_needs_mask,
40859                         bool expected_is_index_backed,
40860                         const std::string& case_label,
40861                         int& local_fail) {
40862    pandas::ExtensionDtypeRouteResult got =
40863        pandas::route_extension_dtype(dtype_label);
40864
40865    pandas_tests::check(got.storage_dtype == expected_storage,
40866          case_label + ".storage_dtype", local_fail);
40867    pandas_tests::check(got.override_label == expected_override,
40868          case_label + ".override_label", local_fail);
40869    pandas_tests::check(got.needs_mask == expected_needs_mask,
40870          case_label + ".needs_mask", local_fail);
40871    pandas_tests::check(got.is_index_backed == expected_is_index_backed,
40872          case_label + ".is_index_backed", local_fail);
40873}
s (pd_test_1_all.cpp:4524)
4514#include <vector>
4515#include "../pandas/pd_dataframe.h"
4516#include "../pandas/pd_series.h"
4517
4518namespace dataframe_tests {
4519    namespace dataframe_tests_aggregation {
4520
4521        void pd_test_aggregation_series_sem() {
4522            std::cout << "========= Series sem ============================";
4523
4524            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
4525            auto sem_val = s.sem();
4526            // std(ddof=1) = sqrt(2.5), sem = sqrt(2.5)/sqrt(5) ≈ 0.707
4527            bool passed = sem_val.has_value() && std::abs(*sem_val - 0.707) < 0.01;
4528            if (!passed) {
4529                std::cout << "  [FAIL] : in pd_test_aggregation_series_sem() : sem value incorrect" << std::endl;
4530                throw std::runtime_error("pd_test_aggregation_series_sem failed: sem value incorrect");
4531            }
4532
4533            std::cout << " -> tests passed" << std::endl;
4534        }
s (pd_test_1_all.cpp:4524)
4514#include <vector>
4515#include "../pandas/pd_dataframe.h"
4516#include "../pandas/pd_series.h"
4517
4518namespace dataframe_tests {
4519    namespace dataframe_tests_aggregation {
4520
4521        void pd_test_aggregation_series_sem() {
4522            std::cout << "========= Series sem ============================";
4523
4524            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
4525            auto sem_val = s.sem();
4526            // std(ddof=1) = sqrt(2.5), sem = sqrt(2.5)/sqrt(5) ≈ 0.707
4527            bool passed = sem_val.has_value() && std::abs(*sem_val - 0.707) < 0.01;
4528            if (!passed) {
4529                std::cout << "  [FAIL] : in pd_test_aggregation_series_sem() : sem value incorrect" << std::endl;
4530                throw std::runtime_error("pd_test_aggregation_series_sem failed: sem value incorrect");
4531            }
4532
4533            std::cout << " -> tests passed" << std::endl;
4534        }
s (pd_test_1_all.cpp:4524)
4514#include <vector>
4515#include "../pandas/pd_dataframe.h"
4516#include "../pandas/pd_series.h"
4517
4518namespace dataframe_tests {
4519    namespace dataframe_tests_aggregation {
4520
4521        void pd_test_aggregation_series_sem() {
4522            std::cout << "========= Series sem ============================";
4523
4524            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
4525            auto sem_val = s.sem();
4526            // std(ddof=1) = sqrt(2.5), sem = sqrt(2.5)/sqrt(5) ≈ 0.707
4527            bool passed = sem_val.has_value() && std::abs(*sem_val - 0.707) < 0.01;
4528            if (!passed) {
4529                std::cout << "  [FAIL] : in pd_test_aggregation_series_sem() : sem value incorrect" << std::endl;
4530                throw std::runtime_error("pd_test_aggregation_series_sem failed: sem value incorrect");
4531            }
4532
4533            std::cout << " -> tests passed" << std::endl;
4534        }
s (pd_test_1_all.cpp:4524)
4514#include <vector>
4515#include "../pandas/pd_dataframe.h"
4516#include "../pandas/pd_series.h"
4517
4518namespace dataframe_tests {
4519    namespace dataframe_tests_aggregation {
4520
4521        void pd_test_aggregation_series_sem() {
4522            std::cout << "========= Series sem ============================";
4523
4524            pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
4525            auto sem_val = s.sem();
4526            // std(ddof=1) = sqrt(2.5), sem = sqrt(2.5)/sqrt(5) ≈ 0.707
4527            bool passed = sem_val.has_value() && std::abs(*sem_val - 0.707) < 0.01;
4528            if (!passed) {
4529                std::cout << "  [FAIL] : in pd_test_aggregation_series_sem() : sem value incorrect" << std::endl;
4530                throw std::runtime_error("pd_test_aggregation_series_sem failed: sem value incorrect");
4531            }
4532
4533            std::cout << " -> tests passed" << std::endl;
4534        }
select_by_first_level (pd_test_3_all.cpp:26354)
26344void pd_test_multiindex_partial_key_2level() {
26345    std::cout << "  Testing select_by_first_level 2-level 'foo'..." << std::endl;
26346    std::vector<std::vector<std::string>> arrays = {
26347        {"foo", "foo", "bar", "bar"},
26348        {"one", "two", "one", "two"}
26349    };
26350    std::vector<std::optional<std::string>> names = {"first", "second"};
26351    auto mi = ::pandas::MultiIndex::from_arrays<std::string>(arrays, names);
26352
26353    auto pk = ::pandas::select_by_first_level(mi,"foo");
26354    if (pk.matched_indices.size() != 2) throw std::runtime_error("Expected 2 matches for 'foo'");
26355    if (pk.matched_indices[0] != 0 || pk.matched_indices[1] != 1) throw std::runtime_error("Wrong indices for 'foo'");
26356    if (!pk.is_single_level()) throw std::runtime_error("Expected single level for 2-level MI");
26357    auto idx = *pk.single_index;
26358    if (idx.size() != 2) throw std::runtime_error("Expected index size 2");
26359    if (idx[0] != "one" || idx[1] != "two") throw std::runtime_error("Wrong index values");
26360    if (!idx.name().has_value() || *idx.name() != "second") throw std::runtime_error("Wrong index name");
26361    std::cout << "    PASSED" << std::endl;
26362}
series_from_coo (pd_test_3_all.cpp:25930)
25920#include "../pandas/pd_sparse_accessor.h"
25921
25922void pd_test_sparse_coo_non_dense() {
25923    std::cout << "========= sparse_coo non-dense ========================" << std::endl;
25924    // 3 entries: (0,1)=1.0, (1,2)=2.0, (2,0)=3.0 in a 3x3 matrix
25925    std::vector<double> data = {1.0, 2.0, 3.0};
25926    std::vector<int64_t> rows = {0, 1, 2};
25927    std::vector<int64_t> cols = {1, 2, 0};
25928
25929    auto s = ::pandas::series_from_coo(data, rows, cols, 3, 3, false);
25930    if (s.size() != 3) throw std::runtime_error("Expected 3 entries, got " + std::to_string(s.size()));
25931
25932    // Verify sorted by (row, col): (0,1)=1.0, (1,2)=2.0, (2,0)=3.0
25933    // Already sorted in this case
25934    if (std::abs(static_cast<double>(s.iat(0)) - 1.0) > 1e-10) throw std::runtime_error("Wrong value at 0");
25935    if (std::abs(static_cast<double>(s.iat(1)) - 2.0) > 1e-10) throw std::runtime_error("Wrong value at 1");
25936    if (std::abs(static_cast<double>(s.iat(2)) - 3.0) > 1e-10) throw std::runtime_error("Wrong value at 2");
25937
25938    // Verify has MultiIndex
25939    if (!s.has_multiindex()) throw std::runtime_error("Expected MultiIndex");
series_to_optional_string_vector (pd_test_3_all.cpp:25845)
25835    return dataframe_tests_series_format_helpers::pd_test_series_format_helpers_main();
25836}
25837// ------------------- pd_test_series_format_helpers (end) -----------------------
25838
25839// ------------------- pd_test_cat_constructor_helpers (start) -------------------
25840namespace dataframe_tests_cat_constructor_helpers {
25841
25842void pd_test_cat_constructor_helpers_basic() {
25843    std::cout << "========= cat_constructor_helpers basic =================" << std::endl;
25844    ::pandas::Series<std::string> s(std::vector<std::string>{"a", "b", "c"});
25845    auto result = ::pandas::series_to_optional_string_vector(s);
25846    if (result.size() != 3) throw std::runtime_error("Expected size 3, got " + std::to_string(result.size()));
25847    for (size_t i = 0; i < 3; ++i) {
25848        if (!result[i].has_value()) throw std::runtime_error("Expected value at index " + std::to_string(i));
25849    }
25850    if (result[0].value() != "a") throw std::runtime_error("Expected 'a' at index 0");
25851    if (result[1].value() != "b") throw std::runtime_error("Expected 'b' at index 1");
25852    if (result[2].value() != "c") throw std::runtime_error("Expected 'c' at index 2");
25853    std::cout << "  PASSED" << std::endl;
25854}
set_column_resolved (pd_test_5_all.cpp:94241)
94231    pandas::DtypeOverride ov = pandas::DtypeOverride::parse("Float64");
94232    auto df = pandas::from_records_resolved<pandas::DataFrame>(rows, cols, ov);
94233    pandas_tests::check(df.column_dtype_override("n") == "Float64",
94234        "C_26h_case_144_records_override_applies()_dtype", local_fail);
94235}
94236
94237void case_150_create_new_column(int& local_fail) {
94238    std::cout << "-- case_150_create_new_column\n";
94239    pandas::DataFrame df;
94240    KVec col = { kv_int(1), kv_int(2) };
94241    df.set_column_resolved("n", col);
94242    pandas_tests::check(df.has_column("n"),
94243        "C_26h_case_150_create_new_column()_has", local_fail);
94244    pandas_tests::check(df.column_dtype_override("n") == "int64",
94245        "C_26h_case_150_create_new_column()_dtype", local_fail);
94246}
94247
94248void case_151_replace_existing_int_to_float(int& local_fail) {
94249    std::cout << "-- case_151_replace_existing_int_to_float\n";
94250    pandas::DataFrame df;
94251    df.add_column<std::int64_t>("v", { 1, 2, 3 });
set_eng_float_format (pd_test_3_all.cpp:13870)
13860    }
13861
13862    std::cout << " -> tests passed" << std::endl;
13863}
13864
13865// ============================================================================
13866// Set Eng Float Format Test
13867// ============================================================================
13868
13869void pd_test_top_level_set_eng_float_format() {
13870    std::cout << "========= set_eng_float_format() ======================";
13871
13872    // Test set_eng_float_format
13873    pandas::set_eng_float_format(4, true);
13874
13875    int64_t precision = pandas::get_option<int64_t>("display.precision");
13876    if (precision != 4) {
13877        std::cout << "  [FAIL] : in pd_test_top_level_set_eng_float_format() : precision not set" << std::endl;
13878        throw std::runtime_error("pd_test_top_level_set_eng_float_format failed: precision");
13879    }
set_max_cols (pd_test_1_all.cpp:970)
960        std::cout << "-> tests passed" << std::endl;
961    }
962
963    void pd_test_config_display_options() {
964        std::cout << "========= df_config: display options ======================= ";
965        pandas::DataFrameConfig::set_max_rows(100);
966        if (pandas::DataFrameConfig::get_max_rows() != 100) {
967            std::cout << "[FAIL] : in pd_test_config_display_options() : set_max_rows failed" << std::endl;
968            throw std::runtime_error("pd_test_config_display_options failed: set_max_rows failed");
969        }
970        pandas::DataFrameConfig::set_max_cols(50);
971        if (pandas::DataFrameConfig::get_max_cols() != 50) {
972            std::cout << "[FAIL] : in pd_test_config_display_options() : set_max_cols failed" << std::endl;
973            throw std::runtime_error("pd_test_config_display_options failed: set_max_cols failed");
974        }
975        std::cout << "-> tests passed" << std::endl;
976    }
977
978} // namespace dataframe_tests_config
979
980int pd_test_config_main() {
set_max_rows (pd_test_1_all.cpp:965)
955        pandas::DataFrameConfig::set_na_repr("<NA>");
956        if (std::string(pandas::DataFrameConfig::get_na_repr()) != "<NA>") {
957            std::cout << "[FAIL] : in pd_test_config_na_repr() : set_na_repr failed" << std::endl;
958            throw std::runtime_error("pd_test_config_na_repr failed: set_na_repr failed");
959        }
960        std::cout << "-> tests passed" << std::endl;
961    }
962
963    void pd_test_config_display_options() {
964        std::cout << "========= df_config: display options ======================= ";
965        pandas::DataFrameConfig::set_max_rows(100);
966        if (pandas::DataFrameConfig::get_max_rows() != 100) {
967            std::cout << "[FAIL] : in pd_test_config_display_options() : set_max_rows failed" << std::endl;
968            throw std::runtime_error("pd_test_config_display_options failed: set_max_rows failed");
969        }
970        pandas::DataFrameConfig::set_max_cols(50);
971        if (pandas::DataFrameConfig::get_max_cols() != 50) {
972            std::cout << "[FAIL] : in pd_test_config_display_options() : set_max_cols failed" << std::endl;
973            throw std::runtime_error("pd_test_config_display_options failed: set_max_cols failed");
974        }
975        std::cout << "-> tests passed" << std::endl;
set_multiindex_with_tuple_labels (pd_test_3_all.cpp:23338)
23328    std::cout << "========= set_multiindex_with_tuple_labels ============";
23329
23330    std::vector<std::vector<std::string>> arrays = {{"a", "a", "b"}, {"x", "y", "x"}};
23331    pandas::MultiIndex mi = pandas::MultiIndex::from_arrays<std::string>(arrays, {});
23332
23333    std::map<std::string, std::vector<double>> data = {
23334        {"col1", {1.0, 2.0, 3.0}}
23335    };
23336    pandas::DataFrame df(data);
23337
23338    pandas::construct_helpers::set_multiindex_with_tuple_labels(df, std::move(mi));
23339
23340    // Verify index has tab-separated labels
23341    const auto& idx = df.index();
23342    std::string lbl0 = idx.get_value_str(0);
23343    std::string lbl1 = idx.get_value_str(1);
23344    std::string lbl2 = idx.get_value_str(2);
23345    if (lbl0 != "a\tx") throw std::runtime_error("wrong label 0: " + lbl0);
23346    if (lbl1 != "a\ty") throw std::runtime_error("wrong label 1: " + lbl1);
23347    if (lbl2 != "b\tx") throw std::runtime_error("wrong label 2: " + lbl2);
set_na_repr (pd_test_1_all.cpp:955)
945        std::cout << "-> tests passed" << std::endl;
946    }
947
948    void pd_test_config_na_repr() {
949        std::cout << "========= df_config: NA representation ======================= ";
950        const char* na_repr = pandas::DataFrameConfig::get_na_repr();
951        if (na_repr == nullptr) {
952            std::cout << "[FAIL] : in pd_test_config_na_repr() : na_repr is null" << std::endl;
953            throw std::runtime_error("pd_test_config_na_repr failed: na_repr is null");
954        }
955        pandas::DataFrameConfig::set_na_repr("<NA>");
956        if (std::string(pandas::DataFrameConfig::get_na_repr()) != "<NA>") {
957            std::cout << "[FAIL] : in pd_test_config_na_repr() : set_na_repr failed" << std::endl;
958            throw std::runtime_error("pd_test_config_na_repr failed: set_na_repr failed");
959        }
960        std::cout << "-> tests passed" << std::endl;
961    }
962
963    void pd_test_config_display_options() {
964        std::cout << "========= df_config: display options ======================= ";
965        pandas::DataFrameConfig::set_max_rows(100);
set_option (pd_test_3_all.cpp:10876)
10866    df.set_multiindex(mi);
10867    auto result = df.reorder_levels({"second", "first"});
10868    if (result.nrows() != 4) {
10869        std::cout << "  [FAIL] : in pd_test_3_all_reorder_levels_initlist() : wrong nrows" << std::endl;
10870        throw std::runtime_error("pd_test_3_all_reorder_levels_initlist failed");
10871    }
10872    std::cout << " -> tests passed" << std::endl;
10873}
10874
10875void pd_test_3_all_set_option_instance() {
10876    std::cout << "========= DataFrame.set_option() instance ==============";
10877    pandas::DataFrame df;
10878    df.add_column<int64_t>("A", {1, 2, 3});
10879    df.set_option("display.multi_sparse", false);
10880    df.set_option("display.unknown_key", true);  // should not throw
10881    std::cout << " -> tests passed" << std::endl;
10882}
10883
10884// ============================================================================
10885// Category 48: Indexing Fixes (Plan: plan_indexing_fixes)
10886// ============================================================================
set_option (pd_test_3_all.cpp:10876)
10866    df.set_multiindex(mi);
10867    auto result = df.reorder_levels({"second", "first"});
10868    if (result.nrows() != 4) {
10869        std::cout << "  [FAIL] : in pd_test_3_all_reorder_levels_initlist() : wrong nrows" << std::endl;
10870        throw std::runtime_error("pd_test_3_all_reorder_levels_initlist failed");
10871    }
10872    std::cout << " -> tests passed" << std::endl;
10873}
10874
10875void pd_test_3_all_set_option_instance() {
10876    std::cout << "========= DataFrame.set_option() instance ==============";
10877    pandas::DataFrame df;
10878    df.add_column<int64_t>("A", {1, 2, 3});
10879    df.set_option("display.multi_sparse", false);
10880    df.set_option("display.unknown_key", true);  // should not throw
10881    std::cout << " -> tests passed" << std::endl;
10882}
10883
10884// ============================================================================
10885// Category 48: Indexing Fixes (Plan: plan_indexing_fixes)
10886// ============================================================================
set_option (pd_test_3_all.cpp:10876)
10866    df.set_multiindex(mi);
10867    auto result = df.reorder_levels({"second", "first"});
10868    if (result.nrows() != 4) {
10869        std::cout << "  [FAIL] : in pd_test_3_all_reorder_levels_initlist() : wrong nrows" << std::endl;
10870        throw std::runtime_error("pd_test_3_all_reorder_levels_initlist failed");
10871    }
10872    std::cout << " -> tests passed" << std::endl;
10873}
10874
10875void pd_test_3_all_set_option_instance() {
10876    std::cout << "========= DataFrame.set_option() instance ==============";
10877    pandas::DataFrame df;
10878    df.add_column<int64_t>("A", {1, 2, 3});
10879    df.set_option("display.multi_sparse", false);
10880    df.set_option("display.unknown_key", true);  // should not throw
10881    std::cout << " -> tests passed" << std::endl;
10882}
10883
10884// ============================================================================
10885// Category 48: Indexing Fixes (Plan: plan_indexing_fixes)
10886// ============================================================================
set_option (pd_test_3_all.cpp:10876)
10866    df.set_multiindex(mi);
10867    auto result = df.reorder_levels({"second", "first"});
10868    if (result.nrows() != 4) {
10869        std::cout << "  [FAIL] : in pd_test_3_all_reorder_levels_initlist() : wrong nrows" << std::endl;
10870        throw std::runtime_error("pd_test_3_all_reorder_levels_initlist failed");
10871    }
10872    std::cout << " -> tests passed" << std::endl;
10873}
10874
10875void pd_test_3_all_set_option_instance() {
10876    std::cout << "========= DataFrame.set_option() instance ==============";
10877    pandas::DataFrame df;
10878    df.add_column<int64_t>("A", {1, 2, 3});
10879    df.set_option("display.multi_sparse", false);
10880    df.set_option("display.unknown_key", true);  // should not throw
10881    std::cout << " -> tests passed" << std::endl;
10882}
10883
10884// ============================================================================
10885// Category 48: Indexing Fixes (Plan: plan_indexing_fixes)
10886// ============================================================================
setup_time_rolling (pd_test_3_all.cpp:24692)
24682    std::vector<numpy::datetime64> dates = {
24683        numpy::datetime64("2023-01-01"),
24684        numpy::datetime64("2023-01-02"),
24685        numpy::datetime64("2023-01-03"),
24686        numpy::datetime64("2023-01-04"),
24687        numpy::datetime64("2023-01-05")
24688    };
24689    auto dti = std::make_unique<pandas::DatetimeIndex>(dates);
24690    pandas::Series<double> s({1.0, 2.0, 3.0, 4.0, 5.0});
24691    s.set_index(std::move(dti));
24692    auto rolling = pandas::setup_time_rolling(s, "3D", "right", 1);
24693    if (!rolling.is_time_based())
24694        throw std::runtime_error("expected time-based rolling");
24695    std::cout << " -> tests passed" << std::endl;
24696}
24697
24698void pd_test_rolling_time_no_dti() {
24699    std::cout << "========= setup_time_rolling no DTI =================";
24700    // Series without DatetimeIndex should throw
24701    pandas::Series<double> s({1.0, 2.0, 3.0});
24702    bool threw = false;
show_versions (pd_test_3_all.cpp:13805)
13795    }
13796
13797    std::cout << " -> tests passed" << std::endl;
13798}
13799
13800// ============================================================================
13801// Show Versions Test
13802// ============================================================================
13803
13804void pd_test_top_level_show_versions() {
13805    std::cout << "========= show_versions() =============================";
13806
13807    std::string versions = pandas::show_versions();
13808
13809    if (versions.empty()) {
13810        std::cout << "  [FAIL] : in pd_test_top_level_show_versions() : empty output" << std::endl;
13811        throw std::runtime_error("pd_test_top_level_show_versions failed: empty");
13812    }
13813
13814    if (versions.find("pandas-cpp") == std::string::npos) {
13815        std::cout << "  [FAIL] : in pd_test_top_level_show_versions() : missing pandas-cpp" << std::endl;
slice_by_ns_range (pd_test_3_all.cpp:25269)
25259    return s;
25260}
25261
25262void pd_test_datetime_range_slice_basic() {
25263    std::cout << "========= slice_by_ns_range basic =======================";
25264    auto s = make_hourly_series(48);
25265    const auto* dti = dynamic_cast<const pandas::DatetimeIndex*>(&s.index());
25266    // Slice to first day: 2013-01-01 00:00 .. 2013-01-01 23:59:59.999999999
25267    int64_t start_ns = pandas::datetime_utils::resolve_string_endpoint_ns("2013-01-01", "left");
25268    int64_t end_ns   = pandas::datetime_utils::resolve_string_endpoint_ns("2013-01-01", "right");
25269    auto result = pandas::datetime_utils::slice_by_ns_range(s, *dti, start_ns, end_ns);
25270    if (result.size() != 24) {
25271        std::cout << "  [FAIL] : expected 24 entries, got " << result.size() << std::endl;
25272        throw std::runtime_error("slice_by_ns_range basic failed");
25273    }
25274    std::cout << " -> tests passed" << std::endl;
25275}
25276
25277void pd_test_datetime_range_slice_empty() {
25278    std::cout << "========= slice_by_ns_range empty =======================";
25279    auto s = make_hourly_series(48);
sparsify_labels (pd_test_3_all.cpp:25706)
25696    }
25697    std::cout << " -> tests passed" << std::endl;
25698}
25699
25700void pd_test_display_formats_sparsify() {
25701    std::cout << "========= display::sparsify_labels =====================";
25702    std::vector<std::vector<std::string>> levels = {
25703        {"A", "A", "B"},
25704        {"x", "y", "x"}
25705    };
25706    auto result = ::pandas::display::sparsify_labels(levels);
25707    if (result[0][0] != "A" || result[0][1] != "" || result[0][2] != "B") {
25708        throw std::runtime_error("sparsify outer level failed");
25709    }
25710    if (result[1][0] != "x" || result[1][1] != "y" || result[1][2] != "x") {
25711        throw std::runtime_error("sparsify inner level failed");
25712    }
25713    std::cout << " -> tests passed" << std::endl;
25714}
25715
25716void pd_test_display_formats_sparsify_single() {
ss (pd_test_3_all.cpp:27670)
27660            fail++;
27661        } else {
27662            auto cats = str_s->get_cat_categories();
27663            if (cats.size() != 3) {
27664                std::cout << "    FAIL: expected 3 categories, got " << cats.size() << std::endl;
27665                fail++;
27666            }
27667        }
27668    }
27669
27670    pandas::Series<std::string> ss({"a", "b", "a", "c"}, "strs");
27671    auto result2 = ss.astype("category");
27672    auto* str_s2 = dynamic_cast<pandas::Series<std::string>*>(result2.get());
27673    if (!str_s2) {
27674        std::cout << "    FAIL: expected Series<string> for string->category" << std::endl;
27675        fail++;
27676    } else {
27677        if (str_s2->dtype_name() != "category") {
27678            std::cout << "    FAIL: dtype should be category" << std::endl;
27679            fail++;
27680        }
ss (pd_test_3_all.cpp:27670)
27660            fail++;
27661        } else {
27662            auto cats = str_s->get_cat_categories();
27663            if (cats.size() != 3) {
27664                std::cout << "    FAIL: expected 3 categories, got " << cats.size() << std::endl;
27665                fail++;
27666            }
27667        }
27668    }
27669
27670    pandas::Series<std::string> ss({"a", "b", "a", "c"}, "strs");
27671    auto result2 = ss.astype("category");
27672    auto* str_s2 = dynamic_cast<pandas::Series<std::string>*>(result2.get());
27673    if (!str_s2) {
27674        std::cout << "    FAIL: expected Series<string> for string->category" << std::endl;
27675        fail++;
27676    } else {
27677        if (str_s2->dtype_name() != "category") {
27678            std::cout << "    FAIL: dtype should be category" << std::endl;
27679            fail++;
27680        }
ss (pd_test_3_all.cpp:27670)
27660            fail++;
27661        } else {
27662            auto cats = str_s->get_cat_categories();
27663            if (cats.size() != 3) {
27664                std::cout << "    FAIL: expected 3 categories, got " << cats.size() << std::endl;
27665                fail++;
27666            }
27667        }
27668    }
27669
27670    pandas::Series<std::string> ss({"a", "b", "a", "c"}, "strs");
27671    auto result2 = ss.astype("category");
27672    auto* str_s2 = dynamic_cast<pandas::Series<std::string>*>(result2.get());
27673    if (!str_s2) {
27674        std::cout << "    FAIL: expected Series<string> for string->category" << std::endl;
27675        fail++;
27676    } else {
27677        if (str_s2->dtype_name() != "category") {
27678            std::cout << "    FAIL: dtype should be category" << std::endl;
27679            fail++;
27680        }
ss (pd_test_3_all.cpp:27670)
27660            fail++;
27661        } else {
27662            auto cats = str_s->get_cat_categories();
27663            if (cats.size() != 3) {
27664                std::cout << "    FAIL: expected 3 categories, got " << cats.size() << std::endl;
27665                fail++;
27666            }
27667        }
27668    }
27669
27670    pandas::Series<std::string> ss({"a", "b", "a", "c"}, "strs");
27671    auto result2 = ss.astype("category");
27672    auto* str_s2 = dynamic_cast<pandas::Series<std::string>*>(result2.get());
27673    if (!str_s2) {
27674        std::cout << "    FAIL: expected Series<string> for string->category" << std::endl;
27675        fail++;
27676    } else {
27677        if (str_s2->dtype_name() != "category") {
27678            std::cout << "    FAIL: dtype should be category" << std::endl;
27679            fail++;
27680        }
ss (pd_test_3_all.cpp:27670)
27660            fail++;
27661        } else {
27662            auto cats = str_s->get_cat_categories();
27663            if (cats.size() != 3) {
27664                std::cout << "    FAIL: expected 3 categories, got " << cats.size() << std::endl;
27665                fail++;
27666            }
27667        }
27668    }
27669
27670    pandas::Series<std::string> ss({"a", "b", "a", "c"}, "strs");
27671    auto result2 = ss.astype("category");
27672    auto* str_s2 = dynamic_cast<pandas::Series<std::string>*>(result2.get());
27673    if (!str_s2) {
27674        std::cout << "    FAIL: expected Series<string> for string->category" << std::endl;
27675        fail++;
27676    } else {
27677        if (str_s2->dtype_name() != "category") {
27678            std::cout << "    FAIL: dtype should be category" << std::endl;
27679            fail++;
27680        }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
static_assert (pd_test_3_all.cpp:1503)
1493    }
1494
1495    std::cout << " -> tests passed" << std::endl;
1496}
1497
1498void pd_test_3_all_pandas_numpy_type_aliases() {
1499    std::cout << "========= pandas:: aliases for numpy time types =====";
1500
1501    // Case A: pandas::Timestamp == pandas::Timestamp (same type)
1502    {
1503        static_assert(std::is_same_v<pandas::Timestamp, pandas::Timestamp>,
1504                      "pandas::Timestamp must alias pandas::Timestamp");
1505        pandas::Timestamp ts1("2021-01-01");
1506        pandas::Timestamp  ts2("2021-01-01");
1507        // Stronger than toString()-comparison: pandas::Timestamp::operator==
1508        // compares the underlying nanosecond value directly, catching
1509        // representation drift that string formatting could mask.
1510        if (!(ts1 == ts2)) {
1511            throw std::runtime_error("alias Timestamp: ctor value mismatch");
1512        }
1513    }
store (pd_test_3_all.cpp:19223)
19213#include <cstdio>
19214
19215namespace dataframe_tests {
19216namespace dataframe_tests_hdf5_real {
19217
19218void test_write_read_1d() {
19219    std::string path = "test_hdf5_real.h5";
19220
19221    // Write
19222    {
19223        pandas::HDF5Store store(path, "w");
19224        std::vector<double> data = {1.0, 2.0, 3.0, 4.0, 5.0};
19225        store.write_dataset("my_data", data);
19226    }
19227
19228    // Read
19229    {
19230        pandas::HDF5Store store(path, "r");
19231        auto result = store.read_dataset<double>("my_data");
19232        if (result.size() != 5)
19233            throw std::runtime_error("test_write_read_1d: size mismatch");
store (pd_test_3_all.cpp:19223)
19213#include <cstdio>
19214
19215namespace dataframe_tests {
19216namespace dataframe_tests_hdf5_real {
19217
19218void test_write_read_1d() {
19219    std::string path = "test_hdf5_real.h5";
19220
19221    // Write
19222    {
19223        pandas::HDF5Store store(path, "w");
19224        std::vector<double> data = {1.0, 2.0, 3.0, 4.0, 5.0};
19225        store.write_dataset("my_data", data);
19226    }
19227
19228    // Read
19229    {
19230        pandas::HDF5Store store(path, "r");
19231        auto result = store.read_dataset<double>("my_data");
19232        if (result.size() != 5)
19233            throw std::runtime_error("test_write_read_1d: size mismatch");
style (pd_test_2_all.cpp:9128)
9118        std::cout << "====================================== [OK] pd_test_reorder_levels test suite ========================== " << std::endl;
9119        return 0;
9120    }
9121
9122} // namespace dataframe_tests
9123// ------------------- pd_test_reorder_levels.cpp (end) -----------------------------
9124
9125// ------------------- pd_test_styler.cpp (start) -----------------------------
9126// dataframe_tests/pd_test_styler.cpp
9127// Test suite for DataFrame.style() and Styler class functionality
9128
9129#include <iostream>
9130#include <sstream>
9131#include <string>
9132#include <vector>
9133#include <map>
9134#include "../pandas/pd_dataframe.h"
9135
9136// CRITICAL: No using namespace directives
td (pd_test_1_all.cpp:9535)
9525    }
9526
9527    std::cout << " -> tests passed" << std::endl;
9528}
9529
9530void pd_test_timedelta_rounding_params() {
9531    std::cout << "========= Timedelta rounding with DST params =====";
9532
9533    // Create a Timedelta: 1h 30m 45s
9534    // Constructor is: (days, hours, minutes, seconds, ...)
9535    pandas::Timedelta td(0, 1, 30, 45);  // 0 days, 1h, 30m, 45s
9536
9537    // Test floor with ambiguous/nonexistent params
9538    pandas::Timedelta floored = td.floor("h", "raise", "raise");
9539    std::cout << std::endl << "  floor('h'): " << floored.toString();
9540
9541    // Test ceil with ambiguous/nonexistent params
9542    pandas::Timedelta ceiled = td.ceil("h", "raise", "raise");
9543    std::cout << std::endl << "  ceil('h'): " << ceiled.toString();
9544
9545    // Test round with ambiguous/nonexistent params
td (pd_test_1_all.cpp:9535)
9525    }
9526
9527    std::cout << " -> tests passed" << std::endl;
9528}
9529
9530void pd_test_timedelta_rounding_params() {
9531    std::cout << "========= Timedelta rounding with DST params =====";
9532
9533    // Create a Timedelta: 1h 30m 45s
9534    // Constructor is: (days, hours, minutes, seconds, ...)
9535    pandas::Timedelta td(0, 1, 30, 45);  // 0 days, 1h, 30m, 45s
9536
9537    // Test floor with ambiguous/nonexistent params
9538    pandas::Timedelta floored = td.floor("h", "raise", "raise");
9539    std::cout << std::endl << "  floor('h'): " << floored.toString();
9540
9541    // Test ceil with ambiguous/nonexistent params
9542    pandas::Timedelta ceiled = td.ceil("h", "raise", "raise");
9543    std::cout << std::endl << "  ceil('h'): " << ceiled.toString();
9544
9545    // Test round with ambiguous/nonexistent params
time_unit_factor (pd_test_3_all.cpp:22752)
22742    return dataframe_tests_concat_axis0_dtype_preserve::pd_test_concat_axis0_dtype_preserve_main();
22743}
22744// ------------------- pd_test_concat_axis0_dtype_preserve.cpp (end) ---------------------------
22745
22746// ------------------- pd_test_df_construct_time_dtype (start) ---------------------------
22747namespace dataframe_tests_df_construct_time_dtype {
22748
22749void test_time_unit_factor() {
22750    std::cout << "  test_time_unit_factor" << std::endl;
22751
22752    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Nanosecond) != 1LL)
22753        throw std::runtime_error("test_time_unit_factor: Nanosecond factor wrong");
22754    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Microsecond) != 1000LL)
22755        throw std::runtime_error("test_time_unit_factor: Microsecond factor wrong");
22756    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Millisecond) != 1000000LL)
22757        throw std::runtime_error("test_time_unit_factor: Millisecond factor wrong");
22758    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Second) != 1000000000LL)
22759        throw std::runtime_error("test_time_unit_factor: Second factor wrong");
22760    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Minute) != 60000000000LL)
22761        throw std::runtime_error("test_time_unit_factor: Minute factor wrong");
22762    if (pandas::construct_helpers::time_unit_factor(numpy::DateTimeUnit::Hour) != 3600000000000LL)
timedelta64_to_ns (pd_test_3_all.cpp:22799)
22789        throw std::runtime_error("test_datetime64_to_ns: 2 ns should be 2 ns, got " + std::to_string(ns_ns));
22790
22791    std::cout << "    -> test passed" << std::endl;
22792}
22793
22794void test_timedelta64_to_ns() {
22795    std::cout << "  test_timedelta64_to_ns" << std::endl;
22796
22797    // 3 milliseconds = 3000000 nanoseconds
22798    numpy::timedelta64 td_ms(3, numpy::DateTimeUnit::Millisecond);
22799    int64_t ns_ms = pandas::construct_helpers::timedelta64_to_ns(td_ms);
22800    if (ns_ms != 3000000LL)
22801        throw std::runtime_error("test_timedelta64_to_ns: 3 ms should be 3000000 ns, got " + std::to_string(ns_ms));
22802
22803    // 2 hours = 7200000000000 nanoseconds
22804    numpy::timedelta64 td_h(2, numpy::DateTimeUnit::Hour);
22805    int64_t ns_h = pandas::construct_helpers::timedelta64_to_ns(td_h);
22806    if (ns_h != 7200000000000LL)
22807        throw std::runtime_error("test_timedelta64_to_ns: 2 h should be 7200000000000 ns, got " + std::to_string(ns_h));
22808
22809    std::cout << "    -> test passed" << std::endl;
timedelta_range (pd_test_1_all.cpp:20049)
20039    }
20040
20041    std::cout << " -> tests passed" << std::endl;
20042}
20043
20044// ============================================================================
20045// Factory Function Tests
20046// ============================================================================
20047
20048void pd_test_timedelta_index_timedelta_range_start_end() {
20049    std::cout << "========= timedelta_range (start, end) ================";
20050
20051    auto idx = pandas::timedelta_range("0 days", "9 days");
20052
20053    bool passed = (idx.size() == 10);
20054    if (!passed) {
20055        std::cout << "  [FAIL] : expected 10 elements, got " << idx.size() << std::endl;
20056        throw std::runtime_error("pd_test_timedelta_index_timedelta_range_start_end failed");
20057    }
20058
20059    std::cout << " -> tests passed" << std::endl;
trim (pd_test_5_all.cpp:58873)
58863    auto trim = [](const std::string& s) {
58864        size_t a = s.find_first_not_of(" \t");
58865        size_t b = s.find_last_not_of(" \t\r");
58866        if (a == std::string::npos) return std::string();
58867        return s.substr(a, b - a + 1);
58868    };
58869    size_t pos = 0;
58870    while (pos < body.size()) {
58871        size_t nl = body.find('\n', pos);
58872        std::string raw = body.substr(pos, nl == std::string::npos ? std::string::npos : nl - pos);
58873        std::string t = trim(raw);
58874        if (!t.empty()) {
58875            // tokenise by whitespace
58876            std::vector<std::string> toks;
58877            std::string cur;
58878            for (char c : t) {
58879                if (c == ' ' || c == '\t') {
58880                    if (!cur.empty()) { toks.push_back(cur); cur.clear(); }
58881                } else {
58882                    cur.push_back(c);
58883                }
ts (pd_test_2_all.cpp:22590)
22580void test_to_datetime_numeric_seconds() {
22581    std::cout << "  -- test_to_datetime_numeric_seconds --" << std::endl;
22582    // 1490195805 seconds = 2017-03-22 15:16:45 UTC
22583    std::vector<double> vals = {1490195805.0};
22584    auto arr = pandas::to_datetime_numeric(vals, "s");
22585    check(arr.size() == 1, "size==1");
22586    auto v = arr[0];
22587    check(v.has_value(), "has_value");
22588    if (v.has_value()) {
22589        pandas::Timestamp ts(v->getValue());
22590        check(ts.year() == 2017, "year==2017");
22591        check(ts.month() == 3, "month==3");
22592        check(ts.day() == 22, "day==22");
22593        check(ts.hour() == 15, "hour==15");
22594        check(ts.minute() == 16, "min==16");
22595        check(ts.second() == 45, "sec==45");
22596    }
22597}
22598
22599void test_to_datetime_numeric_millis() {
ts (pd_test_2_all.cpp:22590)
22580void test_to_datetime_numeric_seconds() {
22581    std::cout << "  -- test_to_datetime_numeric_seconds --" << std::endl;
22582    // 1490195805 seconds = 2017-03-22 15:16:45 UTC
22583    std::vector<double> vals = {1490195805.0};
22584    auto arr = pandas::to_datetime_numeric(vals, "s");
22585    check(arr.size() == 1, "size==1");
22586    auto v = arr[0];
22587    check(v.has_value(), "has_value");
22588    if (v.has_value()) {
22589        pandas::Timestamp ts(v->getValue());
22590        check(ts.year() == 2017, "year==2017");
22591        check(ts.month() == 3, "month==3");
22592        check(ts.day() == 22, "day==22");
22593        check(ts.hour() == 15, "hour==15");
22594        check(ts.minute() == 16, "min==16");
22595        check(ts.second() == 45, "sec==45");
22596    }
22597}
22598
22599void test_to_datetime_numeric_millis() {
ts (pd_test_2_all.cpp:22590)
22580void test_to_datetime_numeric_seconds() {
22581    std::cout << "  -- test_to_datetime_numeric_seconds --" << std::endl;
22582    // 1490195805 seconds = 2017-03-22 15:16:45 UTC
22583    std::vector<double> vals = {1490195805.0};
22584    auto arr = pandas::to_datetime_numeric(vals, "s");
22585    check(arr.size() == 1, "size==1");
22586    auto v = arr[0];
22587    check(v.has_value(), "has_value");
22588    if (v.has_value()) {
22589        pandas::Timestamp ts(v->getValue());
22590        check(ts.year() == 2017, "year==2017");
22591        check(ts.month() == 3, "month==3");
22592        check(ts.day() == 22, "day==22");
22593        check(ts.hour() == 15, "hour==15");
22594        check(ts.minute() == 16, "min==16");
22595        check(ts.second() == 45, "sec==45");
22596    }
22597}
22598
22599void test_to_datetime_numeric_millis() {
undefined_variable (pd_test_5_all.cpp:72243)
72233    check_eq_str(
72234        "case_3.cat6_dtype.cannot_cast",
72235        "Cannot cast float64 to int64",
72236        pandas::error_messages::cannot_cast("float64", "int64"),
72237        local_fail);
72238
72239    // Category 7: UndefinedVariableError (eval/query).
72240    check_eq_str(
72241        "case_3.cat7_UndefinedVariable.undefined_variable",
72242        "name 'x' is not defined",
72243        pandas::error_messages::undefined_variable("x"),
72244        local_fail);
72245
72246    // Category 8: UnsortedIndexError — MultiIndex lexsort.
72247    check_eq_str(
72248        "case_3.cat8_UnsortedIndex.unsorted_index",
72249        "Key length (3) was greater than MultiIndex lexsort depth",
72250        pandas::error_messages::unsorted_index("3"),
72251        local_fail);
72252}
undefined_variable_in_query (pd_test_5_all.cpp:73753)
73743    [[maybe_unused]] auto h4 = pandas::error_messages::cannot_cast("a", "b");
73744    ++helpers_seen;
73745    [[maybe_unused]] auto h5 = pandas::error_messages::undefined_variable("x");
73746    ++helpers_seen;
73747    [[maybe_unused]] auto h6 = pandas::error_messages::unsorted_index("3");
73748    ++helpers_seen;
73749    [[maybe_unused]] auto h7 =
73750        pandas::error_messages::unsorted_index_key_vs_depth(2, 0);
73751    ++helpers_seen;
73752    [[maybe_unused]] auto h8 =
73753        pandas::error_messages::undefined_variable_in_query("x");
73754    ++helpers_seen;
73755
73756    constexpr size_t kExpectedFixedLowerBound  = 2;
73757    constexpr size_t kExpectedHelperLowerBound = 8;
73758    constexpr size_t kPush3RegistryTotalLowerBound = 83;
73759
73760    pandas_tests::check(fixed_seen >= kExpectedFixedLowerBound,
73761                        "case_1.fixed_cardinality_at_least_lower_bound",
73762                        local_fail);
73763    pandas_tests::check(helpers_seen >= kExpectedHelperLowerBound,
unit_string_to_ns_multiplier (pd_test_5_all.cpp:51448)
51438    }
51439    std::cout << " -> tests passed" << std::endl;
51440}
51441
51442// --- f_test_marshal_na_smoke_9.cpp ---
51443
51444namespace f_test_marshal_na_smoke_9_ns {
51445
51446void case_1_unit_empty_default_ns(int& local_fail) {
51447    std::cout << "-- case_1_unit_empty_default_ns\n";
51448    int64_t m = pandas::unit_string_to_ns_multiplier("", pandas::UnitDefault::Nanoseconds);
51449    pandas_tests::check(m == 1, "case_1.empty_with_Nanoseconds_default_is_1", local_fail);
51450}
51451
51452void case_2_unit_empty_default_seconds(int& local_fail) {
51453    std::cout << "-- case_2_unit_empty_default_seconds\n";
51454    int64_t m = pandas::unit_string_to_ns_multiplier("", pandas::UnitDefault::Seconds);
51455    pandas_tests::check(m == 1000000000LL, "case_2.empty_with_Seconds_default_is_1e9", local_fail);
51456}
51457
51458void case_3_unit_ms(int& local_fail) {
unknown_interpolation_method (pd_test_5_all.cpp:75473)
75463    pandas_tests::check(is_pure_ascii(pandas::error_messages::kData2D),
75464                        "case_3.kData2D_ascii", local_fail);
75465    pandas_tests::check(is_pure_ascii(pandas::error_messages::kColumnLengthMismatch),
75466                        "case_3.kColumnLengthMismatch_ascii", local_fail);
75467    pandas_tests::check(is_pure_ascii(pandas::error_messages::kSampleWeightsLength),
75468                        "case_3.kSampleWeightsLength_ascii", local_fail);
75469    pandas_tests::check(
75470        is_pure_ascii(pandas::error_messages::length_mismatch_columns(3, 5)),
75471        "case_3.length_mismatch_columns_ascii", local_fail);
75472    pandas_tests::check(
75473        is_pure_ascii(pandas::error_messages::unknown_interpolation_method("foo")),
75474        "case_3.unknown_interpolation_method_ascii", local_fail);
75475}
75476
75477void case_4_no_trailing_whitespace(int& local_fail) {
75478    std::cout << "-- case_4_no_trailing_whitespace\n";
75479    pandas_tests::check(has_no_trailing_ws(pandas::error_messages::kQuantileQOutOfRange),
75480                        "case_4.kQuantileQOutOfRange_no_trail", local_fail);
75481    pandas_tests::check(has_no_trailing_ws(pandas::error_messages::kStepCannotBeZero),
75482                        "case_4.kStepCannotBeZero_no_trail", local_fail);
75483    pandas_tests::check(has_no_trailing_ws(pandas::error_messages::kInclusiveInvalid),
unsorted_index (pd_test_5_all.cpp:72250)
72240    check_eq_str(
72241        "case_3.cat7_UndefinedVariable.undefined_variable",
72242        "name 'x' is not defined",
72243        pandas::error_messages::undefined_variable("x"),
72244        local_fail);
72245
72246    // Category 8: UnsortedIndexError — MultiIndex lexsort.
72247    check_eq_str(
72248        "case_3.cat8_UnsortedIndex.unsorted_index",
72249        "Key length (3) was greater than MultiIndex lexsort depth",
72250        pandas::error_messages::unsorted_index("3"),
72251        local_fail);
72252}
72253
72254void case_4_label_not_found_format(int& local_fail) {
72255    std::cout << "-- case_4_label_not_found_format\n";
72256    check_eq_str("case_4.label_not_found_foo",
72257                 "[foo] not in index",
72258                 pandas::error_messages::label_not_found("foo"),
72259                 local_fail);
72260    check_eq_str("case_4.label_not_found_bar_baz",
unsorted_index_key_vs_depth (pd_test_5_all.cpp:73447)
73437    pandas_tests::check(expected == actual,
73438                        "case_5.undefined_variable_byte_exact",
73439                        local_fail);
73440}
73441
73442void case_6_unsorted_index_key_vs_depth(int& local_fail) {
73443    std::cout << "-- case_6_unsorted_index_key_vs_depth\n";
73444    const std::string expected =
73445        "Key length (2) was greater than MultiIndex lexsort depth (0)";
73446    const std::string actual =
73447        pandas::error_messages::unsorted_index_key_vs_depth(2, 0);
73448    pandas_tests::check(expected == actual,
73449                        "case_6.unsorted_index_key_vs_depth_byte_exact",
73450                        local_fail);
73451}
73452
73453} // namespace f_test_error_messages_registry_ns
73454
73455void f_test_error_messages_registry() {
73456    std::cout << "========= f_test_error_messages_registry =======";
73457    int local_fail = 0;
unsupported_binop (pd_test_5_all.cpp:74704)
74694    static_assert(
74695        std::is_same_v<decltype(pandas::error_messages::numeric_only_false_sum_hint(std::string{})),
74696                       std::string>,
74697        "numeric_only_false_sum_hint must return std::string");
74698    static_assert(
74699        std::is_same_v<decltype(pandas::error_messages::cannot_compare_types(std::string{},
74700                                                                             std::string{})),
74701                       std::string>,
74702        "cannot_compare_types must return std::string");
74703    static_assert(
74704        std::is_same_v<decltype(pandas::error_messages::unsupported_binop(std::string{},
74705                                                                          std::string{},
74706                                                                          std::string{})),
74707                       std::string>,
74708        "unsupported_binop must return std::string");
74709
74710    pandas_tests::check(true, "case_1.cat5_constants_and_helpers_type_pinned",
74711                        local_fail);
74712}
74713
74714void case_2_byte_exact_wording(int& local_fail) {
unsupported_dtype (pd_test_5_all.cpp:74120)
74110                  "kCannotConvertNaNToBool must be const std::string_view");
74111    static_assert(std::is_same_v<decltype(pandas::error_messages::kCannotConvertNullableIntegerToBool),
74112                                 const std::string_view>,
74113                  "kCannotConvertNullableIntegerToBool must be const std::string_view");
74114
74115    constexpr std::string_view k = pandas::error_messages::kCannotConvertNAToInteger;
74116    static_assert(k.size() > 0, "kCannotConvertNAToInteger must have content");
74117
74118    // Format helpers exist and return std::string.
74119    static_assert(
74120        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype(std::string{})),
74121                       std::string>,
74122        "unsupported_dtype must return std::string");
74123    static_assert(
74124        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_quoted(std::string{},
74125                                                                                 std::string{})),
74126                       std::string>,
74127        "unsupported_dtype_quoted must return std::string");
74128    static_assert(
74129        std::is_same_v<decltype(pandas::error_messages::cannot_astype_convert(std::string{},
74130                                                                              std::string{})),
unsupported_dtype_for_multiindex (pd_test_5_all.cpp:74139)
74129        std::is_same_v<decltype(pandas::error_messages::cannot_astype_convert(std::string{},
74130                                                                              std::string{})),
74131                       std::string>,
74132        "cannot_astype_convert must return std::string");
74133    static_assert(
74134        std::is_same_v<decltype(pandas::error_messages::cannot_convert_index_to_dtype(std::string{},
74135                                                                                      std::string{})),
74136                       std::string>,
74137        "cannot_convert_index_to_dtype must return std::string");
74138    static_assert(
74139        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_for_multiindex(std::string{})),
74140                       std::string>,
74141        "unsupported_dtype_for_multiindex must return std::string");
74142    static_assert(
74143        std::is_same_v<decltype(pandas::error_messages::cannot_convert_value_in_column(
74144            std::string{}, std::string{}, std::string{}, std::size_t{0}, std::string{})),
74145                       std::string>,
74146        "cannot_convert_value_in_column must return std::string");
74147
74148    pandas_tests::check(true, "case_1.cat6_constants_and_helpers_type_pinned",
74149                        local_fail);
unsupported_dtype_quoted (pd_test_5_all.cpp:74124)
74114    constexpr std::string_view k = pandas::error_messages::kCannotConvertNAToInteger;
74115    static_assert(k.size() > 0, "kCannotConvertNAToInteger must have content");
74116
74117    // Format helpers exist and return std::string.
74118    static_assert(
74119        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype(std::string{})),
74120                       std::string>,
74121        "unsupported_dtype must return std::string");
74122    static_assert(
74123        std::is_same_v<decltype(pandas::error_messages::unsupported_dtype_quoted(std::string{},
74124                                                                                 std::string{})),
74125                       std::string>,
74126        "unsupported_dtype_quoted must return std::string");
74127    static_assert(
74128        std::is_same_v<decltype(pandas::error_messages::cannot_astype_convert(std::string{},
74129                                                                              std::string{})),
74130                       std::string>,
74131        "cannot_astype_convert must return std::string");
74132    static_assert(
74133        std::is_same_v<decltype(pandas::error_messages::cannot_convert_index_to_dtype(std::string{},
unsupported_op (pd_test_5_all.cpp:72229)
72219    check_eq_str(
72220        "case_3.cat4_ValueError.length_mismatch",
72221        "Length of values (3) does not match length of index (5)",
72222        pandas::error_messages::length_mismatch("values", 3, "index", 5),
72223        local_fail);
72224
72225    // Category 5: TypeError — unsupported op.
72226    check_eq_str(
72227        "case_3.cat5_TypeError.unsupported_op",
72228        "unsupported operand type for +: 'object'",
72229        pandas::error_messages::unsupported_op("+", "object"),
72230        local_fail);
72231
72232    // Category 6: dtype — cannot cast.
72233    check_eq_str(
72234        "case_3.cat6_dtype.cannot_cast",
72235        "Cannot cast float64 to int64",
72236        pandas::error_messages::cannot_cast("float64", "int64"),
72237        local_fail);
72238
72239    // Category 7: UndefinedVariableError (eval/query).
version (pd_test_1_all.cpp:940)
930#include <stdexcept>
931
932#include "../pandas/pd_config.h"
933
934namespace dataframe_tests {
935
936namespace dataframe_tests_config {
937
938    void pd_test_config_version() {
939        std::cout << "========= df_config: version info ======================= ";
940        const char* version = pandas::DataFrameInfo::version();
941        if (version == nullptr || std::string(version).empty()) {
942            std::cout << "[FAIL] : in pd_test_config_version() : version is null or empty" << std::endl;
943            throw std::runtime_error("pd_test_config_version failed: version is null or empty");
944        }
945        std::cout << "-> tests passed" << std::endl;
946    }
947
948    void pd_test_config_na_repr() {
949        std::cout << "========= df_config: NA representation ======================= ";
950        const char* na_repr = pandas::DataFrameConfig::get_na_repr();
wide_to_long (pd_test_3_all.cpp:9311)
9301    // Original: 2 rows, reshape with 2 periods -> 4 rows
9302    if (result.nrows() != 4) {
9303        std::cout << "  [FAIL] : in pd_test_3_all_lreshape() : expected 4 rows, got " << result.nrows() << std::endl;
9304        throw std::runtime_error("pd_test_3_all_lreshape failed: nrows");
9305    }
9306
9307    std::cout << " -> tests passed" << std::endl;
9308}
9309
9310void pd_test_3_all_wide_to_long() {
9311    std::cout << "========= wide_to_long() ==========================";
9312
9313    // Create wide-format panel data
9314    std::map<std::string, std::vector<double>> data = {
9315        {"id", {1.0, 2.0}},
9316        {"A1", {10.0, 20.0}},
9317        {"A2", {11.0, 21.0}},
9318        {"B1", {100.0, 200.0}},
9319        {"B2", {101.0, 201.0}}
9320    };
9321    pandas::DataFrame df(data);