Python Forum
[solved] duplication in pandas - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: [solved] duplication in pandas (/thread-40686.html)



[solved] duplication in pandas - BSDevo - Sep-06-2023

Missed some white space again.

Hi, im new to Python and Pandas.
Im trying to drop duplicates from my dataframe but something is wrong.
Im using Streamlit, Pandas , Python 3.11.
I have duplication on USA states . not all of them but instead of 48 i have 65. I dont have Hawaii and Alaska so should be 48.
Ive tried to use drop_duplicates() command but used column not with a states but with a column containing unique numbers and it looks like no duplicates where found ( easiest way to go trough 700 records )
Basically it counts like two separate entities ( if i understand correctly )


PState     687 non-null    object  
Linke bellow shows Barc chart with duplication.
https://imgur.com/a/zLsP08K



Edit: P.s.
 PState = st.sidebar.multiselect(
    "Select Pick Up State:",
    options=df["PState"].unique(),
    default=df["PState"].unique()
)
Shows same as image i posted. 2x IL , 2x TX etc.
Thank You.