Skip to content

Commit

Permalink
Update user_utils.py
Browse files Browse the repository at this point in the history
Fixed dt error in clean_data
  • Loading branch information
danielvandersand authored Nov 8, 2023
1 parent 9ce547a commit 44e7b28
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions press_dash_lib/user_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ def clean_data(raw_df, config):
config (dict): The (possibly altered) configuration dictionary.
'''

# Drop drafts
cleaned_df = raw_df.drop(
raw_df.index[raw_df['Date'].dt.year == 1970],
axis='rows',
)
raw_df['Date'] = pd.to_datetime(raw_df['Date'], errors='coerce')

# Drop rows where 'Date' year is 1970
cleaned_df = raw_df[raw_df['Date'].dt.year != 1970]

# # Drop drafts
# cleaned_df = raw_df.drop(
# raw_df.index[raw_df['Date'].dt.year == 1970],
# axis='rows',
# )

# Drop weird articles---ancient ones w/o a title or press type
cleaned_df.dropna(
Expand Down

0 comments on commit 44e7b28

Please sign in to comment.