Regarding the format

header_names=[“Id”,“Target”]
submission_file=pd.read_csv(“submit.csv”,header=None,names=header_names)
This is the format I am using to submit my data but my output is not coming as expected
help me out

Also I want to remove the first row as it came becoz I used stacking but in the output it is not required

hey @bhavyahoda ,
did you checked the letter cases of headers , is it same ?

1 Like

I will check the cases but how to change id name to the index column and target to the column where my id is currently
because target column of NaN is unwanted

use code:
df = df.drop("Target",axis=1).rename(columns={'id':"Target"})
df = df.drop(0).reset_index(drop=True)
df=df.reset_index()
df.columns = ['Id','Target']
df.to_csv("name.csv",index=False)

It will do you task.
I hope this would have helped you.

1 Like

nope still I am getting 3 columns
instead of 2

can you provide me with the csv file , any link to it.

1 Like

https://drive.google.com/file/d/1Bj_0X0HBkA_rjnSOmzqORBnFGAotqvEi/view?usp=sharing

in this csv file.
implement these lines

df = pd.read_csv("submit.csv")
df.columns = ['Id','Target']
df.to_csv("name.csv",index=False)

1 Like

ya now I am able to get the required format
but still I am getting error submission
I am sharing my Jupiter notebook in this link
help me out with this
https://drive.google.com/file/d/1Mmmh6z-qZrdccn6oYDuG8lVborbEuLGf/view?usp=sharing

what error are you getting ?
the format of file is correct

1 Like

I think the y_test_predicted needs the test data instead of the training data
in the last 4th column but when I am putting test_data there it is throwing an error
Also the error I am getting is “ERRORED” while submitting the csv file on onlinecodingblocks

yes.

it might be due to r2 score. It might be coming negative on submission.

1 Like

but if I edit it as test_data
it is throwing error still

check this notebook.
https://colab.research.google.com/drive/1gUGlIur2PSwjU3waP44rl73MVGgbw52j?usp=sharing.

I have updated the code a bit for submission.

1 Like

okay yeah I got the correct answer 96% accurate
thank u @prashant_ml
There was a typo in my previous submission now I improved it and got the answer

That’s good now. No problem.
Once understand the code too.

Okay.

1 Like

yeah I got the changes u made
and thanks for the help
@prashant_ml

now i guess your doubt is resolved.
I request you to kindly mark this doubt as resolved and also provide your valuable feedback as it helps us to improve this platform.

Thank You and Happy Learning :slightly_smiling_face:.