0

I previously asked on this question how to properly get the item in the "PM" column of the produced dataframe that has the index given by date_index. This solution provided in the answers worked:

date_index = '2021-12-31'
dct['Station_1']['PM'].loc[date_index, "PM"]

and would give me the PM value that was listed in the example dataframes provided in that question.

However, now when i run the above code, I get output like this:

DATE
2021-12-31    50
Name: PM, dtype: int64

I'm not sure what this information is. The structure of my spreadsheets that I run through is the same, two columns each with DATE and PM. All I still want is that lone 50, output alone. Can someone help me with that, and maybe help me figure out why the output of code that worked now outputs something else?

1 Answer 1

1

Add .squeeze() to "squeeze out" the lone value:

>>> dct['Station_1']['PM'].loc[date_index, "PM"].squeeze
50
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.