series Questions
3
Solved
I have a dataframe that has a field called fields which is a list of dicts (all rows have the same format). Here is how the dataframe is structured:
formId fields
123 [{'number': 1, 'label': 'Last...
3
Solved
There is a great solution in R.
My df.column looks like:
Windows
Windows
Mac
Mac
Mac
Linux
Windows
...
I want to replace low frequency categories with 'Other' in this df.column vector. For exam...
Unfriendly asked 21/11, 2017 at 16:43
2
Solved
I understand Polars Series can be exported to a Python list. However, is there any way I can convert a Polars Dataframe to a Python list?
In addition, if there is a one single column in the Polars ...
Miranda asked 21/2, 2023 at 19:57
4
Solved
Consider my series as below: First column is article_id and the second column is frequency count.
article_id
1 39
2 49
3 187
4 159
5 158
...
16947 14
16948 7
16976 2
16977 1
16978 1
1...
Chatter asked 29/5, 2016 at 20:32
6
Trying to add a new row of type Series into a DataFrame, both share the same columns/index:
df.loc[df.shape[0]] = r
Getting:
FutureWarning: In a future version, object-dtype columns with all-bool...
2
Solved
I have a large dataset which I have to convert to .csv format, it consists of 29 columns and 1M+ lines. I figured that as the dataframe gets larger, appending any rows to it is getting more and mor...
Tunny asked 12/7, 2019 at 5:54
7
Solved
I have a list of tuples which I want to convert to a Series.
return array2
[(0, 0.07142857142857142),
(0, 0.07142857142857142),
(1, 0.08333333333333333),
(1, 0.3333333333333333),
(1, 0.33333...
Alton asked 18/11, 2018 at 17:34
3
Solved
Hi I'm still learning pandas and numpy in python
I learn from e-learning that you could combine 2 series with append but when I tried it It give me error
students_classes = pd.Series({'Alice': 'Phy...
Bergeron asked 25/4, 2023 at 14:43
3
Solved
Can i understand why the str.startswith() is not dealing with Regex :
col1
0 country
1 Country
i.e : df.col1.str.startswith('(C|c)ountry')
it returns all the values False :
col1
0 False
1 Fa...
7
Solved
I have a pandas series series. If I want to get the element-wise floor or ceiling, is there a built in method or do I have to write the function and use apply? I ask because the data is big so I ap...
4
Solved
I want to add an integer to my pandas.Series
Here is my code:
import pandas as pd
input = pd.Series([1,2,3,4,5])
input.append(6)
When i run this, i get the following error:
Traceback (most rece...
4
Solved
I have the following when I print my data structure:
print(speed_tf)
44.0 -24.4
45.0 -12.2
46.0 -12.2
47.0 -12.2
48.0 -12.2
Name: Speed, dtype: float64
I believe this is a pandas Series but not...
3
Solved
I have a Pandas dataframe (countries) and need to get specific index value. (Say index 2 => I need Japan)
I used iloc, but i got the data (7.542)
return countries.iloc[2]
7.542
6
Solved
7
My function returns a pandas series, where all elements have a specific type (say str). The following MWE should give an impression:
import pandas as pd
def f() -> pd.Series:
return pd.Series(...
Ninepins asked 9/9, 2019 at 13:22
4
Solved
I am looking to use the replace function in an efficient way in python3. The code I have is achieving the task, but is much too slow, as I am working with a large dataset. Thus, my priority is effi...
2
Solved
While resampling, put NaN in the resulting value if there are some NaN values in the source interval
Example:
import pandas as pd
import numpy as np
rng = pd.date_range("2000-01-01", periods=12, freq="T")
ts = pd.Series(np.arange(12), index=rng)
ts["2000-01-01 00:02"] = np.nan
ts
2000-01-01 00...
8
Solved
I have a Pandas series sf:
email
[email protected] [1.0, 0.0, 0.0]
[email protected] [2.0, 0.0, 0.0]
[email protected] [1.0, 0.0, 0.0]
[email protected] [4.0, 0.0, 0.0]
[email&...
5
Solved
I have a series which has only one value and I want to get that value only. I ran a code to get the value by index matching and I got a series like this:
(normal_sum['KWH'][(normal_sum['KWH'].index...
4
Solved
I have a Series that looks like this:
1999-03-31 SOLD_PRICE NaN
1999-06-30 SOLD_PRICE NaN
1999-09-30 SOLD_PRICE NaN
1999-12-31 SOLD_PRICE 3.00
2000-03-31 SOLD_PRICE 3.00
with an index that looks l...
Previdi asked 4/9, 2013 at 21:23
1
Solved
Using pandas version 2, I get an error when calling iteritems.
for event_id, region in column.iteritems():
pass
The following error message appears:
Traceback (most recent call last):
File "...
2
Solved
I am trying to convert a column of timestamps (YYYY-MM-DD HH-MM-SS) from a pandas dataframe to seconds.
Here is my current code:
df['recorded_time'] = pd.to_datetime(df['recorded_time'])
df['timest...
Prescind asked 26/11, 2019 at 19:28
2
Solved
The following code will print True because the Series contains at least one element that is greater than 1. However, it seems a bit un-Pythonic. Is there a more Pythonic way to return True if a Ser...
Hero asked 8/12, 2015 at 5:42
3
Solved
In my script I have df['Time'] as shown below.
497 2017-08-06 11:00:00
548 2017-08-08 15:00:00
580 2017-08-10 04:00:00
646 2017-08-12 23:00:00
Name: Time, dtype: datetime64[ns]
But when i do
t...
2
Solved
I have 2 Series, given by:
import pandas as pd
r = pd.Series([i*3 for i in range(0, 10)], name='rrr')
s = pd.Series([i*5 for i in range(0, 10)], name='sss')
How to I create a DataFrame from them?
...
Zipporah asked 9/10, 2016 at 7:55
1 Next >
© 2022 - 2025 — McMap. All rights reserved.