You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#1334: Update DataFrame.from_records signature and add tests (#1335)
* feat: add type hints and tests for DataFrame.from_records method
* Fix DataFrame.from_records type annotations and add pd.Index test- Change np.ndarray to np_2d_array for data parameter- Change SequenceNotStr[str] to ListLike for columns and exclude parameters- Add test case with pd.Index as columns parameterAddresses review feedback from Dr-Irv
* Fix DataFrame.from_records type annotations- Update data parameter to use Sequence[SequenceNotStr] | Sequence[Mapping[str, Scalar]] | Mapping[str, Sequence[Scalar]]- Update columns and exclude parameters to use ListLike | None = None- Update index parameter to use SequenceNotStr for better type precisionAddresses review feedback from Dr-Irv on issue #1334
* feat: add type hints and tests for DataFrame.from_records method- Add np_2darray support to data parameter type annotation- Add comprehensive tests for DataFrame.from_records in test_frame.py- Fix NumPy 2.0 compatibility in test (S1 instead of a1)- Test covers np.ndarray, list of tuples, pd.Index columns, and structured arrays- Addresses GitHub issue #1334
* fix: improve DataFrame.from_records type annotations
- Update data parameter types to accept Sequence[Mapping[str, Any]] and Mapping[str, SequenceNotStr[Any]]
- Add comprehensive tests for np.ndarray, tuples, and mapping inputs
- Address GitHub issue #1334 per Dr-Irv feedback
- All 207 DataFrame tests pass with no issues
* fix: enhance DataFrame.from_records type annotations per issue #1334
The main changes include:
- Updated data parameter types from overly restrictive Scalar to more flexible Any types
- Added .reshape(2, 2) to numpy array test to handle CI compatibility issues across different numpy versions
- Included a test for mapping of sequences using DataFrame constructor (which seems to be the right approach for that data type)
All 207 DataFrame tests still pass
* fix: enhance DataFrame.from_records type annotations per issue #1334
Addresses Dr-Irv's feedback:
- Updated data parameter types from restrictive Scalar to flexible Any
- Added .reshape(2, 2) to numpy test for CI compatibility
- Added proper dictionary tests (list and single) without tuple conversion
- Added Mapping[str, Any] type support for single dictionaries
- Used DataFrame constructor for mapping sequences test
All tests pass.
* fix: change index parameter to list[str] for type compatibility
* fix: update DataFrame.from_records index parameter to accept Hashable values
- Change index parameter type from SequenceNotStr[str] to SequenceNotStr[Hashable]
- Apply black formatting to test files
- Resolves CI type checking issues per Dr-Irv feedback
This allows index parameter to accept integers and other hashable values,
not just strings, matching pandas runtime behavior.
* fix: use DataFrame.from_records instead of DataFrame constructor for mapping dict test. Applied black formatting and pre-commit fixes
0 commit comments