Skip to main content

Crate fp_index

Crate fp_index 

Source
Expand description

Row-label / index machinery for frankenpandas — every DataFrame and Series in fp-frame carries an Index that pairs labels with positional row indices, plus the alignment algebra that pandas users expect from Series + Series and DataFrame.align().

§Core types

  • Index: the canonical row-label container. Internally a typed Vec<IndexLabel> plus an O(1) label-lookup hashmap built lazily on first use. Pandas Index shape: monotonic probes, duplicate handling, range-style construction (Index::from_range(0..N)), name metadata.
  • IndexLabel: typed label enum — Int64(i64), Float64(f64), Utf8(String), Bool(bool), Datetime64(i64), Timedelta64(i64). Lets one Index carry mixed-type labels without erasing to strings.
  • MultiIndex: hierarchical multi-level index for pandas-style row MultiIndex DataFrames. Each level is itself a Vec<IndexLabel> plus an integer codes array.
  • MultiIndexOrIndex: sum-type for code paths that accept either flat Index or MultiIndex.
  • DuplicateKeep: enum controlling keep='first' | 'last' | False semantics in Index.duplicated / Index.drop_duplicates etc.

§Alignment algebra

Binary ops between two pandas-shaped frames need to align rows by label. The aligner builds an AlignmentPlan (or MultiAlignmentPlan for N-way joins) that the caller then applies to each side’s value buffers:

§Date / time helpers

Pandas pd.date_range / pd.timedelta_range analogs:

§Error reporting

§Relationship to other crates

  • fp-types supplies Scalar / Timedelta / format_datetime_ns primitives.
  • fp-frame stores an Index per DataFrame / Series and uses the alignment algebra here for binary ops.
  • fp-join consumes alignment plans for merge-style joins.

Structs§

AlignmentPlan
CategoricalIndex
Public pandas-style categorical index wrapper.
DatetimeIndex
Public pandas-style datetime index wrapper.
Index
IndexStringAccessor
MultiAlignmentPlan
Result of multi-way alignment: a union index plus per-input position vectors.
MultiIndex
A hierarchical (multi-level) index for DataFrames and Series.
PeriodFields
PeriodIndex
Public pandas-style period index wrapper.
RangeIndex
Public pandas-style range index wrapper.
TimedeltaIndex
Public pandas-style timedelta index wrapper.

Enums§

AlignMode
Alignment mode for index-level join semantics.
DateOffset
A small subset of pandas pandas.tseries.offsets date offsets.
DateRangeError
Error for date_range parameter combinations.
DuplicateKeep
IndexError
IndexLabel
MultiIndexOrIndex
Result of MultiIndex::droplevel — either a MultiIndex (if 2+ levels remain) or a plain Index (if reduced to 1 level).
TimedeltaRangeError
Error for timedelta_range parameter combinations.

Functions§

align
Align two indexes using the specified join mode.
align_inner
Inner alignment: only labels present in both indexes.
align_left
Left alignment: all left labels preserved, right fills with None for missing.
align_union
apply_date_offset
Apply a date offset to a timestamp string and return nanoseconds since epoch.
apply_date_offset_to_nanos
Apply a date offset to a nanosecond timestamp.
bdate_range
Create a DatetimeIndex with default weekday-only business-day values.
date_range
Create a DatetimeIndex with evenly spaced values.
format_datetime_ns
infer_freq
Infer a pandas-style frequency string from a DatetimeIndex.
infer_freq_from_nanos
Infer a pandas-style frequency string from nanosecond timestamps.
infer_freq_from_timestamps
Infer a pandas-style frequency string from timestamp strings.
leapfrog_intersection
Leapfrog intersection: labels present in ALL input indexes.
leapfrog_union
K-way merge union of multiple sorted iterators.
multi_way_align
Multi-way alignment: union all indexes, then compute position vectors.
timedelta_range
Create a TimedeltaIndex with evenly spaced values.
validate_alignment_plan