location_data becomes DataFrame type
After I import the csv file location.csv downloaded with Pandas read_csv method, it returns a DataFrame other than Series like the video showed. Therefore when I try to call .unique method, it threw an error saying this method does not work for DataFrame.
Thanks for reaching out!
Could you please support your question with a screenshot containing the entire code you’ve executed? This can help us assist you better. Thank you.
Looking forward to your answer.
So it looks like what is happening is when you remove the "squeeze = True" to get around the warning, it turns the imported file from a Series to a dataframe. Here is the correct syntax to get around the warning and maintain the imported file as a Series.
# squeeze is being depreciated; if you remove squeeze, it will turn into a data frame (and not a Series)
# Which will cause more issues in the next cells
# data = pd.read_csv('Location.csv', squeeze = True)
# This does not work either, it turns into a dataframe
# data = pd.read_csv('Location.csv')
# Correct syntax is:
data = pd.read_csv('Location.csv').squeeze("columns")
# Store a copy of this object’s indices and data.
location_data = data.copy()
# Display the first five rows