Every line of 'remove nan from dataframe' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
85 @pytest.fixture 86 def df_nan_col_removed(self, df_with_nan): 87 df = df_with_nan 88 df["timestamp"] = df.index * 1000 89 col_removed_df, mask = preprocessing.remove_nan_columns(df) 90 return col_removed_df, mask
19 def fill_missing_values(df_data): 20 """Fill missing values in data frame, in place.""" 21 df_data.fillna(method="ffill", inplace="True") 22 df_data.fillna(method='bfill', inplace="True")
88 def normalize(dataframe): 89 """Centers and scales each column in the data frame to zero mean and unit variance. 90 91 Args: 92 dataframe (pandas.DataFrame): Input dataframe. 93 94 Returns: 95 pandas.DataFrame: Normalized dataframe. 96 """ 97 dataframe = dataframe.set_index("timestamp") 98 dataframe = (dataframe - dataframe.mean()) / dataframe.std() 99 return dataframe.reset_index()
259 def drop_some(df_: pd.DataFrame, thresh: int) -> pd.DataFrame: 260 # thresh is the minimum number of NA, the 1 indicates that columns should be dropped not rows 261 return df_.dropna(1, thresh=thresh)