Skip to content

Commit

Permalink
Update _yt_helpers.py
Browse files Browse the repository at this point in the history
dtype int translates to c datatype long, which is a 32-bit Integer on Windows. So, for very large channels, the total number of views exceeds the supported value range (try searching for channels with videos about "Cute cat", which will return channels with > 5bn views), leading to an OverflowError ("Python int too large to convert to C long"). Using dtype 'int64' explicitly uses a 64-bit Integer also on Windows machines and solves the issue.
  • Loading branch information
DanielP77 authored Mar 12, 2024
1 parent 658f964 commit 3f6a4b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion advertools/_yt_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _json_to_df(json_resp, params):
for col in df:
if 'Count' in col:
try:
df[col] = df[col].astype(int)
df[col] = df[col].astype('int64')
except ValueError:
continue
if ('published' in col) or ('updated' in col):
Expand Down

0 comments on commit 3f6a4b3

Please sign in to comment.