I'm trying to use vincent package to visualize my data (in pandas) in jupyter notebook, but have trouble in initial attempt ,here is the code I use (copied from the http://wrobstory.github.io/2013/10/mapping-data-python.html):
import vincent
import pandas
world_topo=r'world-countries.topo.json'
geo_data = [{'name': 'countries',
'url': world_topo,
'feature': 'world-countries'}]
vis = vincent.Map(geo_data=geo_data, scale=200)
vis.to_json('vega.json')
vis.display()
After I ran the code, nothing was displayed. I checked the type of the vis:
vincent.charts.Map
I'm not sure how to proceed here, I appreciate any input on this problem.
Not sure at which point of implementation of this you are.
Assuming you just used pip to install vincent and tried the code in PY IDLE , you might be missing 2 important steps:
AFIK vincent only generates jsons to be presented using Vega via Jupyter notebook.
To render with Vega You will need to install:
1) Jupyter and dependencies
2) Vega and dependencies
I was able to do so using these instructions.
Once jupiter launched, a window opens in the browser, I had to choose 'Python3' under 'new', and put code in the prompt on that page.
Alternately you can use this online Vega renderer. Please also see Vega docs
Note that it seems that vincent is not the latest technology for that purpose, their page points to Altair
Also, I noticed that the json that is generated in 'vega.json' from the code you posted, using the original data, does not render anywhere. That's also an issue, probably happens because it uses outdated format, but I am not sure.
I have limited experience with this technology but I was able to get graphs to render, specifically this, and it is also how it looked for me.
I know that this post is old but I found your error and I thought I would answer here to help future users of vincent as it has worked beautifully for me. I am working with the anaconda version of vincent and jupyter notebook.
First, you have to initialize vincent in your notebook
import vincent
vincent.core.initialize_notebook()
and your next problem is that your URL isn't actually pointing anywhere. For the world map topography you need:
world_topo="https://raw.githubusercontent.com/wrobstory/vincent_map_data/master/world-countries.topo.json"
A decent map printed out for me with those two exceptions.
Related
I am trying to plot my model with the data types with the following the code:
plot_model(model, to_file='model/model.png', show_dtype=True, show_shapes=True, show_layer_names=True)
However, I get an error that show_dtype is not an acceptable parameter even though it appears on the TensorFlow documentation: https://www.tensorflow.org/api_docs/python/tf/keras/utils/plot_model
This is the first time that I have run into this issue. It seems that this may be due to having an earlier release if you downloaded it from Anaconda Forge rather than something else like Pip. It is a simple fix, however.
Basically, you need to go into the library source file and edit it to the current version that is shown on the TensorFlow documentation page.
The link to the GitHub page that you will copy the Python code from is here: https://github.com/tensorflow/tensorflow/blob/v2.5.0/tensorflow/python/keras/utils/vis_utils.py#L278-L348
Afterwards, head to your library path and paste that Python code there.
For example, my path is the following: C:/ProgramData/Anaconda3/envs/ml/Lib/site-packages/tensorflow/python/keras/utils/vis_utils.py. Yours should be something similar.
I am new to OSMnx and followed the steps from the website (https://github.com/gboeing/osmnx-examples/blob/master/notebooks/10-building-footprints.ipynb) on how to make a "Street network + building footprints: square-mile visualizations" map.
All I did was change the location name to teutopolis and change the coordinates to the town I am trying to map out, but it kept giving me a JSONDecodeError output. I added an image of what I input and the error output that it gave me. Being new to coding, I am not sure what this all means as I tried to search for an answer but did not understand.
Any help on how to fix this problem would be greatly appreciated.
Make sure you're using the latest version of OSMnx (0.8.1 as of this writing). This issue is documented on GitHub and was fixed/released two months ago.
I am new to Pandas, trying to learn the basics from lecture videos. In one of these the presenter demonstrates that one can call help on methods using ??.
For example if I have loaded a dataframe df then typing df.getitem?? should print the docstring as well as the source code to the console. This would be really great to have but it doesn't work for me! I tried different variants of the command and also tried to find a comment online on this, without success.
What do I need to type in order to retrieve the docstring as well as the source code of a Pandas method? Thanks a lot for your help !
(I am using Python 3.5 and PyCharm in case that makes a difference)
I believe that your lecturer was using ipython as this does support dynamic object information. For instance this is the output in ipython when you do df.__getitem__?? you see the following:
I strongly recommend ipython for interactive python development, you'll find a lot of devs using this for data exploration and analysis, the workbook is really useful for saving your commands and the output
I am increasingly irritated and frustrated by the Tensorflow documentation. I searched on google for documentation regarding
tf.reshape
I'm getting directed to a generic page like here. I want to see the details of tf.reshape and not the entirety of the documentation.
Am I doing something wrong here?
Do not Google about Tensorflow documentation, use the TensorFlow Python reference documentation and ctrl + f
The probably fastest way is to use the Tf documentation is:
http://devdocs.io/tensorflow~python/
Just type tf.reshape and you are done.
which can be also used offline and automatically updates the docs.
edit: even typing only res shows you the documentation.
Update for posterity:
With the new TensorFlow, the website is now indexed with Google, and it should also soon be indexed by other search engines.
I would suggest you use the GitHub repo as your documentation instead. https://github.com/tensorflow/tensorflow/tree/master/tensorflow/g3doc/api_docs/python/functions_and_classes
For example tf.reshape is in a single Markdown file https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md
To search for the document you want, you could use the GitHub search under that functions_and_classes folder.
An example is
tf.reshape() path:tensorflow/g3doc/api_docs/python/functions_and_classes language:Markdown
https://github.com/tensorflow/tensorflow/search?utf8=✓&q=tf.reshape%28%29+path%3Atensorflow%2Fg3doc%2Fapi_docs%2Fpython%2Ffunctions_and_classes+language%3AMarkdown&type=Code
which search for tf.reshape() under the documentation folder.
I use the non-official Dash/Zeal docset for TensorFlow:
https://github.com/ppwwyyxx/dash-docset-tensorflow
It is a very convenient way of browsing the TensorFlow documentation offline and it solves the problem you are describing.
Is this what you are looking for? Using the search functionality of the browser helped me find it.
I suppose that you have installed tensorflow in your computer and that you know the name of function that you may want to use.
So if you use some Python IDE, I think you can directly jump to the declaration or definition of this function and see the usage and explanation. That is the same documentation as online (although for some functions it is not very clear).
You can use the url for tensorflow documentation and add what you want to search..
The base url is:
https://www.tensorflow.org/api_docs/python/tf/
You can add what_ever_you_want_to_search after the /
Since Tensorflow r1.1 a search on google for items like 'tf.shape' now lists the appropriate page at the top of the search results.
This didn't work back in r0.10 and r0.11, maybe because there were many markdown formatting issues in the Tensorflow docs themselves.
Since you tf is developing best way is to go through the tf API. And it's good if you can follow these slides in http://web.stanford.edu/class/cs20si/
I'm pretty new with PyQt, but I just upgraded to the version 5 expecting that I could use the Qt3D (that is available with Qt5), but when I've tried to import the module it always says "Unresolved reference to Qt3d". So I've searched in the PyQt documentation and there is no reference of the Qt3D module, because of that I want to know:
is it possible to use Qt3D with PyQt5?
if so, how can I do it?
if not, wich other libraries can I use to make a 3D visualization of a 3D model imported another program like Blender.
(I tought about vPython, but I couldn't figure it out how to import from another file)
Update:
As ekhumoro pointed out, there is in fact support for it. See
https://www.riverbankcomputing.com/software/pyqt3d/intro
Doesn't seem to be the case, at least not yet.
On 23 Mar 2016, at 11:47 pm, Miguel Alejandro Fernandez wrote:
in the next version 5.6 include support for 3D libraries?
It won't be in PyQt v5.6. It might be in PyQt v5.6.1 if the documentation has improved.
Phil
From https://riverbankcomputing.com/pipermail/pyqt/2016-March/037147.html
You could try using VTK