Issue
I am trying to put in order a column of a dataframe using the following step
data_crian = data_crian.sort_values(by = 'Flp_CO')
But I get this message everytime I try to run it:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Does anyone know why?
Thanks!!
Solution
I created a simple csv file with one column:
Here is the code:
import pandas as pd
import numpy as np
import os
filename = os.path.join(os.path.dirname(__file__),'data.csv')
data = pd.read_csv(filename)
sorted_data = data.sort_values(by='Numbers')
print(sorted_data)
And this is the output:
Numbers
0 1
3 4
7 7
4 8
1 12
6 15
2 32
5 73
Answered By - Robin Sage
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.