multiple-columns

Pandas adding Time column to Date index

北城余情 提交于 2019-12-10 13:28:57
问题 I have a dataframe, Date index type is Timestamp , Time column is datetime.Time : Time Value Date 2004-05-01 0:15 3.58507 2004-05-02 0:30 3.84625 ... How do I convert it to: Value Date 2004-05-01 0:15 3.74618 2004-05-01 0:30 3.58507 2004-05-01 0:45 3.30998 I wrote a code which does work, but it's not very pythonic: ind = frame.index.get_level_values(0).tolist() tms = frame['Time'] new_ind = [] for i in range(0, len(ind)): tm = tms[i] val = ind[i] + timedelta(hours=tm.hour, minutes=tm.minute,

Wrong column spacing due to multicolumn in latex

孤人 提交于 2019-12-10 11:55:37
问题 in the LaTeX table below, the third column gets too way much spacing due to the long \multicolumn cell in the last line. Can anyone think of a way of getting LaTeX to distribute the additional spacing needed evenly across columns? \documentclass[11pt]{article} \usepackage{booktabs} \begin{document} \begin{table}[htbp] \centering \begin{tabular}{lrrr} \toprule & ICE-GB & ICE-SING & ICE-EA \\ \midrule NP & 619 & 595 & 496 \\ \textbf{Arithmetic mean}& \textbf{1.36} & \textbf{1.33} & \textbf{1.22

sum of counts of different columns of same table

本小妞迷上赌 提交于 2019-12-10 11:54:27
问题 Given below table called table +---+---+ | x | y | +---+---+ | 1 | 2 | | 1 | 5 | | 5 | 2 | | 5 | 1 | +---+---+ I want to have sql query for the following results +----+-------------+ | id | count_total | +----+-------------+ | 1 | 3 | | 2 | 2 | | 5 | 3 | +----+-------------+ Note: I was able to count separately the rows per id but I could not get the sum for the same id. so I want to combine or get sum of below queries in a single query. SELECT x, count(*) as total_x FROM table GROUP BY x

CSS3 columns cutting off <li>s

随声附和 提交于 2019-12-10 07:53:18
问题 I am trying to use css3 columns with a list ( <li> ). I am having trouble making it work. I defined a div that wraps the <ul> div.ul-container { -moz-column-width: 310px; -moz-column-gap: 10px; -webkit-column-width: 310px; -webkit-column-gap: 10px; column-width: 310px; column-gap: 10px; } This works fine when I have three <li> s or above. But when I have less than that (2 or 1) it seems to cut off the <li> . I tried defining a min-height which didn't work as well (it treated it as height).

How to convert multiple columns to individual rows in R

给你一囗甜甜゛ 提交于 2019-12-09 06:30:23
问题 I have a data frame in R that has many rows (over 3000) with F0 (fundamental frequency) tracks of an utterance in it. The rows have the following information in them: speaker ID, group #, repetition #, accent type, sex, and then 50 columns of F0 points. The data looks like this: Speaker Sex Group Repetition Accent Word 1 2 3 4 105 M 1 1 N AILMENT 102.31030 102.31030 102.31030 102.31127 105 M 1 1 N COLLEGE 111.80641 111.80313 111.68612 111.36020 105 M 1 1 N FATHER 124.06655 124.06655 124.06655

Re-arrange multiple columns in a data set into one column using R

只愿长相守 提交于 2019-12-09 04:44:24
问题 I would like to combine three columns in one of my data sets into one with variable name "al_anim" and remove any duplicates, rank the values (animal ids) from lowest to highest, and re-number each animal from 1 to N under the variable name "new_id". anim1 <- c(1456,2569,5489,1456,4587) anim2 <- c(6531,6987,6987,15487,6531) anim3 <- c(4587,6548,7894,3215,8542) mydf <- data.frame(anim1,anim2,anim3) Any help would be very much appreciated! Baz 回答1: Using mydf from your example: mydf <- data

Python Pandas - Changing some column types to categories

北战南征 提交于 2019-12-09 04:08:25
问题 I have fed the following CSV file into iPython Notebook: public = pd.read_csv("categories.csv") public I've also imported pandas as pd, numpy as np and matplotlib.pyplot as plt. The following data types are present (the below is a summary - there are about 100 columns) In [36]: public.dtypes Out[37]: parks object playgrounds object sports object roading object resident int64 children int64 I want to change 'parks', 'playgrounds', 'sports' and 'roading' to categories (they have likert scale

Sequentially Rename 100+ Columns Having Idiosyncratic Names

我怕爱的太早我们不能终老 提交于 2019-12-09 03:56:02
问题 I have a large data frame imported from a Google Forms survey with very long column names (basically, the column names are the survey questions themselves). So, my imported data frame is like this: d<- data.frame(LongnameLongnameLongnameLongname=1:3,AnotherOneAnotherOneAnotherone=4:6, Etc_Etc_Etc_Etc_Etc=3:5) d GOAL: To replace these long, idiosyncratic column names with a sequential name, such as Q1, Q2, etc. 回答1: Use the colnames function: colnames(d) <- paste0("Q",1:ncol(d)) 来源: https:/

iphone: how make Multiple Columns in UITableView [duplicate]

自作多情 提交于 2019-12-09 03:38:12
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to display multiple columns in a UITableView? I have multiple rows and columns of data. But iPhone UITableView contains only single column and multiple rows. How do I display my multi column data following Apple's Human Interface Guidelines? Any ideas? 回答1: Use GridView for your this requirement, see this bellow links for the Demos and Tutorial ... Grid-View-in-IPhone-using-UITableView-1665 GMGridView

Multiple columns to UITableView in iOS

扶醉桌前 提交于 2019-12-09 01:28:47
问题 I am loading data into an array from MySQL, and I would like to populate them in UITableCiew . How can I add multiple columns (in my case 4) to UITableView ? I was able to load the row data but I do not understand how I can divide it up into columns. Is UICollectionView an option? If it is, how can I go about it? 回答1: UICollectionView is available in Available in iOS 6.0 and later and therefore cannot be used if you want to support earlier version. And as per your requirement you need to