'Python pandas - series to dataframe
.
How do I print out only the country names that exist in the dataframe among series with country names as index?
Solution 1:[1]
The following will filter for rows with an index value that is also in the index of df2 using .isin().
df1.loc[df1.index.isin(df2.index)]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rawson |
