OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Map Error In python

  • Thread starter Thread starter user7032676
  • Start date Start date
U

user7032676

Guest
Code:
def mapTarget(target):
    if target == 0:
        return 'setosa'
    if target == 1:
        return 'versicolor'
    if target == 2 :
        return 'virgincia'



ir = load_iris()
df = pd.DataFrame(ir['data'], columns = ir['feature_names'])
df['target'] = ir['target']
df['target_name'] = map(mapTarget,df['target'])
print(df)

Python 3.x In the above program i'm trying to map the target value with the target name in the iris dataset. But it always return something like map object at 0x000000001466DD68
<pre><code>def mapTarget(target):
if target == 0:
return 'setosa'
if target == 1:
return 'versicolor'
if target == 2 :
return 'virgincia'



ir = load_iris()
df = pd.DataFrame(ir['data'], columns = ir['feature_names'])
df['target'] = ir['target']
df['target_name'] = map(mapTarget,df['target'])
print(df)
</code></pre>

<p><b>Python 3.x</b>
In the above program i'm trying to map the target value with the target name in the iris dataset. But it always return something like <b> map object at 0x000000001466DD68 </b></p>
 

Latest posts

Top