Python Forum
utm package error - need your help
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
utm package error - need your help
#1
Hi ,

i have started working on python - pandas since from a month, especially on geo-location/Geo spatial analysis.

i'm using the package : utm to know the latitudes and longitudes from xbin and ybin

jupyter notebook:

import utm as ut
df = sqlContext.sql("sel xbin,ybin from table1 ").topandas()

df
xbin ybin
0 589150 5584550
1 621650 5593050
2 604300 5586800
3 601400 5590300
4 598550 5542950

ut.to_latlon(df["xbin"].all(),df["ybin"].all(), 31, 'N')
this function showing errors

Error:
if strict: 68 if not 100000 <= easting < 1000000: ---> 69 raise OutOfRangeError('easting out of range (must be between 100.000 m and 999.999 m)') 70 if not 0 <= northing <= 10000000: 71 raise OutOfRangeError('northing out of range (must be between 0 m and 10.000.000 m)') OutOfRangeError: easting out of range (must be between 100.000 m and 999.999 m)
when i use the function manually for the same xbin and ybin, its working fine and i have the desired values :
lat =ut.to_latlon(589150,5584550,31, 'N')
lat
(51.373289530506355, 4.4963369548355825)

my code is wrong while using the function ?, can you please help me
Reply
#2
what do you expect that DataFrame.all() does?
https://pandas.pydata.org/pandas-docs/st...e.all.html
Reply
#3
the previous error :
Error:
if strict: ---> 68 if not 100000 <= easting < 1000000: 69 raise OutOfRangeError('easting out of range (must be between 100.000 m and 999.999 m)') 70 if not 0 <= northing <= 10000000: python2.7/site-packages/pandas/core/generic.pyc in __nonzero__(self) 953 raise ValueError("The truth value of a {0} is ambiguous. " 954 "Use a.empty, a.bool(), a.item(), a.any() or a.all()." --> 955 .format(self.__class__.__name__)) 956 957 __bool__ = __nonzero__ ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
even i tried to convert the values to float
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error when installing Seaborn package using pip chawkins 3 5,540 Jul-16-2018, 12:12 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020