print(f"PearsonR Corr Coefficient {%0.3f} {pearsonr_coefficient}")
            Asked
            
        
        
            Active
            
        
            Viewed 190 times
        
    -1
            
            
         
    
    
        jonrsharpe
        
- 115,751
- 26
- 228
- 437
 
    
    
        Anmol Katare
        
- 21
- 3
- 
                    2*What* error? Give a [mre]. – jonrsharpe Mar 30 '20 at 14:41
3 Answers
1
            
            
        With f-strings you have to specify the format in a different way:
print(f"PearsonR Corr Coefficient {pearsonr_coefficient:0.3f}")
Refer to this guide if you have more doubts.
 
    
    
        UJIN
        
- 1,648
- 13
- 28
0
            
            
        Try this:
pearsonr_coefficient = 1.0545
print(f"PearsonR Corr Coefficient {pearsonr_coefficient:0.3f}")
# PearsonR Corr Coefficient 1.054
see this answer
The trick is here : :0.3f Please check the python documentation with examples
 
    
    
        Eric Frigade
        
- 128
- 6
0
            
            
        print(f"PearsonR Corr Coefficient {pearsonr_coefficient:0.3f}")
 
    
    
        wang..lee
        
- 1
- 1
- 1
- 
                    1Welcome to SO! You may want to explain why your answer resolves the question. Generally speaking answers that provide a solution to the question while also explaining the solution tend to score higher than those that simply provide a solution. Linking in relevant documentation also is a big help! Thanks for contributing! – Frito Mar 30 '20 at 15:16
- 
                    https://stackoverflow.com/help/how-to-answer Here's some additional information on crafting an answer since I ran out of characters above :-) – Frito Mar 30 '20 at 15:17