I have a spreadsheet with data in following format:
CarID Day DistanceTraveled
Ford1 1 10
Ford1 2 12
Nissan1 1 13
Ford1 3 41
Nissan1 2 20
Nissan1 3 10
...
And so on. There are a few hundreds of records in format like this, with a few dozens of cars.
I have to transform it into a following format:
Day Ford1 Nissan1
1 10 13
2 12 20
3 41 10
Is it any fast and automatic way to achieve it in Excel?
Just for the sake of an answer:
Related
currently I have a dataframe with a column named age, which has the age of the person in days. I would like to convert this value to year, how could I achieve that?
at this moment, if one runs this command
df['age']
the result would be something like
0 18393
1 20228
2 18857
3 17623
4 17474
5 21914
6 22113
7 22584
8 17668
9 19834
10 22530
11 18815
12 14791
13 19809
I would like to change the value from each row to the current value/ 365 (which would convert days to year)
As suggested:
>>> df['age'] / 365
age
0 50.391781
1 55.419178
2 51.663014
3 48.282192
4 47.873973
Or if you need a real year:
>>> df['age'] // 365
age
0 50
1 55
2 51
3 48
4 47
In the attached image, I would like to sum the average of every week and show it in months. For example,
weeks no: 1 2 3 4 5 6 7 8 9 10
Numbers : 12 15 16 5 8 9 45 78 8 96
Show the average of the week in month.
Thanks for help.
Cheers
Hosein
The following formula will give you the average for each month for a given row:
=AVERAGEIFS($A$4:$V$4,$A$1:$V$1,">="&A9,$A$1:$V$1,"<="&EOMONTH(A9,0))
Here's the final result:
I'm hoping it's a good starting point.
I have a huge ass csv file like given below which I opened as dataframe using pandas. I want to extract data from multiple columns at different date sets.
I want to select from a particular date and hour to another for the last 3 column values. The slicing options I tried and googled were for single column.
date heure PM10 NO2 O3
0 01/01/2016 1 27 22 36
1 01/01/2016 2 25 29 27
2 01/01/2016 3 26 47 10
3 01/01/2016 4 16 40 13
4 01/01/2016 5 15 34 13
5 02/01/2016 1 15 34 13
6 02/01/2016 2 15 34 13
Target output - taking data from a particular data and hour to another one.
3 01/01/2016 4 16
4 01/01/2016 5 15
Thank you. The data set is obviously way bigger than 4 No.
You can do this:
df_selected = df[(df.date >= "01/01/2016") &
(df['hour']>=4) &
(df.date < "02/01/2016") &
(df['hour']<6)
].iloc[:,:3] #first three columns
Alternatively, for the columns selection you can use .loc[:,['name', 'of', 'columns']] or for the last n columns .iloc[:,-n:].
Be careful with date because I'm not sure what happens with an "English" date, maybe you have to change the date using df['date'] = pd.to_datetime(df.date).
When I create a pivot table from data in Pandas (python), I get an other result than when I create it with Excel. I think this is due to the fact of characters. Someone knows the difference between the pivot table in Pandas and Excel?
I've made this example. I have the excel file 'funds_steven' with following data in 1 column. (column name = Steven_Funds)
Steven_Funds
0 100
1 -58
2 89
3 24
4 -89
5 76
6 -4
7 -180
8 767
9 0
10 0
11 56
12 32
13 0
14 0
15 12
How can I read this in and calculate the sum of the values?
I have the following in Excel
Date Connections
2013-10-16 6
2013-10-17 18
2013-10-18 16
2013-10-19 10
2013-10-21 9
2013-10-22 1
2013-10-23 33
2013-10-24 38
2013-10-25 15
2013-10-26 20
2013-10-27 12
2013-10-28 9
2013-10-29 7
2013-10-31 2
2013-11-01 4
2013-11-02 1
2013-11-03 1
2013-11-04 2
2013-11-05 6
2013-11-06 15
2013-11-07 11
2013-11-08 13
2013-11-09 16
2013-11-10 9
2013-11-11 20
2013-11-12 2
I am trying to do a column chart that shows connections per date.
Just selecting the cells and clicking chart gives
I can right click the respective axis and format to get this:
But that only shows the calue for the last date, how do I get it to show all data?
I have googled for a while now but it just seems to add to the confusion.
Turns out that this was due to faulty formatting of the date column when importing the data.
Importing the column as text and then converting it to date and everything works as expected.