Hi I want to append dictionary to DataFrame, but in this dictionary I dont have any index value. I also need to remove everything except "1393" from 'KP' value. This looks like this:
To this df:enter image description here
I want to append dictionary like this:
dict = {'KP': [1.0 1393
Name: KP, dtype: int64],
'Wiek': [Timedelta('176 days 12:59:43.042156102')],
'KY1': [113.0],
'OKO': [57.51],
'GS': [10.59],
'T': [654.31],
'MP': [58.9]}
I try this:
df.append(dict,ignore_index=True)
But nothing happend, df is still the same and i dont get any error. I try to convert this dictionary to list and append list as row to df but I got the same result.
Ok i try this:
df = df.append(dict, ignore_index = True)
I get this output: enter image description here
This is not good enought i need clear data.
df = df.append(dict, ignore_index = True).df1 = pd.DataFrame(dict)and then append:df = df.append(df1, ignore_index = True). Btw usingdictas a variable name is highly non-recomended as dict is a built-in keyword; also please never post images of dataframes, post them as text as explained in here: stackoverflow.com/questions/20109391/…df.loc[len(df)] = dict. See this answer.