thesofakillers / nowcastlib

🧙‍♂️🔧 Utils that can be reused and shared across and beyond the ESO Nowcast project
https://giuliostarace.com/nowcastlib
GNU General Public License v3.0
0 stars 0 forks source link

Example in README contains mistake #2

Closed thesofakillers closed 3 years ago

thesofakillers commented 3 years ago

The example listed here in the README leads to the following error trace:

data_df = pd.DataFrame(
...     [[0, 3, 4, np.NaN], [32, 4, np.NaN, 4], [56, 8, 0, np.NaN]],
...     columns=["A", "B", "C"],
...     index=pd.date_range(start="1/1/2018", periods=4, freq="2min"),
... )
Traceback (most recent call last):
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 898, in _finalize_columns_and_data
    columns = _validate_or_indexify_columns(contents, columns)
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 947, in _validate_or_indexify_columns
    f"{len(columns)} columns passed, passed data had "
AssertionError: 3 columns passed, passed data had 4 columns

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\frame.py", line 700, in __init__
    dtype,
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 483, in nested_data_to_arrays
    arrays, columns = to_arrays(data, columns, dtype=dtype)
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 799, in to_arrays
    content, columns = _finalize_columns_and_data(arr, columns, dtype)
  File "C:\Users\angel\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 901, in _finalize_columns_and_data
    raise ValueError(err) from err
ValueError: 3 columns passed, passed data had 4 columns