1

I have a file that I am trying to read in a pandas dataframe. However, some of the cells, are coming up as NaN even though there are values in there. The cells that are showing up as float value. The cells that are not showing up were copied pasted in the cells. Not sure why that would make a difference. Can anyone help? I have included the file as a link at this location: https://www.dropbox.com/s/30rxw07eaza29df/manhattan_hs_gps.csv?dl=0

dataframe output

2
  • What did you try? Commented Jun 2, 2020 at 22:16
  • Can you show the original data and the code you are using that causes them to turn to NaN? Commented Jun 2, 2020 at 23:59

1 Answer 1

3

Tried this and it worked fine, both encoding='unicode-escape' and encoding='latin-1' work:

df = pd.read_csv('manhattan_hs_gps.csv', encoding='unicode-escape', header=None)
print(df)

       0                                                  1          2          3
0      0              A. Philip Randolph Campus High School  40.818500 -73.950000
1      1                                       Aaron School  40.744800 -73.983700
2      2                      Abraham Joshua Heschel School  40.772300 -73.989700
3      3  Academy of Environmental Science Secondary Hig...  40.785200 -73.942200
4      4  Academy for Social Action: A College Board School  40.815400 -73.955300
..   ...                                                ...        ...        ...
162  164                                 Xavier High School  40.737900 -73.994600
163  165            Yeshiva University High School for Boys  40.851749 -73.928695
164  166                            York Preparatory School  40.774100 -73.979400
165  167                    Young Women's Leadership School  40.792900 -73.947200
166  168   Washington Heights Expeditionary Learning School  40.774100 -73.979400
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.