Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to calculate 10^pandas series?

I am trying to get a new series by calculating 10 to the power of an existing series. I have tried pandas.Series.rpow and numpy.power, but they all show strange results.
Here is my code:

data = pd.read_csv('Book1.csv', sep=',', header=None, encoding='utf-8')
iexp = data.iloc[:, 9]
s = pd.Series(10, index=iexp.index)
print(s ** iexp)

Result of my code

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try apply

data = pd.read_csv('Book1.csv', sep=',', header=None, encoding='utf-8')
iexp = data.iloc[:, 9]

def power_10(x):
    return 10 ** x

iexp.apply(power_10)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading