Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Ordering of pandas DataFrame
Post: RE: Ordering of pandas DataFrame

Thank you.
new_to_python Data Science 5 2,356 Mar-15-2020, 06:08 PM
    Thread: Ordering of pandas DataFrame
Post: RE: Ordering of pandas DataFrame

Hi, anybody knows the answer?
new_to_python Data Science 5 2,356 Mar-15-2020, 02:27 PM
    Thread: Why any(0) does not work here?
Post: RE: Why any(0) does not work here?

Thanks
new_to_python General Coding Help 2 1,864 Mar-15-2020, 02:15 PM
    Thread: Why there is a star inside randn?
Post: RE: Why there is a star inside randn?

Understood. Thank you.
new_to_python General Coding Help 4 2,547 Mar-06-2020, 04:45 AM
    Thread: Why there is a star inside randn?
Post: RE: Why there is a star inside randn?

Thanks. How can I tell if size is an integer or a tuple of integers? Is the number of elements in the tuple corresponds to the dimension of the nd-array? For example if size is a tuple of (x, y), the...
new_to_python General Coding Help 4 2,547 Mar-05-2020, 02:20 PM
    Thread: Why there is a star inside randn?
Post: Why there is a star inside randn?

Hi, I have question about generating a linear model from random data. I suppose that by default, the value of size in the dnorm function is one. When this function is called with N=100, size becomes 1...
new_to_python General Coding Help 4 2,547 Mar-04-2020, 01:02 AM
    Thread: Using shift to compute the percent change in a time series
Post: RE: Using shift to compute the percent change in a...

Thanks
new_to_python Data Science 6 4,233 Mar-03-2020, 07:50 PM
    Thread: How to obtain values under All when the margins of pivot_table is set to True?
Post: How to obtain values under All when the margins of...

Hi, anybody knows how the values under All (both row and column) were calculated. I heard that by setting margins equals to True, the values under All are the group statistics. I added the values in t...
new_to_python Data Science 0 1,574 Mar-03-2020, 02:54 PM
    Thread: Using shift to compute the percent change in a time series
Post: RE: Using shift to compute the percent change in a...

Everything you wrote in Post#4 makes sense when we treat x as a time series data. For example, x[0] is the starting position of a dog. x[1] is the position 1s later, x[2] is its position 2s later, etc...
new_to_python Data Science 6 4,233 Feb-22-2020, 11:30 PM
    Thread: Using shift to compute the percent change in a time series
Post: RE: Using shift to compute the percent change in a...

Thanks. By using 1.207707 as the old value and -0.558628 as the new value, I got -1.462553 as calculated by ts/ts.shift(1)-1. How come 1.207707 is the old value? The original (old) value in ts on 200...
new_to_python Data Science 6 4,233 Feb-22-2020, 05:37 PM
    Thread: Using shift to compute the percent change in a time series
Post: Using shift to compute the percent change in a tim...

Hi, somebody mentioned that one could use ts/ts.shift(1)-1 to calculate the percent changes in a time series. I tried to understand this by hand calculating the percent changes on 2000-04-30. I got -3...
new_to_python Data Science 6 4,233 Feb-21-2020, 11:23 PM
    Thread: Why replace treats an integer value 999 as 999.0?
Post: RE: Why replace treats an integer value 999 as 999...

(Feb-11-2020, 07:49 PM)new_to_python Wrote: (Feb-11-2020, 02:54 PM)DeaD_EyE Wrote: import struct def double_to_bin(value): """ Convert an float to double (64 bit) binary representation ...
new_to_python General Coding Help 10 4,462 Feb-16-2020, 01:49 PM
    Thread: Does the order of columns in the DataFrame matter?
Post: RE: Does the order of columns in the DataFrame mat...

Thanks. I tried A_new = A.reindex(['Ohio', 'Colorado'], axis=1, level=1) but it returned: IndexError: Too many levels: Index has only 1 level, not 2
new_to_python Data Science 11 6,152 Feb-16-2020, 03:05 AM
    Thread: Does the order of columns in the DataFrame matter?
Post: RE: Does the order of columns in the DataFrame mat...

Thanks. I am trying to reorder the columns of DataFrame in line[236] of Post #5 manually. I did: A = df.unstack('state').stack('side') A = A[['Ohio', 'Colorado']]But I got ['Colorado'] not in index ...
new_to_python Data Science 11 6,152 Feb-15-2020, 02:05 PM
    Thread: Why replace treats an integer value 999 as 999.0?
Post: RE: Why replace treats an integer value 999 as 999...

Hi DeaD_EyE, the binary representation of 999 is: 1111100111 How come your code produced a very very long binary representation which is different from 1111100111?
new_to_python General Coding Help 10 4,462 Feb-14-2020, 07:11 PM
    Thread: Does the order of columns in the DataFrame matter?
Post: RE: Does the order of columns in the DataFrame mat...

Thanks scidam. In this case, what is the best way to change the order back to the original? So as long as I refer the columns by names (preferred method) or in the case of index based method use somet...
new_to_python Data Science 11 6,152 Feb-14-2020, 02:21 PM
    Thread: Does the order of columns in the DataFrame matter?
Post: RE: Does the order of columns in the DataFrame mat...

Thank you very much. By the way, what do you think is the cause of the re-ordering between Ohio and Colorado from Step 235 to 236? In [234]: df ...
new_to_python Data Science 11 6,152 Feb-14-2020, 01:36 AM
    Thread: Does the order of columns in the DataFrame matter?
Post: RE: Does the order of columns in the DataFrame mat...

Thanks. I came across the following example: # Example 2 In [194]: lefth = pd.DataFrame({'key1': ['Ohio', 'Ohio', 'Ohio', 'Nevada', 'Nevada'], ...: 'key2': [2000, 2001, 2...
new_to_python Data Science 11 6,152 Feb-13-2020, 05:12 PM
    Thread: Does the order of columns in the DataFrame matter?
Post: Does the order of columns in the DataFrame matter?

Hi, I noticed that sometimes when doing certain operations, the order of the columns in the DataFrame got changed automatically. Same thing happened when I tried out some examples in books. Using the ...
new_to_python Data Science 11 6,152 Feb-12-2020, 04:11 PM
    Thread: Why replace treats an integer value 999 as 999.0?
Post: RE: Why replace treats an integer value 999 as 999...

(Feb-11-2020, 02:54 PM)DeaD_EyE Wrote: import struct def double_to_bin(value): """ Convert an float to double (64 bit) binary representation Please check here: http://www.binaryconvert...
new_to_python General Coding Help 10 4,462 Feb-11-2020, 07:49 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020