使用Panda的数据框结构错误

时间:2018-11-22 08:57:46

标签: python

我正在尝试一个数据框,当前我是从一个已经存在的数据框中获取值。 行“数据,如下所示:

01 03 55 55 55 55 55 55

并且我想将每个这些值分开;

但是d1变成3而不是1,如附图所示。

data frame

row ['data']是图片中该数据框中的值;

data frame include row 'data'

data = StringIO(row['data'])
df_data = pd.read_csv(data, delimiter=' ', names=['d1', 'd2', 'd3', 'd4', 'd5', 'd6',
                                                                         'd7', 'd8'])

我也尝试使用read_table,但结果相同

2 个答案:

答案 0 :(得分:0)

如果它是public class RegisterViewModel { private readonly DataService dataService = new DataService(); public string Email { get; set; } public string Password { get; set; } public string ConfirmPassword { get; set; } public string Message { get; set; } public ICommand RegisterCommand { get { return new Command(async () => { var isRegistered = await dataService.RegisterUserAsync(Email, Password, ConfirmPassword); Settings.Username = Email; Settings.Password = Password; if (isRegistered) { //DisplayAlert( "Alert" , "Registered", "OK"); //Message = "Registered Successfully :)"; // DependencyService.Get<Toast>().Show("You have registered succefully"); Application.Current.MainPage = new NavigationPage(new EntryPage()); } else { Message = " Retry Later :("; } }); } } } 文件,则可以使用:

.csv

答案 1 :(得分:0)

使用以下内容:

df = pd.read_csv(filename, delimiter=' ', names=['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8'], index_col=False)