bar

How to take column-slices of dataframe in pandas

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 选择语言 中文(简体) 日语 英语 中文(繁体) 由 翻译 强力驱动 问题: I load a some machine learning data from a csv file. The first 2 columns are observations and the remaining columns are features. Currently, I do the following : data = pandas . read_csv ( 'mydata.csv' ) which gives something like: data = pandas . DataFrame ( np . random . rand ( 10 , 5 ), columns = list ( 'abcde' )) I'd like to slice this dataframe in two dataframes: one containing the columns a and b and one containing the columns c , d and e . It is not possible to write something like observations =

iOS 5 custom tab bar image vertical alignment

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting some odd behaviour with my custom tab bar. The images seem to be aligned incorrectly. Here is a screenshot (I have removed my own tab bar background to highlight my problem): Here is the code I'm using to set the images for each state: self.tabBarController = [[[UITabBarController alloc] init] autorelease]; self.tabBarController.viewControllers = [NSArray arrayWithObjects:homeNavController, whatsOnNavController, mapNavController, infoNavController, nil]; self.tabBarController.delegate = self; // For iOS 5 only - custom tabs if (

Unable to parse TAB in JSON files

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am running into a parsing problem when loading JSON files that seem to have the TAB character in them. When I go to http://jsonlint.com/ , and I enter the part with the TAB character: { "My_String": "Foo bar. Bar foo." } The validator complains with: Parse error on line 2: { "My_String": "Foo bar. Bar foo." ------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' This is literally a copy/paste of the offending JSON text. I have tried loading this file with json and simplejson without success. How can I load this

Change action bar color in android

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the app theme Theme.Black in my app. In this theme the action bar is gray. How I can change color of my action bar? This is my attempt: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="mytheme" parent="@android:style/Theme.Black" > </style> <style name="Widget.MyApp.ActionBar" parent="@android:style/Widget.ActionBar"> <item name="android:background">@android:color/black</item> </style> </resources> However, it doesn't work. Any ideas? 回答1: ActionBar bar =

Cannot use string offset as an array in php

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to simulate this error with a sample php code but haven't been successful. Any help would be great. "Cannot use string offset as an array" 回答1: For PHP4 ...this reproduced the error: $foo = 'bar' ; $foo [ 0 ] = 'bar' ; For PHP5 ...this reproduced the error: $foo = 'bar' ; if ( is_array ( $foo [ 'bar' ])) echo 'bar-array' ; if ( is_array ( $foo [ 'bar' ][ 'foo' ])) echo 'bar-foo-array' ; if ( is_array ( $foo [ 'bar' ][ 'foo' ][ 'bar' ])) echo 'bar-foo-bar-array' ; (From bugs.php.net actually) Edit, so why doesn't the

pandas read_csv and filter columns with usecols

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a csv file which isn't coming in correctly with pandas.read_csv when I filter the columns with usecols and use multiple indexes. import pandas as pd csv = r"""dummy,date,loc,x bar,20090101,a,1 bar,20090102,a,3 bar,20090103,a,5 bar,20090101,b,1 bar,20090102,b,3 bar,20090103,b,5""" f = open('foo.csv', 'w') f.write(csv) f.close() df1 = pd.read_csv('foo.csv', index_col=["date", "loc"], usecols=["dummy", "date", "loc", "x"], parse_dates=["date"], header=0, names=["dummy", "date", "loc", "x"]) print df1 # Ignore the dummy columns df2 = pd

Explain why constructor inject is better than other options [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Setter DI vs. Constructor DI in Spring? 6 answers In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a paragraph says Spring included, provide a mechanism for ensuring that all dependencies are defined when you use Setter Injection, but by using Constructor Injection, you assert the requirement for the dependency in a container-agnostic manner" Could you explain with examples 回答1: A class that takes a required

Find a private field with Reflection?

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties where I have looked for an attribute, but never a private member field. What are the binding flags that I need to set to get the private fields? 回答1: Use BindingFlags.NonPublic and BindingFlags.Instance flags FieldInfo[] fields = myType.GetFields( BindingFlags

iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I keep getting the following errors: 2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar 2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar 2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get

iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I keep getting the following errors: 2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar 2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar 2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get