Why was I friendzoned?

I have this friend that I liked so much
We were very close
We used to spend a lot of time just the 2 of us
We shared a lot values and opinions
I developed feelings for her and naturally I started acting like an idiot when I am around her
We used to talk about relationships and family and how we felt about our exes

One time when we were talking she told out of all her friends I am no 1


2 months ago I started having feelings for her
I told her everything 2 weeks ago
And she said she noticed the change in energy exactly at the exact time it started
Even though she thinks we have a lot I. Common , she also thinks we are incompatible and she was not interested in saying incompatibility reasons

And that is
We never talk , we never text and we never meet again

I could be wrong but What I feel right now :-
She doesn’t think I am good enough to be her partner

How can I avoid making the same mistake again?
How do I know that a female friend is only interested in being a friend
Why was I friendzoned?
Post Opinion