Jump to content

Python

  • entries
    66
  • comments
    0
  • views
    992

Pandas DataFrame Sütünların Veri Tiplerine Göre Filtreleme


Doğuhan ELMA

63 views

Pandas Dataframe sütünları farklı veri tiplerinde olabilir. Değerlendirme yada topluca işlem yapmak için aynı veri tipi sütünlarını seçmek isteyebiliriz.

import pandas as pd
import numpy as np

url = "https://raw.githubusercontent.com/TrainingByPackt/Big-Data-Analysis-with-Python/master/Lesson01/RadNet_Laboratory_Analysis.csv"
df = pd.read_csv(url, sep=',')


filtered_dict = {key for key, value in dict(df.dtypes).items() if value == 'object'} #int64,int32,float vb.

print(df[list(filtered_dict)].head())

 Çıktı:

Sample Type    Unit Date Collected State Location Date Posted
0  Air Filter  pCi/m3     03/23/2011    ID    Boise  03/30/2011
1  Air Filter  pCi/m3     03/23/2011    ID    Boise  03/30/2011
2  Air Filter  pCi/m3     03/23/2011    AK   Juneau  03/30/2011
3  Air Filter  pCi/m3     03/22/2011    AK     Nome  03/30/2011
4  Air Filter  pCi/m3     03/23/2011    AK     Nome  03/30/2011

 

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...