Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: No objects to concatenate #11

Closed
dcstats opened this issue Sep 8, 2022 · 2 comments
Closed

ValueError: No objects to concatenate #11

dcstats opened this issue Sep 8, 2022 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dcstats
Copy link
Owner

dcstats commented Sep 8, 2022

Code

ms.get_game_pbp('400915255')

Traceback

ValueError                                Traceback (most recent call last)
Input In [24], in <cell line: 1>()
----> 1 s.get_game_pbp(400915255)

File ~/Documents/Projects/CBBpy/testing/espn/mens/scrape.py:245, in get_game_pbp(game_id)
    241     else:
    242         # no exception thrown
    243         break
--> 245 return pd.concat(pbp_halves)

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pandas/util/_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    305 if len(args) > num_allow_args:
    306     warnings.warn(
    307         msg.format(arguments=arguments),
    308         FutureWarning,
    309         stacklevel=stacklevel,
    310     )
--> 311 return func(*args, **kwargs)

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pandas/core/reshape/concat.py:347, in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    143 @deprecate_nonkeyword_arguments(version=None, allowed_args=["objs"])
    144 def concat(
    145     objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
   (...)
    154     copy: bool = True,
    155 ) -> DataFrame | Series:
    156     """
    157     Concatenate pandas objects along a particular axis with optional set logic
    158     along the other axes.
   (...)
    345     ValueError: Indexes have overlapping values: ['a']
    346     """
--> 347     op = _Concatenator(
    348         objs,
    349         axis=axis,
    350         ignore_index=ignore_index,
    351         join=join,
    352         keys=keys,
    353         levels=levels,
    354         names=names,
    355         verify_integrity=verify_integrity,
    356         copy=copy,
    357         sort=sort,
    358     )
    360     return op.get_result()

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/pandas/core/reshape/concat.py:404, in _Concatenator.__init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    401     objs = list(objs)
    403 if len(objs) == 0:
--> 404     raise ValueError("No objects to concatenate")
    406 if keys is None:
    407     objs = list(com.not_none(*objs))

ValueError: No objects to concatenate

Cause

KeyError('src') is thrown in _clean_pbp_table line 751-2: links = [row.find("img")["src"] if row.find("img") else None for row in body_rows]

@dcstats dcstats added the bug Something isn't working label Sep 8, 2022
@dcstats dcstats self-assigned this Sep 8, 2022
@dcstats dcstats added this to the v1.0.3 milestone Sep 8, 2022
dcstats added a commit that referenced this issue Sep 8, 2022
more robust way of mapping plays to teams in PBP
@dcstats
Copy link
Owner Author

dcstats commented Sep 8, 2022

Also unexpected behavior - for PBPs with video replays, an extra column ('unnamed: 4') is being added

dcstats added a commit that referenced this issue Sep 8, 2022
Fix for games with video replays in PBP, extra column no longer added to dataframes
@dcstats
Copy link
Owner Author

dcstats commented Sep 9, 2022

Fixed with d8d316c and c8ca836

@dcstats dcstats closed this as completed Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant