0

I just wanted to follow this plotly tutorial in which the author seem to use some test data. But in the article it does not say where I can get that test data from.

Also the plotly documentation does not seem so.

I tried to comment on the article which also did not work as this "hashnode" thing does not seem to work at all. I kind of cannot log in or something, and I cannot contact their customer support.

So if anyone knows how to obtain the test data that would be great. Please feel free to suggest some other forum for this question.

Alex
  • 41,580
  • 88
  • 260
  • 469
  • 1
    Seems like a documentation request better suited for an issue on the [Plotly GitHub](https://github.com/plotly/plotly.py/issues) page? In general if it is some random blog post you are at the mercy of the post's author to provide a fully self-contained example including necessary data. – Cory Kramer Aug 12 '22 at 13:46
  • ah plotly github. Yes did not think of that, and never saw it. Thanks – Alex Aug 12 '22 at 13:53
  • First cell in the tutorial is ``df_countries = px.data.gapminder()``. Isn't that your data ? – ThomaS Aug 12 '22 at 13:55
  • I do not get any output. I thought so first. Maybe I am doing something wrong? Need to install something extra? – Alex Aug 12 '22 at 13:57
  • Ah the tutorial IS incorrect. There is an error. It should be `print(df_countries). – Alex Aug 12 '22 at 13:58
  • But there is no graphical output. That is ALSO missing – Alex Aug 12 '22 at 14:00
  • 2
    See also [https://github.com/plotly/datasets](https://github.com/plotly/datasets) and [plotly.data package](https://plotly.com/python-api-reference/generated/plotly.data.html). – r-beginners Aug 12 '22 at 14:00
  • The referenced site is described on a cell-by-cell basis under the premise of jupyter notebook and jupyterlab. References can be made by data frame name only. – r-beginners Aug 12 '22 at 14:10
  • If that would work. If that would work. Started the very first example in jupyter lab, but either that first 3-line example takes more than 5 minutes(!) to complete, or I am still missing something... – Alex Aug 12 '22 at 14:18
  • Wow it really took about 5 minutes to complete. Wow. `plotly` does not seem to belong in the `performant` packages, does it? – Alex Aug 12 '22 at 14:19

2 Answers2

0

The article says:

Look at the following example as an aspiration you can achieve if you fully understand and replicate this whole tutorial with your data.

So the idea is to use any pandas.Dataframe of your choice, you can type your own from a string or take one from the internet, like the ones you can find on this website and open them with the following lines:

import pandas as pd

url: str = 'https://people.sc.fsu.edu/~jburkardt/data/csv/oscar_age_male.csv'
df: pd.DataFrame = pd.read_csv(url)
print(df)
0

If you already have plotly installed, px.data is included in the package, so everyone can easily utilize the datasets to plot.

import plotly.express as px
df_countries = px.data.gapminder()
print(df_countries.head(10))
###

enter image description here

And it won't take you long,

%timeit df_countries = px.data.gapminder()
4.89 ms ± 181 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
Baron Legendre
  • 2,053
  • 3
  • 5
  • 22