필터 지우기
필터 지우기

How to delete rows with incomplete data in a csv file

조회 수: 17 (최근 30일)
ILoveML
ILoveML 2020년 2월 5일
답변: Neeraj Kulkarni 2020년 9월 15일
Have lots of csv files with the same data structure: 52 columns (some empty ones in between) and thousands rows.
Was wondering whether there is qucik way to delete the rows with incomplete data (meaning no data for some parameters/columns) and save the csv file with Matlab scripts.
For example, the attached data.csv file has incomplete data starting Row #29 (included) onwards. Thus, the script will delete Row #29 and above and save the csv file.
Thanks!
ILoveML

답변 (1개)

Neeraj Kulkarni
Neeraj Kulkarni 2020년 9월 15일
Hi,
Please refer to following example to clean messy and missing data in tables:
Below is an example code to remove incomplete rows:
dataTable = readtable('data.csv');
dataTable = rmmissing(dataTable);
writetable(dataTable,'data.csv');

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by