'How to filter in python? [duplicate]
enter image description here I am trying to do a filter within a column on a csv file. For the county_name column I want only the texas states. Similarly to how in excel I would filter to have the counties containing tx for that column. Any help on how to do so?
Solution 1:[1]
new_df =df.loc[df['county_name'].str.split(",")[1] == 'tx']
You can filter county_name col for tx and store it in a new_df like excel
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 | agastya teja |
