Created
February 12, 2021 09:06
-
-
Save mebaysan/4ff1012f79da5e858c4b9a4f77ca2179 to your computer and use it in GitHub Desktop.
Pandas alt küme silme işlemi örneği
This file contains hidden or 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
############## Yöntem 1 ############## | |
istanbullar = sehirler[sehirler.sehir_ad.str.match('İstanbul*')] | |
mask = sehirler['sehir_ad'].isin(['İstanbul (Avrupa)', 'İstanbul (Anadolu)']) | |
sehirler = sehirler[~mask] | |
istanbullar.loc[:,'sehir_ad'] = 'İstanbul' | |
sehirler = pd.concat([sehirler,istanbullar]) | |
############## Yöntem 2 ############## | |
istanbullar = sehirler.loc[sehirler['sehir_ad'].str.contains('İst*')] | |
sehirler = sehirler.drop(istanbullar.index) | |
istanbullar.loc[:,'sehir_ad':'sehir_ad'] = 'İstanbul' | |
sehirler = pd.concat([sehirler,istanbullar]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment