Skip to content

Commit

Permalink
fix for streamlit#618: pandas and numpy import unification in examples (
Browse files Browse the repository at this point in the history
  • Loading branch information
QtRoS authored and tvst committed Nov 7, 2019
1 parent 5f3f902 commit 9d94eca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions docs/advanced_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interactive table.
```

```Python
dataframe = numpy.random.randn(10, 20)
dataframe = np.random.randn(10, 20)
st.dataframe(dataframe)
```

Expand All @@ -58,8 +58,8 @@ some elements in the interactive table.
```

```Python
dataframe = pandas.DataFrame(
numpy.random.randn(10, 20),
dataframe = pd.DataFrame(
np.random.randn(10, 20),
columns=('col %d' % i for i in range(20)))

st.dataframe(dataframe.style.highlight_max(axis=0))
Expand All @@ -69,8 +69,8 @@ Streamlit also has a method for static table generation:
[`st.table()`](api.html#streamlit.table).

```Python
dataframe = pandas.DataFrame(
numpy.random.randn(10, 20),
dataframe = pd.DataFrame(
np.random.randn(10, 20),
columns=('col %d' % i for i in range(20)))
st.table(dataframe)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data to your app with very few keypresses. Here's an example:
This is some _markdown_.
'''

df = pandas.DataFrame({'col1': [1,2,3]})
df = pd.DataFrame({'col1': [1,2,3]})
df # <-- Draw the dataframe

x = 10
Expand Down
20 changes: 10 additions & 10 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Streamlit.
import streamlit as st
# To make things easier later, we're also importing numpy and pandas for
# working with sample data.
import numpy
import pandas
import numpy as np
import pandas as pd
```
3. Run your app. A new tab will open in your default browser. It'll be blank
for now. That's OK.
Expand Down Expand Up @@ -104,7 +104,7 @@ will figure it out and render things the right way.

```Python
st.write("Here's our first attempt at using data to create a table:")
st.write(pandas.DataFrame({
st.write(pd.DataFrame({
'first column': [1, 2, 3, 4],
'second column': [10, 20, 30, 40]
}))
Expand Down Expand Up @@ -139,7 +139,7 @@ with this snippet:
Here's our first attempt at using data to create a table:
"""

df = pandas.DataFrame({
df = pd.DataFrame({
'first column': [1, 2, 3, 4],
'second column': [10, 20, 30, 40]
})
Expand All @@ -165,8 +165,8 @@ You can easily add a line chart to your app with
sample using Numpy and then chart it.

```Python
chart_data = pandas.DataFrame(
numpy.random.randn(20, 3),
chart_data = pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c'])

st.line_chart(chart_data)
Expand All @@ -179,8 +179,8 @@ Let's use Numpy to generate some sample data and plot it on a map of
San Francisco.

```Python
map_data = pandas.DataFrame(
numpy.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
map_data = pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=['lat', 'lon'])

st.map(map_data)
Expand All @@ -201,8 +201,8 @@ conditional statement.

```Python
if st.checkbox('Show dataframe'):
chart_data = pandas.DataFrame(
numpy.random.randn(20, 3),
chart_data = pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c'])

st.line_chart(chart_data)
Expand Down

0 comments on commit 9d94eca

Please sign in to comment.