While reading a geojson file using GeoPandas in jupyter notebook, I'm getting following error.
import geopandas as gpd
df = gpd.read_file(filepath)
Error:
CRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name)
I also got the warning while importing geopandas:
Warning:
PROJ: proj_create_from_database: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
What does it mean?. I have been using 'geopandas' for a long time. Never saw these error and warning.
Related
I am trying to read some .shp file in geopandas using .read_file() function, but I am always get error:
DriverError: Failed to read all values for 158775 records in .shx file: No error.
My code:
import geopandas as gpd
path_shp = "./data/gis_osm_buildings_a_07_1.shp"
data_shx = gpd.read_file(path_shp, driver = "SHP")
Out:
DriverError: Failed to read all values for 158775 records in .shx file: No error.
How can I solve this problem?
I'm trying to read a bson file this is my code:
import bson
with open("D:/rl env/chat_log.bson",'rb') as f:
datas = bson.decode_all(f.read())
note that "D:/rl env/chat_log.bson" is my file path.
i got below error:
AttributeError: module 'bson' has no attribute 'decode_all'
I must mention that I didn't get any error when I ran this code in google colab.
Have you tried to use the loads method
with open("D:/rl env/chat_log.bson",'r') as f:
datas = bson.loads(f.read())
Receiving intermittent snowflake python connector error while trying to load file onto table.
Gives error in following code:
exe.execute("""PUT 'file:///Users/oscar/Desktop/data.txt'
'#"db"."schema".%"table"/ui4654116544'""")
I downloaded and have been trying to run the following package: https://pypi.org/project/ecomplexity/#description
Which is also available on github here: https://github.com/cid-harvard/py-ecomplexity
The readme page has an example of how the code is supposed to work, given here:
from ecomplexity import ecomplexity
from ecomplexity import proximity
# Import trade data from CID Atlas
data_url = "https://intl-atlas-downloads.s3.amazonaws.com/country_hsproduct2digit_year.csv.zip"
data = pd.read_csv(data_url, compression="zip", low_memory=False)
data = data[['year','location_code','hs_product_code','export_value']]
# Calculate complexity
trade_cols = {'time':'year', 'loc':'location_code', 'prod':'hs_product_code', 'val':'export_value'}
cdata = ecomplexity(data, trade_cols)
# Calculate proximity matrix
prox_df = proximity(data, trade_cols)
I added import pandas as pd so that the .csv file could be read and added print(prox_df) to provide the results of the second function. I expected the second function to produce a matrix of values in which the elements are the minimum conditional probability of any two products coming from any location.
However, when running this example from the readme page, I am presented with the following error:
Traceback (most recent call last):
File "filepath/project.py", line 16, in <module>
prox_df = proximity(data, trade_cols)
File "filepath\venv\lib\site-packages\ecomplexity\proximity.py", line 79, in proximity
output = output.reset_index()
File "filepath\venv\lib\site-packages\pandas\core\frame.py", line 4849, in reset_index
new_obj.insert(0, name, level_values)
File "filepath\venv\lib\site-packages\pandas\core\frame.py", line 3618, in insert
self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
File "filepath\venv\lib\site-packages\pandas\core\internals\managers.py", line 1147, in insert
raise ValueError(f"cannot insert {item}, already exists")
ValueError: cannot insert prod, already exists
What causes this error? How can I prevent this error from occurring so that I can use the 'proximity' function of this package?
I just tried with pandas 1.1.0 and it failed with same error message. I then downgraded to pandas 0.25.0 and it worked.
You should consider contacting library author to upgrade to work with latest versions of pandas
pip3 install -Iv pandas==0.25.0
I am passing data between erlang and python using erlport, following the example here:
http://erlport.org/docs/python.html
the python file I'm calling only contains the line:
import pandas as pd
I am getting the error:
** exception error: {python,'exceptions.AttributeError',
"'function' object has no attribute 'lower'",
[{<<"/anaconda/lib/python2.7/site-packages/pandas/core/format.py">>,
1701,<<"detect_console_encoding">>,
<<"if not encoding or 'ascii' in encoding.lower(): # try again for something bette"...>>},
{<<"/anaconda/lib/python2.7/site-packages/pandas/core/config_init.py">>,
234,<<"<module>">>,
<<"cf.register_option('encoding', detect_console_encoding(), pc_encoding_doc,">>},
{<<"/anaconda/lib/python2.7/site-packages/pandas/__init__.py">>,
25,<<"<module>">>,<<"import pandas.core.config_init">>},
{<<"/Documents/data-algorithms/Alg"...>>,
3,<<"<module>">>,<<"import pandas as pd">>},
{<<"/Documents/testki"...>>,
237,<<"_incoming_call">>,
<<"f = __import__(module, {}, {}, [objects[0]])">>},
{<<"/Documents/te"...>>,
245,<<"_call_with_error_handler">>,<<"function(*args)">>}]}
in function erlport:call/3 (src/erlport.erl, line 234)
in call from algo_tester:start/0 (src/algo_tester.erl, line 27)
I can get rid of the error by commenting out the following two lines in /anaconda/lib/python2.7/site-packages/pandas/core/config_init.py:
234 cf.register_option('encoding', detect_console_encoding(), pc_encoding_doc,
235 validator=is_text)
but then print doesn't work any longer.
Has anyone encountered this before?
It was answered on GitHub:
ErlPort's issue: https://github.com/hdima/erlport/issues/11
Pandas' issue: https://github.com/pydata/pandas/issues/5687