Crs setting in scikit mobility. Python - python

I am trying to use scikit mobility to recreate trajectories and stop location from GPS https://scikit-mobility.github.io/scikit-mobility/reference/data_structures.html#module-skmob.core.trajectorydataframe
By using TrajDataFrame and then I am applying
stdf = detection.stay_locations(tdf, stop_radius_factor=0.5, minutes_for_a_stop=20.0, spatial_radius_km=0.2, leaving_time=True)
my data looks the same as in example but I am getting the error ''TrajDataFrame' object has no attribute '_crs''. CRS is just optional and even when I added the error is appearing. Does anyone had the same issue?

This problem has been solved in the current version (v1.3.1), which works for versions of python >= 3.8.
If you are using it in Google Colab (for which version 3.8 is not available yet), after having installed scikit-mobility, you need to downgrade the pandas library to version 1.2.5:
!pip install pandas==1.2.5
Then, the problem should be solved. See also this solved issue: https://github.com/scikit-mobility/scikit-mobility/issues/204

Related

Visual Studio Code gives error when using Data Viewer: "Python package 'pandas' is required for viewing data"

I am running a python notebook in VS Code (see image). It runs fine but when I try to inspect a dataframe with the Data Viewer I get:
"Python package 'pandas' is required for viewing data."
The package is installed, otherwise, the code would not work and the data frames would not be present in the variable panel. When I click on "Install" I get: "Error: All data science packages require an interpreter be passed in"
I only have two environments, Anaconda and one created by VS code. I have tried selecting either one and nothing changes, code runs on both and I get the same errors on both.
Any ideas on how to fix this problem?
EDIT: The previous question Viewing data in the VSCode variable explorer requires pandas does not solve my issue. As mentioned above I have selected different environments without fixing it.
EDIT 2: Updating pandas did not fix it either. It was only solved by updating Anaconda, as suggested by Mrinal Roy.
This answer on a similar issue Viewing data in the VSCode variable explorer requires pandas mentioned it was fixed around a year ago.
It seems that the version.release string of pandas I was using includes characters that are not correctly parsed by the extension. They mentioned that it was going to be addressed yesterday in the Insider version. Looking forward to validating.
So, you probably have an older version of Anaconda or VS Code. Otherwise, what version of pandas do you have in both conda environments? VS Code Data Viewer requires pandas package 0.20 or later. Try upgrading it and related packages to the latest and check.

Unable to import todoist.api

Trying to access the todoist api, and I copied some code from the api documentation. However, on my system I get an error stating:
Unable to import 'todoist.api'pylint(import-error).
I installed it with:
pip install todoist-python
as mentioned in the documentation
from todoist.api import TodoistAPI
I get my error on the very first line. How do I not get this?
You did everything right, so it's probably related to the way your installation is set.
Be sure you are using the same python you used to install the library. Check if the library is installed (pip list) and check if you're using the right Python when running the code. It's possible that the library was installed in one version and you're using the other.
I had the same problem, I solved it by following the GitHub instructions, but the name of the module to install using pip is todoist.

Installed Pandas but Python still can't find module

I've tried installing Pandas in many different ways. Currently, it is installed using Anaconda and I have created a virtual environment. Below it shows that Pandas is installed, yet the module still can't be detected. Sorry if this has been answered before. I am still a beginner with Python.
Picture of current Terminal
maybe it doesn't match with the version you use which version you use?You can find it by pressing python in a terminal.Maybe you dont find it in the version you are using!

ANN_MLP missing attribute in python OpenCV3

I'm trying to run some sample OpenCV3 Neural Network code in Python.
import cv2
model = cv2.ml.ANN_MLP()
model.load('mlp.xml')
But this gives me the error:
module 'cv2.ml' has no attribute 'ANN_MLP'
But, there is such a class in OpenCV3 release notes http://docs.opencv.org/3.2.0/d0/dce/classcv_1_1ml_1_1ANN__MLP.html
and the code above did work on somebody's system since it is given as sample code.
I'm using Anaconda on Windows 10, with python 3.5.3 and opencv3 3.1.0.
What is going on?
Is there something obvious I'm missing here?
Does the python version of OpenCV3 not have the wrapper?
Did OpenCV3 python have a wrapper once upon a time and was removed in the newer versions?
You are getting this error beause the python version of OpenCV (i.e.) 3.1 is missing the load wrapper. You can confirm this by checking the following in the python REPL - dir(cv2.ml)
This has been resolved in ver 3.2.0+
In order to create a model by loading the ANN_MLP weights you need to do the following -
model = cv2.ml.ANN_MLP_load(filename)

Error while trying to install sklearn from Pycharm | arrayobject.h cannot be absolute

Complete error statement:
ValueError: path '/home/andy/anaconda3/lib/python3.5/sitepackages/numpy/core/include/numpy/arrayobject.h' cannot be absolute
I have installed Scipy and numpy (mkl) version by downloading the compiled wheel files from this link and then installing it from the cmd using pip.
I'm more of a python noob, my focus is primarily machine learning. Kindly help me out.
I encountered today a similar problem.
Do you use Python 3.6 (Latest version)?
If you do, you might consider downgrading (reinstalling actually) to Python 3.5.. apparently, sklearn has few problems supporting Python 3.6 at the moment.
I also installed NumPy and SciPy from link and got the same error when trying to install scikit-learn from PyPI. Installation scikit-learn from the same link solved the problem.
This is an error due to absolute paths to include files being found in the source, which cannot be automatically converted by distutils to the correct system path when compiling on windows.
The easiest way to fix this particular issue is to add a few lines of code to "util.py" in PYTHONPATH\lib\distutils\util.py. Add to the beginning of the function "convert_path"..
if pathname.startswith('/usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/'):
paths = pathname.split('/')
return 'C:\\Python36\\Lib\\site-packages\\numpy\\core\include\\numpy\\'+paths[-1]
hmm..maybe it wants a relative path i.e. ../include/numpy/ and not the absolute path which contains ../arrayobject.h

Categories

Resources