Pandas // NSObject class
@interface Groceries : NSObject
@property (nonatomic, strong) NSMutableArray *groceryList;
@end
// First VC
#import "Groceries.h"
@interface TableViewController ()
@property (nonatomic, strong) Groceries *groceries;
@end
@implementation TableViewController
- (void)viewDidLoad {
[super viewDidLoad];
_groceries = [[Groceries alloc]init];
}
// Second VC
#import "Groceries.h"
@interface AddItemViewController ()
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (nonatomic, strong) Groceries *groceries;
@end
@implementation AddItemViewController
- (void)viewDidLoad {
[super viewDidLoad];
_groceries = [[Groceries alloc]init];
}
// When I press the return button, I'm popping back to First VC
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if([text isEqualToString:@"\n"]) {
[[_groceries groceryList]addObject:_textView.text];
[textView resignFirstResponder];
[[self navigationController]popViewControllerAnimated:YES];
return NO;
}
return YES;
}
@end
正在将整数转换为浮点数。如何禁用此功能?
我已设置to_csv()
但问题相同。
答案 0 :(得分:2)
pd.to_csv()
通常不会转换为float
。您是否有可能在此专栏中有np.nan
?如果您这样做,则此列的dtype将为float64
。
在其他np.nan
或int
列中引入bool
时,整个列都会投放到float
。
我希望有所帮助!