Reputation: 3161
I have 2 csv files with similar columns. I am reading and concatenating them with the following code:
One = pd.read_csv("/Users/xxx/Documents/Domains/Malaysia - MAR.csv" )
Two = pd.read_csv("/Users/xxx/Documents/Domains/Malaysia - CR.csv" )
links_webtrends_my = pd.concat([One,Two])
links_webtrends_my = links_webtrends_my['Page']
links_webtrends_my = links_webtrends_my.to_frame(name='Page')
I then use this line to drop duplicates
links_webtrends_my = links_webtrends_my.drop_duplicates(keep='first', inplace=True)
When I do this, it deletes everthing in it. When I call links_webtrends_my
afterwards, it doesnt return anything. I will appreciate guidance on this.
Upvotes: 4
Views: 1248
Reputation: 153460
When using inplace=True
the return object is NoneType. Remove the assignment back to the variable when using inplace=True
.
links_webtrends_my.drop_duplicates(keep='first', inplace=True)
OR remove the inplace=True parameter.
links_webtrends_my = links_webtrends_my.drop_duplicates(keep='first')
Upvotes: 3