Issue reading csv locally

Hello all,

I am new to coding and new to hugging face. I’ve created a dashboard using the panel library that displays NYPD crime statistics. It works perfectly fine when I run it through my code editor or the command prompt, but when the code is run on Hugging face, it doesnt work. This is because, for some reason pd.read_csv() cannot find my file, even though the local path is identical to the one in my original code (and matches the path for the csv I am trying to load). I’m not sure why this is. I also use pd.read_csv() to load a dataset from a url, which works perfectly fine. Is there a way to fix this? or is there a way to load a csv file directly from a hugging face space using pandas?

Additionally, I tried upload the csv file to a dataset in hugging face and load it from there. This worked in loading the data but I got an error with one of my variables (KeyError: ‘Longitude’). I confirmed that the variable was in fact ‘Longitude’. Not sure why that is.

Any help is greatly appreciated! Thanks!


This is an app thatI built loading a .parquet file using pandas directly from the huggingface folder.
(.parquet works like a csv).

If you share your code and space I could have a look.
Thank you

1 Like