MIERUNE/GTFS-GO

Python error with date filter

Closed this issue · 2 comments

Hi! First of all, thank you for making such an amazing tool!

I've been working with GTFS-GO with various files, and it worked very well. I am now working with a gtfs file from Renfe (the Spanish national train operator), and for some reason the date filter for frequency won't work. I am guessing that the problem would come from the file itself, since I haven't encountered this problem before, but I'd like to make sure!

The Python error is the following:

KeyError: 'Only a column name can be used for the key in a dtype mappings argument.' Traceback (most recent call last): File "C:/Users/subusah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GTFS-GO-master\gtfs_go_dialog.py", line 159, in execution 'features': gtfs_parser.read_route_frequency(yyyymmdd=self.get_yyyymmdd()) File "C:/Users/subusah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GTFS-GO-master\gtfs_parser\__main__.py", line 192, in read_route_frequency trips_filtered_by_day = self.get_trips_on_a_date(yyyymmdd) File "C:/Users/subusah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GTFS-GO-master\gtfs_parser\__main__.py", line 381, in get_trips_on_a_date calendar_df = calendar_df.astype({'start_date': int, 'end_date': int}) File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\pandas\core\generic.py", line 5676, in astype "Only a column name can be used for the " KeyError: 'Only a column name can be used for the key in a dtype mappings argument.'

Would you be able to tell me where does the error comes from? I can perhaps somehow fix the gtfs file in order to work. The file I'm using is from Renfe Open Data, here.

Thank you so much!!

Thank you for using this plugin! 😄

I checked your GTFS data and realized all rows in every files have many white-spaces in end of
each rows, like following screenshot.

スクリーンショット 2021-08-15 20 15 07

An error you mentioned occurs because the plugin parsed end_date column as end_date including many white-spaces.
So, that white-spaces should be removed I think.

You're right! It was quite easy, I fixed the files and now it works perfectly.
Thank you so much for taking the time to reply that quick and for the amazing work on this plugin! 😄