熊猫元数据中缺少列名

时间:2020-06-29 20:30:21

标签: python pandas

我正在尝试将DataFrame转换为json。但是,当我尝试基于某些列创建键时,intertuples函数会更改其名称。我已经粘贴了DataFrame的图片,正在使用的代码以及下面的intertuples函数的输出:

DataFrame: enter image description here

代码:

viewDidLoad

#ifndef _BARCODESCANNERCONTROLLER_H_ #define _BARCODESCANNERCONTROLLER_H_ #import <UIKit/UIKit.h> #import "SystemHeader.h" #import "RunParameters.h" #import <RDPDFKit/RDPDFKit.h> #import "FormInfo.h" #import "PatientInfo.h" #import "GradientButton.h" #import "LogTextInfo.h" #import "FileIOSupport.h" #import "PadInfo.h" #import "XMLiPadAndDBSupport.h" #import "BarCodeScanSupport.h" #import "LogonInfo.h" #import "PadInfo.h" // ocr #import "TextScanPreviewView.h" // ocr #define YesIndex 0 // // With PDF coordintates, pixels are spot on so no shift // is needed. Keep these at 0 for now. // #define SCALE_Y_ADJUSTMENT_FACTOR 0 #define SCALE_X_ADJUSTMENT_FACTOR 0 #define XML_VERSION_STR "<?xml version=\"1.0\"?>" #define XML_HEADER_NAME "IFD" #define ResultCount "ResultCount" #define Result "Result" #define DoNotCheck @"DoNotCheck" #define DoNotValidate @"DoNotValidate" // // These enums are for determining the action needed when // an incorrect but valid bar code is scanned. // // // These enums are for determining the action needed when // an incorrect but valid bar code is scanned. // typedef enum IncorrectBarCodeStatusEnum { BCNotRecognized = 1, BCNotUsedButBelongsToAnotherForm, BCAlreadyUsedByAnotherForm, BCIsOK } IncorrectBarCodeStatusEnum; @interface ReturnResultBarCodeStatus : NSObject @property (strong, nonatomic) FormInfo * formWhereBarCodeFound; @property (assign, nonatomic) IncorrectBarCodeStatusEnum incorrectBarCodeStatus; @end @interface BarCodeScanController : UIViewController <UIAlertViewDelegate> // Merck2 { BOOL isScanModeOn; UIColor *borderColorDefault; UIColor *viewBackgroundColorDefault; CGPoint lineStartingPoint; CGPoint lineEndingPoint; int barCodeImageViewUpperYCoordinate; DecoderResult * decoder; // ocr NSString * textScanResult; } // // This contains this page's pixel values that are read // from the xml incoming DBToPad file. // @property (strong, nonatomic) Barcode * barCode; @property (strong, nonatomic) PatientInfo * patient; @property (strong, nonatomic) FormInfo * form; @property (strong, atomic) PadInfo * pad; @property (strong, atomic) LogonInfo * logon; @property (strong, nonatomic) RDPDFDocument * pdfDocument; @property (strong, nonatomic) RDPDFDocumentView *pdfDocumentView; @property (strong, nonatomic) IBOutlet UIImageView * barCodeImageView; @property (strong, nonatomic) IBOutlet TextScanPreviewView * previewView3; @property (strong, nonatomic) IBOutlet UIView * cutoutView; @property (weak, nonatomic) IBOutlet GradientButton *submitButton; - (IBAction)submitButtonAction:(GradientButton *)sender; @property (weak, nonatomic) IBOutlet GradientButton *cancelButton; - (IBAction)cancelButtonAction:(GradientButton *)sender; @property (weak, nonatomic) IBOutlet GradientButton *scanButton; - (IBAction)scanButtonAction:(GradientButton *)sender; @property (weak, nonatomic) IBOutlet UILabel *formLabel; @property (weak, nonatomic) IBOutlet UILabel *barCodeResultLabel; @property (strong, nonatomic) BarCodeScanSupport *barCodeScanner; @property (strong, nonatomic) NSMutableArray *uniqueBarCodes; - (void) writeBarCodeResultsToXMLDataFile : (BOOL) dataFlag; - (void) determineIncorrectBarCodeCase : (NSString *) barCodeResult : (ReturnResultBarCodeStatus *) returnStatus; - (void) continueDecodeResultNotification; @end #endif `````` Controller "C" #import "BarCodeScanController.h" @implementation ReturnResultBarCodeStatus @synthesize formWhereBarCodeFound; @synthesize incorrectBarCodeStatus; @end @implementation BarCodeScanController : UIViewController @synthesize barCode; @synthesize form; @synthesize pad; @synthesize logon; @synthesize submitButton; @synthesize cancelButton; @synthesize scanButton; @synthesize barCodeImageView; @synthesize previewView3; @synthesize cutoutView; @synthesize pdfDocument; @synthesize pdfDocumentView; @synthesize barCodeScanner; @synthesize uniqueBarCodes; @synthesize barCodeResultLabel; @synthesize formLabel; // // This is temporary for the demo. Should read whats in the file // if we scanned on a page, srolled to another, and came back to // the scanned page. But for now, just . // static NSString * saveBarCodeResult; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [NSThread sleepForTimeInterval : 2.0]; [super viewDidLoad]; if (deviceIsIPad) { self.formLabel.text = [NSString stringWithFormat: @"%@",form.form]; } else { self.formLabel.text = [NSString stringWithFormat: @" %@",form.form]; } [self.cancelButton useAlertStyle]; [self.submitButton useAlertStyle]; [self.scanButton useAlertStyle]; if (self.form.displaySubmitButton == NO) { self.submitButton.hidden = YES; } else { self.submitButton.hidden = NO; } // // This creates an .ifd file with no data in it. The data base server requires // a file with valid data or null data for each vas page. So if the user // evenutally enters valid data, it will overwrite this. Creating the file here // is completely dependent on the user having to scroll to the end of the form // to do a submit. In doing so, every vas page must be passed along the way // which will initiate this call. If we ever go back to starting out with a // submit button on every page when the form is brought up, then we will have // to create a null .ifd file in the forms modal controller, which will mean // we will have to have duplicate functionality in both that controller and // this one. Note, later added code made sure file does not first exist. It // may already be there if there was a crash during the submit. In this case // don't write a null file, and set vsLineDrawn to YES. // // FileIOSupport * sandbox = [[FileIOSupport alloc] init]; if (![sandbox checkIfFileExistsAtPath : self.barCode.bcPngPathNameData]) { [self writeBarCodeResultsToXMLDataFile : NO]; } [[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(decodeResultNotification:) name: BarCodeResultNotification object: nil]; // ocr x // Comment out for text reader. // barCodeScanner = [[BarCodeScanSupport alloc] init : barCodeImageView : self // : self.barCode.bcFormat]; // ocr x // Comment out for text reader // self.barCodeImageView.image = [UIImage imageWithContentsOfFile : // barCode.bcPngPathNameImage]; [scanButton setTitle:Retry_Str forState:UIControlStateNormal]; // // Setting isScanModeOn works for both cases below. If we have a prior // result we don't start the scanner but put up the previous result and // image. If there is no prior result, we call the scanButtonAction code // to start the scanner. // isScanModeOn = NO; if (self.barCode.bcImageBuffer != nil) { self.barCodeResultLabel.hidden = NO; self.barCodeResultLabel.text = barCode.bcSelectedResult; self.barCodeResultLabel.backgroundColor = [UIColor yellowColor]; } else { self.barCodeResultLabel.hidden = YES; self.barCodeResultLabel.text = Blank; // // Start scanner // [self scanButtonAction : scanButton]; } // ocr // This normally gets allocatd in bar code scanner support which we are not // using for ocr. So allocate it here. We're only using the text part of it // so as to not disturb alot of code. // decoder = [DecoderResult alloc]; // ocr // Comment out for text reader // barCodeImageViewUpperYCoordinate = self.barCodeImageView.frame.origin.y; DISPATCH_TO_MAIN_THREAD // ocr x // Comment out for text reader // [self startScanning]; // [self performSegueWithIdentifier:TextReaderModalSegue sender:self]; DISPATCH_OUT_OF_MAIN_THREAD } . . . 的输出:

// ocr
#import "ObjectiveCTestWithSwift.h"
#import "BarCodeScanController.h"
#import "TextScanPreviewView.h"

0 个答案:

没有答案