campusx-official / 100-days-of-machine-learning

1.24k stars 1.65k forks source link

df.append is not working in Standardization #36

Open AbdullahAssi opened 10 months ago

AbdullahAssi commented 10 months ago

6200 and name not in self._accessors 6201 and self._info_axis._can_hold_identifiers_and_holds_name(name) 6202 ): 6203 return self[name] -> 6204 return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'append'

having this error. So i got a solution for it. `data_to_append = {'Age': [5, 90, 95], 'EstimatedSalary': [1000, 250000, 350000], 'Purchased': [0, 1, 1]}

df_to_append = pd.DataFrame(data_to_append)

df = pd.concat([df, df_to_append], ignore_index=True)

print(df.describe())`

You can update the file, so others can't face this issue.

MayBPrince commented 10 months ago

hey abdullahassi. is I got the same error and it took me half an hour to resolve, is there is any way we can change the code, so others can't face the issue?

AbdullahAssi commented 10 months ago

hello MayBPrince,we can solve this problem by creating a branch and then PR to it could be fixed. but i already see 22 PRs open so i see that Repo is not being mentained by the owner.In this situation nothing we can do.

skon7 commented 9 months ago

The issue was caused by a compatibility problem with pandas versions greater than 2. : stackoverflow

KaushikDas9 commented 5 months ago

We can slove this issues by changing

df = df.append(df1,ignore_index=True)

this code with this code

df = pd.concat([df,df1],ignore_index=True)

saumyayadav25 commented 3 months ago

df.append() is deprecated in latest version of pandas.

new_data = {
    'Age': [5, 90, 95],
    'EstimatedSalary': [1000, 250000, 350000],
    'Purchased': [0, 1, 1]
}
df = pd.concat([df, pd.DataFrame(new_data)], ignore_index=True)

This should work