Oct-26-2019, 02:14 PM
(Oct-26-2019, 11:57 AM)snippsat Wrote: Yourcsv.file
link dos not work.
Can do it like this,it's nottype()
in pandas butdtypes
.
>>> import pandas as pd >>> df = pd.DataFrame({"x": ["a", "b", "c"], "y": [1, 2, 3], "z": ["d", "e", "f"]}) >>> df x y z 0 a 1 d 1 b 2 e 2 c 3 f >>> df.dtypes x object y int64 z object dtype: object >>> df = df.select_dtypes(exclude=['object']) >>> df y 0 1 1 2 2 3An other approach is to convert to correct types if that's needed.
>>> df = pd.DataFrame({"x": ["4", "5", "6"], "y": [1, 2, 3], "z": ["d", "e", "f"]}) >>> df x y z 0 4 1 d 1 5 2 e 2 6 3 f >>> df.dtypes x object y int64 z object dtype: object >>> df['x'] = df['x'].astype('int') >>> df.dtypes x int32 # Now integer y int64 z object dtype: object
Hi Thks for replying. I want to drop rows not columns ... hier ist the file file.csv
I want to drop rows that doesnt start/look like a date (although the dtypes is still an object and not dateimt64[ns])
Thks
Karlito