Last message 5/26/2022 10:36 pm
The problem converting with dtype to float is the symbol ‘.’ for missing value
Although I have converted them to NaNs
stirs = pd.read_csv(r’C:/Users/Owner/Documents/Research/SOMA/FRED_reserves/SOMArates4.csv’,
na_values=" ", usecols=[0,1,2,3,4,5],dtype={‘RPONTSYD’: float, ‘RRPONTSYD’: float, ‘RPTSYD’: float, ‘EFFR’: float}, parse_dates=[‘DATE’]).fillna(value=0)
dt = np.dtype(np.int32)
DATE EFFR RPONTSYD RRPONTSYD RPTSYD RRPTSYD
stirs.replace(‘.’, np.nan, inplace=True)
stirs = stirs.replace(r’^\s*$', np.nan, regex=True)
stirs.info()
stirs.columns = stirs.columns.str.strip()
stirs[‘DATE’] = pd.to_datetime(stirs[‘DATE’])
stirs[‘DATE’] = pd.to_datetime(stirs[‘DATE’], format=“%Y%m%d”)
date = stirs.loc[0:, “DATE”]
effrate = stirs.loc[:,“EFFR”]
eff = float(effrate)
TypeError: cannot convert the series to <class ‘float’
I’ll work on this tomorrow 5/27/2022
···
Nancy Hammond, Ph.D
nahammond@gmail.com
312.989.3854