pythonsunpvlib

zenith angle with getsolarposition


So this is a quick question. I made a program that calculates the zenith angels for a specific day. zenith angle code When I print these angles I get the following: Results of the code I just want to have the angels so I can use them. What do I need to change in my code so that I don't have the other text like "Name: apparent_zenith, dtype: float64 2024-05-15 18:00:00+02:00"

I don't know what I have to change because I didn't code the text that I don't want


Solution

  • In your code angle is actually a pandas Series object that contains one value. When you print a pandas Series object, you get information about the whole object, which includes the name, timestamp/index and data type.

    To print only the values without the extra info, you can use:

    print(angle.values)
    

    The way you have written the program you know there is only one value in each angle object, so you can tell it to print only the first value:

    print(angle.values[0])