Replace NaNs with 0 in dataframe

This commit is contained in:
Tobias Eidelpes 2021-05-14 14:44:19 +02:00
parent 4c05f0ccd7
commit c4dc23a9f8

View File

@ -9,7 +9,7 @@ IMPORTANT: Remove leading space from column '# Bytes' in csv file or pandas
won't read it correctly. won't read it correctly.
''' '''
dataset = pd.read_csv('./global_last10years.csv', index_col=0).dropna() dataset = pd.read_csv('./global_last10years.csv', index_col=0).fillna(0)
# Convert unix timestamps to dates # Convert unix timestamps to dates
timestamps = mdate.epoch2num(dataset.index) timestamps = mdate.epoch2num(dataset.index)
@ -29,7 +29,7 @@ ts_uIPd = dataset.iloc[:,3]
### rep-14: Signals correlation ### ### rep-14: Signals correlation ###
print('Correlations between different columns (NaNs filtered):') print('Correlations between different columns (NaNs replace with 0):')
print(dataset.corr(method='pearson').round(decimals=2)) print(dataset.corr(method='pearson').round(decimals=2))
### rep-15: Destinations/Sources ratio ### ### rep-15: Destinations/Sources ratio ###