Repository: pandas-dev/pandas (python)

Issue:
Document our pytest fixtures
It'd be nice if all our fixtures had docstrings stating

1. What they're useful for
2. what they return (possibly parametrized)
3. If / when they skip

From `pytest --fixtures`:

```
---------------------------------------------------------- fixtures defined from pandas.conftest -----------------------------------------------------------
configure_tests
    pandas/conftest.py:39: no docstring available
add_imports
    pandas/conftest.py:46: no docstring available
spmatrix
    pandas/conftest.py:52: no docstring available
ip
    Get an instance of IPython.InteractiveShell.

    Will raise a skip if IPython is not installed.

------------------------------------------------------ fixtures defined from pandas.tests.io.conftest ------------------------------------------------------
tips_file
    Path to the tips dataset
jsonl_file
    Path a JSONL dataset
salaries_table
    DataFrame with the salaries dataset
s3_resource
    Fixture for mocking S3 interaction.

    The primary bucket name is "pandas-test". The following datasets
    are loaded.

    - tips.csv
    - tips.csv.gz
    - tips.csv.bz2
    - items.jsonl

    A private bucket "cant_get_it" is also created. The boto3 s3 resource
    is yielded by the fixture.

--------------------------------------------------- fixtures defined from pandas.tests.indexes.conftest ----------------------------------------------------
indices
    pandas/tests/indexes/conftest.py:10: no docstring available
one
    pandas/tests/indexes/conftest.py:29: no docstring available

--------------------------------------------------- fixtures defined from pandas.tests.tseries.conftest ----------------------------------------------------
tz
    pandas/tests/tseries/conftest.py:5: no docstring available

----------------------------------------------- fixtures defined from pandas.tests.tseries.offsets.conftest ------------------------------------------------
month_classes
    pandas/tests/tseries/offsets/conftest.py:11: no docstring available
tick_classes
    pandas/tests/tseries/offsets/conftest.py:18: no docstring available
tz
    pandas/tests/tseries/offsets/conftest.py:24: no docstring available
offset_types
    pandas/tests/tseries/offsets/conftest.py:6: no docstring available

----------------------------------------------------- fixtures defined from pandas.tests.io.test_stata -----------------------------------------------------
dirpath
    pandas/tests/io/test_stata.py:27: no docstring available
parsed_114
    pandas/tests/io/test_stata.py:32: no docstring available

---------------------------------------------------- fixtures defined from pandas.tests.io.test_pickle -----------------------------------------------------
get_random_path
    pandas/tests/io/test_pickle.py:313: no docstring available
current_pickle_data
    pandas/tests/io/test_pickle.py:33: no docstring available

---------------------------------------------------- fixtures defined from pandas.tests.frame.test_join ----------------------------------------------------
frame_with_period_index
    pandas/tests/frame/test_join.py:12: no docstring available
frame
    pandas/tests/frame/test_join.py:20: no docstring available
left
    pandas/tests/frame/test_join.py:25: no docstring available
right
    pandas/tests/frame/test_join.py:30: no docstring available

---------------------------------------------------- fixtures defined from pandas.tests.io.test_packers ----------------------------------------------------
current_packers_data
    pandas/tests/io/test_packers.py:47: no docstring available
all_packers_data
    pandas/tests/io/test_packers.py:55: no docstring available

---------------------------------------------------- fixtures defined from pandas.tests.io.test_parquet ----------------------------------------------------
engine
    pandas/tests/io/test_parquet.py:30: no docstring available
pa
    pandas/tests/io/test_parquet.py:43: no docstring available
pa_lt_070
    pandas/tests/io/test_parquet.py:50: no docstring available
pa_ge_070
    pandas/tests/io/test_parquet.py:59: no docstring available
fp
    pandas/tests/io/test_parquet.py:68: no docstring available
df_compat
    pandas/tests/io/test_parquet.py:75: no docstring available
df_cross_compat
    pandas/tests/io/test_parquet.py:80: no docstring available
df_full
    pandas/tests/io/test_parquet.py:95: no docstring available

---------------------------------------------------- fixtures defined from pandas.tests.test_downstream ----------------------------------------------------
df
    pandas/tests/test_downstream.py:33: no docstring available

-------------------------------------------------- fixtures defined from pandas.tests.frame.test_validate --------------------------------------------------
dataframe
    pandas/tests/frame/test_validate.py:8: no docstring available

-------------------------------------------------- fixtures defined from pandas.tests.sparse.test_reshape --------------------------------------------------
multi_index3
    pandas/tests/sparse/test_reshape.py:14: no docstring available
sparse_df
    pandas/tests/sparse/test_reshape.py:9: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.frame.test_analytics --------------------------------------------------
df_duplicates
    pandas/tests/frame/test_analytics.py:2133: no docstring available
df_strings
    pandas/tests/frame/test_analytics.py:2141: no docstring available
df_main_dtypes
    pandas/tests/frame/test_analytics.py:2148: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.scalar.test_interval --------------------------------------------------
interval
    pandas/tests/scalar/test_interval.py:12: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.series.test_validate --------------------------------------------------
series
    pandas/tests/series/test_validate.py:8: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.computation.test_eval -------------------------------------------------
engine
    pandas/tests/computation/test_eval.py:42: no docstring available
parser
    pandas/tests/computation/test_eval.py:55: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.dtypes.test_inference -------------------------------------------------
coerce
    pandas/tests/dtypes/test_inference.py:45: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.frame.test_query_eval -------------------------------------------------
parser
    pandas/tests/frame/test_query_eval.py:31: no docstring available
engine
    pandas/tests/frame/test_query_eval.py:36: no docstring available

------------------------------------------------- fixtures defined from pandas.tests.series.test_analytics -------------------------------------------------
s_main_dtypes
    pandas/tests/series/test_analytics.py:1787: no docstring available

------------------------------------------------ fixtures defined from pandas.tests.groupby.test_whitelist -------------------------------------------------
df
    pandas/tests/groupby/test_whitelist.py:106: no docstring available
df_letters
    pandas/tests/groupby/test_whitelist.py:115: no docstring available
raw_frame
    pandas/tests/groupby/test_whitelist.py:163: no docstring available
mframe
    pandas/tests/groupby/test_whitelist.py:95: no docstring available

------------------------------------------------ fixtures defined from pandas.tests.indexing.test_coercion -------------------------------------------------
check_comprehensiveness
    pandas/tests/indexing/test_coercion.py:18: no docstring available

------------------------------------------------ fixtures defined from pandas.tests.io.json.test_normalize -------------------------------------------------
deep_nested
    pandas/tests/io/json/test_normalize.py:13: no docstring available
state_data
    pandas/tests/io/json/test_normalize.py:42: no docstring available

------------------------------------------------ fixtures defined from pandas.tests.io.json.test_readlines -------------------------------------------------
lines_json_df
    pandas/tests/io/json/test_readlines.py:13: no docstring available

----------------------------------------------- fixtures defined from pandas.tests.internals.test_internals ------------------------------------------------
mgr
    pandas/tests/internals/test_internals.py:32: no docstring available

----------------------------------------------- fixtures defined from pandas.tests.io.formats.test_to_latex ------------------------------------------------
frame
    pandas/tests/io/formats/test_to_latex.py:13: no docstring available

----------------------------------------------- fixtures defined from pandas.tests.reshape.merge.test_merge ------------------------------------------------
left
    pandas/tests/reshape/merge/test_merge.py:1547: no docstring available
right
    pandas/tests/reshape/merge/test_merge.py:1557: no docstring available
left_df
    pandas/tests/reshape/merge/test_merge.py:1760: no docstring available
right_df
    pandas/tests/reshape/merge/test_merge.py:1765: no docstring available

---------------------------------------------- fixtures defined from pandas.tests.io.parser.test_unsupported -----------------------------------------------
python_engine
    pandas/tests/io/parser/test_unsupported.py:23: no docstring available

--------------------------------------------- fixtures defined from pandas.tests.groupby.test_index_as_string ----------------------------------------------
frame
    pandas/tests/groupby/test_index_as_string.py:10: no docstring available
series
    pandas/tests/groupby/test_index_as_string.py:23: no docstring available

--------------------------------------------- fixtures defined from pandas.tests.indexes.datetimes.test_tools ----------------------------------------------
units
    pandas/tests/indexes/datetimes/test_tools.py:1613: no docstring available
epoch_1960
    pandas/tests/indexes/datetimes/test_tools.py:1618: no docstring available
units_from_epochs
    pandas/tests/indexes/datetimes/test_tools.py:1624: no docstring available
epochs
    pandas/tests/indexes/datetimes/test_tools.py:1629: no docstring available
julian_dates
    pandas/tests/indexes/datetimes/test_tools.py:1637: no docstring available

--------------------------------------------- fixtures defined from pandas.tests.internals.test_external_block ---------------------------------------------
df
    pandas/tests/internals/test_external_block.py:31: no docstring available

-------------------------------------------- fixtures defined from pandas.tests.indexes.interval.test_interval ---------------------------------------------
closed
    pandas/tests/indexes/interval/test_interval.py:16: no docstring available
name
    pandas/tests/indexes/interval/test_interval.py:21: no docstring available

------------------------------------------- fixtures defined from pandas.tests.groupby.aggregate.test_aggregate --------------------------------------------
ts
    pandas/tests/groupby/aggregate/test_aggregate.py:19: no docstring available
tsframe
    pandas/tests/groupby/aggregate/test_aggregate.py:24: no docstring available
df
    pandas/tests/groupby/aggregate/test_aggregate.py:29: no docstring available
mframe
    pandas/tests/groupby/aggregate/test_aggregate.py:38: no docstring available
three_group
    pandas/tests/groupby/aggregate/test_aggregate.py:50: no docstring available

------------------------------------------- fixtures defined from pandas.tests.generic.test_label_or_level_utils -------------------------------------------
df
    DataFrame with columns 'L1', 'L2', and 'L3'
df_levels
    DataFrame with columns or index levels 'L1', 'L2', and 'L3'
df_ambig
    DataFrame with levels 'L1' and 'L2' and labels 'L1' and 'L3'
df_duplabels
    DataFrame with level 'L1' and labels 'L2', 'L3', and 'L2'
panel
    pandas/tests/generic/test_label_or_level_utils.py:48: no docstring available

------------------------------------------- fixtures defined from pandas.tests.indexes.datetimes.test_arithmetic -------------------------------------------
tz
    pandas/tests/indexes/datetimes/test_arithmetic.py:18: no docstring available
delta
    pandas/tests/indexes/datetimes/test_arithmetic.py:25: no docstring available
addend
    pandas/tests/indexes/datetimes/test_arithmetic.py:33: no docstring available

------------------------------------------ fixtures defined from pandas.tests.indexes.timedeltas.test_arithmetic -------------------------------------------
delta
    pandas/tests/indexes/timedeltas/test_arithmetic.py:17: no docstring available
freq
    pandas/tests/indexes/timedeltas/test_arithmetic.py:25: no docstring available

----------------------------------------------------- fixtures defined from pandas.tests.test_resample -----------------------------------------------------

------------------------------------------ fixtures defined from pandas.tests.frame.test_sort_values_level_as_str ------------------------------------------
df_none
    pandas/tests/frame/test_sort_values_level_as_str.py:11: no docstring available
df_idx
    pandas/tests/frame/test_sort_values_level_as_str.py:20: no docstring available
sort_names
    pandas/tests/frame/test_sort_values_level_as_str.py:29: no docstring available
ascending
    pandas/tests/frame/test_sort_values_level_as_str.py:43: no docstring available

------------------------------------------ fixtures defined from pandas.tests.indexes.interval.test_interval_tree ------------------------------------------
closed
    pandas/tests/indexes/interval/test_interval_tree.py:11: no docstring available

----------------------------------------- fixtures defined from pandas.tests.indexes.interval.test_interval_range ------------------------------------------
closed
    pandas/tests/indexes/interval/test_interval_range.py:15: no docstring available
name
    pandas/tests/indexes/interval/test_interval_range.py:20: no docstring available

----------------------------------------------------- fixtures defined from pandas.tests.test_resample -----------------------------------------------------
index
    pandas/tests/test_resample.py:724: no docstring available
series
    pandas/tests/test_resample.py:736: no docstring available
frame
    pandas/tests/test_resample.py:740: no docstring available
series_and_frame
    pandas/tests/test_resample.py:744: no docstring available

--------------------------------------- fixtures defined from pandas.tests.reshape.merge.test_merge_index_as_string ----------------------------------------
df1
    pandas/tests/reshape/merge/test_merge_index_as_string.py:10: no docstring available
df2
    pandas/tests/reshape/merge/test_merge_index_as_string.py:18: no docstring available
left_df
    Construct left test DataFrame with specified levels
    (any of 'outer', 'inner', and 'v1')
right_df
    Construct right test DataFrame with specified levels
    (any of 'outer', 'inner', and 'v2')

------------------------------------------------- fixtures defined from pandas.tests.reshape.test_reshape --------------------------------------------------
df
    pandas/tests/reshape/test_reshape.py:23: no docstring available
dtype
    pandas/tests/reshape/test_reshape.py:29: no docstring available
sparse
    pandas/tests/reshape/test_reshape.py:33: no docstring available
```

Pull request description:
DOC: Add fixtures for testing DropDuplicates for datetimelike dataframes
Add docstrings to fixtures in `pandas/tests/indexes/datetimelike_/test_drop_duplicates.py` file.
Partially addressed #19159.

- [ ] Closes #xxx
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Patch:
diff --git a/ci/code_checks.sh b/ci/code_checks.sh
index 3876e493ce..1e9250fd77 100755
--- a/ci/code_checks.sh
+++ b/ci/code_checks.sh
@@ -195,7 +195,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
         -i "pandas.Series.str.wrap RT03,SA01" \
         -i "pandas.Series.str.zfill RT03" \
         -i "pandas.Series.struct.dtypes SA01" \
-        -i "pandas.Series.to_dict SA01" \
         -i "pandas.Series.to_markdown SA01" \
         -i "pandas.Series.update PR07,SA01" \
         -i "pandas.Timedelta.asm8 SA01" \
diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index ba6636cb42..c5c886912e 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -547,6 +547,7 @@ Interval
 Indexing
 ^^^^^^^^
 - Bug in :meth:`DataFrame.__getitem__` returning modified columns when called with ``slice`` in Python 3.12 (:issue:`57500`)
+- Bug in :meth:`DataFrame.from_records` throwing a ``ValueError`` when passed an empty list in ``index`` (:issue:`58594`)
 -
 
 Missing
diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py
index 7d43498d42..5bffac5fa6 100644
--- a/pandas/core/indexes/base.py
+++ b/pandas/core/indexes/base.py
@@ -7473,9 +7473,12 @@ def ensure_index_from_sequences(sequences, names=None) -> Index:
     --------
     ensure_index
     """
+    from pandas.core.indexes.api import default_index
     from pandas.core.indexes.multi import MultiIndex
 
-    if len(sequences) == 1:
+    if len(sequences) == 0:
+        return default_index(0)
+    elif len(sequences) == 1:
         if names is not None:
             names = names[0]
         return Index(maybe_sequence_to_range(sequences[0]), name=names)
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 5b73c94442..9209a80ada 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -1712,6 +1712,12 @@ class Series(base.IndexOpsMixin, NDFrame):  # type: ignore[misc]
         collections.abc.MutableMapping
             Key-value representation of Series.
 
+        See Also
+        --------
+        Series.to_list: Converts Series to a list of the values.
+        Series.to_numpy: Converts Series to NumPy ndarray.
+        Series.array: ExtensionArray of the data backing this Series.
+
         Examples
         --------
         >>> s = pd.Series([1, 2, 3, 4])


Test patch:
diff --git a/pandas/tests/frame/constructors/test_from_records.py b/pandas/tests/frame/constructors/test_from_records.py
index 5be42d41af..ed2f0aa9c4 100644
--- a/pandas/tests/frame/constructors/test_from_records.py
+++ b/pandas/tests/frame/constructors/test_from_records.py
@@ -148,6 +148,12 @@ class TestFromRecords:
         assert len(result) == 0
         assert len(result.columns) == 0
 
+    def test_from_records_sequencelike_empty_index(self):
+        result = DataFrame.from_records([], index=[])
+        assert len(result) == 0
+        assert len(result.columns) == 0
+        assert len(result.index) == 0
+
     def test_from_records_dictlike(self):
         # test the dict methods
         df = DataFrame(
diff --git a/pandas/tests/indexes/datetimelike_/test_drop_duplicates.py b/pandas/tests/indexes/datetimelike_/test_drop_duplicates.py
index 61a79c4cea..c2d76c0bcc 100644
--- a/pandas/tests/indexes/datetimelike_/test_drop_duplicates.py
+++ b/pandas/tests/indexes/datetimelike_/test_drop_duplicates.py
@@ -70,20 +70,32 @@ class DropDuplicates:
 class TestDropDuplicatesPeriodIndex(DropDuplicates):
     @pytest.fixture(params=["D", "3D", "h", "2h", "min", "2min", "s", "3s"])
     def freq(self, request):
+        """
+        Fixture to test for different frequencies for PeriodIndex.
+        """
         return request.param
 
     @pytest.fixture
     def idx(self, freq):
+        """
+        Fixture to get PeriodIndex for 10 periods for different frequencies.
+        """
         return period_range("2011-01-01", periods=10, freq=freq, name="idx")
 
 
 class TestDropDuplicatesDatetimeIndex(DropDuplicates):
     @pytest.fixture
     def idx(self, freq_sample):
+        """
+        Fixture to get DatetimeIndex for 10 periods for different frequencies.
+        """
         return date_range("2011-01-01", freq=freq_sample, periods=10, name="idx")
 
 
 class TestDropDuplicatesTimedeltaIndex(DropDuplicates):
     @pytest.fixture
     def idx(self, freq_sample):
+        """
+        Fixture to get TimedeltaIndex for 10 periods for different frequencies.
+        """
         return timedelta_range("1 day", periods=10, freq=freq_sample, name="idx")