How to keep the plus sign when importing CSV file using pandas?

Viewed 58

I have a CSV file that I need to import into my project. The CSV file is similar to this:

lower upper color
-inf 2.1 #00AEEF
2.1 +inf #ED1C24

or

lower,upper,color
-inf,2.1,#00AEEF
2.1,+inf,#ED1C24

And my code is as follows:

import pandas as pd
df = pd.read_csv('rules.csv')

for i, r in df.iterrows():
    low = r['lower']
    high = r['upper']

    print(low,high)

The output was:

-inf 2.1
2.1 inf

My question is why was it inf and not +inf just like the data? And is there a way to modify the importing process?

0 Answers
Related