How to get 'Stage' Console Progress Bar in Jupyter Notebook?
Progress bar was displayed earlier, but somehow it is not displayed now. I couldn't relate it to an Nbextension either.
Let me know if there is any configuration available to enable it back.
[Stage X:==========> (A + B) / C]
Set spark.ui.showConsoleProgress to True docs
Related
Very simple question here.
I want to display a world map using python's folium library.
Here is the code I run to do so:
import folium
m = folium.Map(height=1000, width=1000, zoom_start=2)
m.save("folium_1000_1000_map.html")
I then open the saved folium_1000_1000_map.html in my browser (firefox), and here is the result:
The zoom_start option does not seem to work.
I would like the map to display like the next screenshot without having to click on the + button to zoom in once, like I have to at the moment.
I have tried to open the folium_1000_1000_map.html in chrome, it does not change anything. The zoom_start option seems to only work when a location parameter is specified, but this is not specified in folium doc. Any idea on how to work around this issue ? Thank you
And the answer, as simple as it gets, is:
import folium
m = folium.Map(location=[0,0], height=1000, width=1000, zoom_start=2)
m.save("folium_1000_1000_map.html")
I'm using Python 3.9 with the latest Selenium and have this code, which runs fine on my Mac, Chrome driver 101 headless instance of my script ...
element = self.driver.find_element(By.CSS_SELECTOR, "body")
actions = ActionChains(self.driver)
actions.move_to_element_with_offset(element, 0, 0).perform()
However, when I run this same code on my CentOS 7 instance, with chromedriver 99 (latest available), I get this error
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: move target out of bounds
E (Session info: headless chrome=99.0.4844.84)
/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:242: MoveTargetOutOfBoundsException
Any thoughts on what this means or what additional configurations I may need to make on my CentOS 7 setup? Happy to rewrite the code as long as it runs on both environments.
From Selenium documentation for MoveTargetOutOfBoundsException:
Indicates that the target provided to the actions move() method is invalid - outside of the size of the window.
From Actions class documentation:
moveByOffset​(int xOffset, int yOffset)
Moves the mouse from its current position (or 0,0) by the given offset.
This issue looks odd for me as we are talking about the body element, and somehow it is not in the visible part of your screeen,
you can try:
To scroll to your element - with JavaScript or Selenium
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
To wait until the element is loaded
Different offset - positive/negative.
Get the scrollheight/width of the window and the X and Y coordinates of the body - this can help you debug the issue.
document.body.scrollHeight
window.innerHeight
You can try to first click or hover the element.
References:
How to get the browser viewport dimensions?
https://www.lambdatest.com/automation-testing-advisor/selenium/classes/org.openqa.selenium.interactions.MoveTargetOutOfBoundsException
Selenium - MoveTargetOutOfBoundsException with Firefox
https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getLocation()
move_to_element_with_offset method is used to move the mouse by an offset of the specified element. Offsets are relative to the top-left corner of the element. In general, when we move any element manually at that time also, we need to click on the element then move it. Hope this will help, if not please let me know.
element = self.driver.find_element(By.CSS_SELECTOR, "body")
actions = ActionChains(self.driver)
actions.move_to_element_with_offset(element, 0, 0).click().perform()
When using featuretools is there a way to show a progress bar when running dfs?
Setting the parameter verbose=True in the dfs function call should give you a progress bar.
I have the following line of code:
display(df2.groupBy("TransactionDate").sum("Amount").orderBy("TransactionDate"))
Which according to this document:
https://docs.databricks.com/user-guide/visualizations/index.html#visualizations-in-python
Should give me a chart in Jupyter. Instead I get the following output:
DataFrame[TransactionDate: timestamp, sum(Amount): double]
How come?
Which according to this document
...
Should give me a chart in Jupyter.
It should not. display is a feature of a proprietary Databricks platform, not feature of Spark, so unless you use their notebook flavor (based on Zeppelin not Jupyter), it won't be available for you.
The title says it all : I can't get Spyder to display a map with folium.
Here is what I get :
import folium
m = folium.Map(location=[45.5236, -122.6750])
m
No error (and no map), just this :
< folium.folium.Map at 0xd03fcf8 >
m.render() # No idea what .render() it's supposed to do,
# but "render" sounds like maybe it could display the map, so I tried it.
# But it prints nothing
m.render
< bound method LegacyMap.render of < folium.folium.Map object at 0x000000000D03FCF8 > >
Any idea ?
Thanks
(Note : I tried this, with no success)
If you have a map m you could use:
m.save("mymap.html")
It saves your map in your working directory as html. You still have to open it manually in Chrome/IE. The advantage of this is that you can e-mail your map to anyone you want, even if he/she does not have python on his/her computer.
It seems folium generates web based maps, and those can't be rendered by Spyder. So you need to use the Jupyter notebook if you want to work with folium.
Also open the map directly from the spyder ide by importing webbrowser(provided you've install the webbrowser package).
import webbrwoser
webbrowser.open_tab("map.html")