You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've stumbled into an issue and would love any help / suggestions. This run on a Python 3.8 on Mac M1.
I'm trying to run this code on my own data (tried it with ac gtfs too):
path = '/Milano/comune-di-milano_20160216_1409.zip'
# Automatically identify the busiest day and
# read that in as a Partidge feed
feed = pt.get_representative_feed(path)
# Set a target time period to
# use to summarize impedance
start = 7*60*60 # 7:00 AM
end = 10*60*60 # 10:00 AM
# Converts feed subset into a directed
# network multigraph
G = pt.load_feed_as_graph(feed, start, end)
and get an error:
AttributeError: module 'numpy' has no attribute 'unicode'
Tried to reinstall everything and install from scratch, but to no avail.
The full output of the error is this:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 6
2 path = '/Users/DANIEL/WORK/MIC-HUB/GTFS Milano/comune-di-milano_20160216_1409.zip'
4 # Automatically identify the busiest day and
5 # read that in as a Partidge feed
----> 6 feed = pt.get_representative_feed(path)
8 # Set a target time period to
9 # use to summarize impedance
10 start = 7*60*60 # 7:00 AM
File /opt/homebrew/lib/python3.8/site-packages/peartree/paths.py:95, in get_representative_feed(file_loc, day_type)
93 # Extract service ids and then trip counts by those dates
94 try:
---> 95 service_ids_by_date = ptg.read_service_ids_by_date(file_loc)
96 trip_counts_by_date = ptg.read_trip_counts_by_date(file_loc)
98 # Raised by partridge if no valid dates returned
File /opt/homebrew/lib/python3.8/site-packages/partridge/readers.py:72, in read_service_ids_by_date(path)
70 """Find all service identifiers by date"""
71 feed = load_raw_feed(path)
---> 72 return _service_ids_by_date(feed)
File /opt/homebrew/lib/python3.8/site-packages/partridge/readers.py:156, in _service_ids_by_date(feed)
153 results: DefaultDict[datetime.date, Set[str]] = defaultdict(set)
154 removals: DefaultDict[datetime.date, Set[str]] = defaultdict(set)
--> 156 service_ids = set(feed.trips.service_id)
157 calendar = feed.calendar
158 caldates = feed.calendar_dates
File /opt/homebrew/lib/python3.8/site-packages/partridge/gtfs.py:16, in _read_file.<locals>.getter(self)
15 def getter(self) -> pd.DataFrame:
---> 16 return self.get(filename)
File /opt/homebrew/lib/python3.8/site-packages/partridge/gtfs.py:48, in Feed.get(self, filename)
46 df = self._cache.get(filename)
47 if df is None:
---> 48 df = self._read(filename)
49 df = self._filter(filename, df)
50 df = self._prune(filename, df)
File /opt/homebrew/lib/python3.8/site-packages/partridge/gtfs.py:48, in Feed.get(self, filename)
46 df = self._cache.get(filename)
47 if df is None:
---> 48 df = self._read(filename)
49 df = self._filter(filename, df)
50 df = self._prune(filename, df)
File /opt/homebrew/lib/python3.8/site-packages/partridge/gtfs.py:102, in Feed._read_csv(self, filename)
99 with open(path, "rb") as f:
100 encoding = detect_encoding(f)
--> 102 df = pd.read_csv(path, dtype=np.unicode, encoding=encoding, index_col=False)
104 # Strip leading/trailing whitespace from column names
105 df.rename(columns=lambda x: x.strip(), inplace=True)
File /opt/homebrew/lib/python3.8/site-packages/numpy/__init__.py:284, in __getattr__(attr)
281 from .testing import Tester
282 return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
285 "{!r}".format(__name__, attr))
AttributeError: module 'numpy' has no attribute 'unicode'
The text was updated successfully, but these errors were encountered:
Looks like recommendation is to use unicode direction. Per the deprecation notes:
To give a clear guideline for the vast majority of cases, for the types bool, object, str (and unicode) using the plain version is shorter and clear, and generally a good replacement.
Hi!
I've stumbled into an issue and would love any help / suggestions. This run on a Python 3.8 on Mac M1.
I'm trying to run this code on my own data (tried it with ac gtfs too):
and get an error:
The text was updated successfully, but these errors were encountered: