Tried making a web app in python, got this error

import streamlit as st
import pandas as pd
import base64
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

st.title('NBA Player stats explorer')

st.markdown("""
This app performs simple webscraping of NBA player stats data!
* **Python libraries:** base64, pandas, streamlit
* **Data source:** [Basketball-reference.com]
(https://www.basketball-reference.com/).
""")

st.sidebar.header('User input features')
selected_year = st.sidebar.selectbox('Year',
                                     list(reversed(range(1950, 2020))))


@st.cache
def load_data(year):
    url = "https://www.basketball-reference.com/leagues/NBA_" + str(year) + "_per_game.html"
    html = pd.read_html(url, header=0)
    df = html[0]
    raw = df.drop(df[df.Age == 'Age'].index)  # deletes repeating headers in content
    raw = raw.fillna()
    playerstats = raw.drop(['Rk'], axis=1)
    return playerstats


playerstats = load_data(selected_year)

# Sidebar - Team selection
sorted_unique_team = sorted(playerstats.Tm.unique())
selected_team = st.sidebar.multiselect('Team',
                                       sorted_unique_team, sorted_unique_team)

# Sidebar- position selection
unique_pos = ['C', 'PF', 'SF', 'PG', 'SG']
selected_pos = st.sidebar.multiselect('Position', unique_pos,
                                      unique_pos)

# Filtering data
df_selected_team = playerstats[(playerstats.Tm.isin(selected_team)) &
                               (playerstats.Pos.isin(selected_pos))]

st.header('Display Player Stats of Selected Team(s)')
st.write('Data Dimension: ' + str(df_selected_team.shape[0]) +
         ' rows and ' + str(df_selected_team.shape[1]) + 'columns.')

st.dataframe(df_selected_team)


def filedownload(df):
    csv = df.to_csv(index=False)
    b64 = base64.b64encode(csv.encode()).decode()  # string to byte conversion
    href = f'<a href="data:file/csv;base64, {b64}" download="playserstats.csv">Download CSV File</a>'
    return href


st.markdown(filedownload(df_selected_team),
            unsafe_allow_html=True)

# heatmap
if st.button('Intercorrelation Heatmap'):
    st.header('Intercorrelation Matrix Heatmap')
    df_selected_team.to_csv('output.csv', index=False)
    df = pd.read_csv('output.csv')

    corr = df.corr()
    mask = np.zeros_like(corr)
    mask[np.triu_indices_from(mask)] = True
    with sns.axes_style("white"):
        f, ax = plt.subplots(figsize=(7, 5))
        ax = sns.heatmap(corr, mask=mask, vmax=1, square=True)
    st.pyplot()

The issue is right there in the trace. You have called raw.fillna() but this method needs at least one argument. You need to tell it what to fill NaN with. Check out the docs:

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.fillna.html?highlight=fillna#pandas.DataFrame.fillna

Please copy and paste the error message as text, not an image.

@sonotley:

Not according to the docs you linked to. All the parameters have a default value, and there is no mention that anything is mandatory. If you believe the docs, the default of value=None should be fine.

You may very well be correct, but the docs don’t say so.

If you look at the source, there is no sign of anything raising the error message seen.

(Try searching for “Must specify a fill”, and nothing comes up.)

Good point regarding the docs. I did find it in the code (in _validators.py)and it makes logical sense, but could be usefully clarified in the docs.


def validate_fillna_kwargs(value, method, validate_scalar_dict_value=True):
    """
    Validate the keyword arguments to 'fillna'.
    This checks that exactly one of 'value' and 'method' is specified.
    If 'method' is specified, this validates that it's a valid method.