Skip to content

Commit

Permalink
remove numpy nan
Browse files Browse the repository at this point in the history
  • Loading branch information
aschleg committed Apr 20, 2018
1 parent 5126956 commit 52d1ec2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions petpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from xml.etree import ElementTree as ET

import requests
from numpy import nan
from pandas import DataFrame, concat
from pandas.io.json import json_normalize
from six.moves.urllib.parse import urljoin
Expand Down Expand Up @@ -643,17 +642,17 @@ def _pet_find_get_coerce(x):
try:
breed = DataFrame(json_normalize(x['breeds']['breed'])['$t'].to_dict(), index=[0])
except (KeyError, TypeError):
breed = DataFrame([nan], columns=[0])
breed = DataFrame(['na'], columns=[0])

try:
media = DataFrame(json_normalize(x['media']['photos']['photo'])['$t'].to_dict(), index=[0])
except (KeyError, TypeError):
media = DataFrame([nan], columns=[0])
media = DataFrame(['na'], columns=[0])

try:
options = DataFrame(json_normalize(x['options']['option'])['$t'].to_dict(), index=[0])
except (KeyError, TypeError):
options = DataFrame([nan], columns=[0])
options = DataFrame(['na'], columns=[0])

breed_df = breed_df.append(breed)
opt_df = opt_df.append(options)
Expand Down

0 comments on commit 52d1ec2

Please sign in to comment.