Apr-19-2019, 08:27 PM
I'm having trouble saving the data-frame as a CSV.
>>> print(len(df)) 221 >>> final_df = df.sort_values('popularity', ascending=False).drop_duplicates('name').sort_index() >>> print(len(final_df)) 116 >>> >>> final_df.to_csv("{a file location to store your csv}") >>> final_df.to_csv("Desktop") >>> final_df.to_csv("/Users/Pablo/Desktop/SP") Traceback (most recent call last): File "<pyshell#136>", line 1, in <module> final_df.to_csv("/Users/Pablo/Desktop/SP") File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/core/generic.py", line 3020, in to_csv formatter.save() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/io/formats/csvs.py", line 157, in save compression=self.compression) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/io/common.py", line 424, in _get_handle f = open(path_or_buf, mode, encoding=encoding, newline="") IsADirectoryError: [Errno 21] Is a directory: '/Users/Pablo/Desktop/SP'