static void _to_serializable(flexible_type& data, schema_t& schema, const gl_sframe& input) { schema.insert(std::make_pair("type", JSON::types::SFRAME)); flex_dict data_dict; flex_list column_names; for (const auto& name : input.column_names()) { column_names.push_back(name); } data_dict.push_back(std::make_pair("column_names", column_names)); std::vector<flexible_type> columns; for (const auto& name : column_names) { const auto& column = input.select_column(name); flexible_type serialized_column; schema_t serialized_schema; _any_to_serializable(serialized_column, serialized_schema, column); columns.push_back(serialized_column); } data_dict.push_back(std::make_pair("columns", columns)); data = data_dict; }
void gl_gframe::add_columns(const gl_sframe& data) { for (const auto& k: data.column_names()) { add_column(data[k], k); } }