Created
June 25, 2017 21:09
-
-
Save le-dawg/e5b0dc4b16cafe7014c1819c0c3e697c to your computer and use it in GitHub Desktop.
Python / Pandas snippets for the troubleshooting developer pt.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Count occurences of string in dataframe | |
#Check how many rows in DataFrame contain certain substring s in column col | |
print(len(df[df['col'].str.contains("s")].index.values[:])) | |
#Index of columns in dataframe containing string | |
#Get indices of rows that contain substring s in column col | |
print(df[df['col'].str.contains("s")].index.values[:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment