baecce5a6fbe4576ca8348a93dc56f07e7ba84f6,niftynet/contrib/csv_reader/csv_reader.py,CSVReader,_parse_csv,#CSVReader#Any#Any#,72

Before Change


    def _parse_csv(self, path_to_csv, to_ohe):
        tf.logging.warning("This method will read your entire csv into memory")
        df = pd.read_csv(path_to_csv)
        if df.columns[0] != "subject_id" and len(df.columns) >= 2:
            tf.logging.fatal(
                "The first column of the csv should be called "subject_id" and there should be at least 2 columns"
            )
        df.index = df["subject_id"]
        assert set(df.index) == set(self.subject_ids)
        df = df.loc[self.subject_ids]
        if to_ohe and len(df.columns[1:])==1:

After Change


        tf.logging.warning("This method will read your entire csv into memory")
        df = pd.read_csv(path_to_csv, index_col=0, header=None)
        if set(df.index) != set(self.subject_ids):
            print(set(self.subject_ids) - set(df.index))
            tf.logging.fatal("csv file provided at: {} does not have all the subject_ids".format(path_to_csv))
            raise Exception
        if to_ohe and len(df.columns)==1:
            _dims = len(list(df[1].unique()))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: NifTK/NiftyNet
Commit Name: baecce5a6fbe4576ca8348a93dc56f07e7ba84f6
Time: 2019-06-05
Author: ucabtmv@ucl.ac.uk
File Name: niftynet/contrib/csv_reader/csv_reader.py
Class Name: CSVReader
Method Name: _parse_csv


Project Name: keras-team/autokeras
Commit Name: b1bfd16945a658d02847209e46a2ba8d72b456e1
Time: 2019-07-01
Author: jhfjhfj1@gmail.com
File Name: autokeras/hypermodel/hyper_head.py
Class Name: RegressionHead
Method Name: build


Project Name: Picovoice/porcupine
Commit Name: 6ea0b2b297af473ac73b98938f561a06b63a6bd9
Time: 2020-10-01
Author: alireza@picovoice.ai
File Name: demo/python/porcupine_demo_mic.py
Class Name: PorcupineDemo
Method Name: run