series Questions
2
Solved
accounts = pd.read_csv('C:/*******/New_export.txt', sep=",", dtype={'number': object})
accounts.columns = ["Number", "F"]
for i, j in accounts["Number"].ite...
Amur asked 4/3, 2019 at 20:25
10
Solved
How to convert an index of a dataframe into a column?
For example:
gi ptt_loc
0 384444683 593
1 384444684 594
2 384444686 596
to
index1 gi ptt_loc
0 0 384444683 593
1 1 384444684 594
...
11
Solved
Is there a way to do this? I cannot seem an easy way to interface pandas series with plotting a CDF.
10
Solved
I have a Pandas Series of lists of strings:
0 [slim, waist, man]
1 [slim, waistline]
2 [santa]
As you can see, the lists vary by length. I want an efficient way to collapse this into one series
...
1
Solved
I had a hard time finding the answer for such simple question. I was stuck at trying to use "append", "extend" or other methods.
Finally I found/realized that the with_column me...
Nadabb asked 28/1, 2023 at 8:51
13
I use pandas.to_datetime to parse the dates in my data. Pandas by default represents the dates with datetime64[ns] even though the dates are all daily only.
I wonder whether there is an elegant/cle...
7
Solved
I have a CSV file formatted as follows:
somefeature,anotherfeature,f3,f4,f5,f6,f7,lastfeature
0,0,0,1,1,2,4,5
And I try to read it as a pandas Series (using pandas daily snapshot for Python 2.7).
...
2
I have a Pandas DataFrame where one column is a Series of dicts, like this:
colA colB colC
0 7 7 {'foo': 185, 'bar': 182, 'baz': 148}
1 2 8 {'foo': 117, 'bar': 103, 'baz': 155}
2 5 10 {'foo...
Louisalouisburg asked 24/1, 2019 at 10:12
3
Solved
I have a dataframe like this:
df1 = pd.DataFrame({'col1' : ['cat', 'cat', 'dog', 'green', 'blue']})
and I want a new column that gives the category, like this:
dfoutput = pd.DataFrame({'col1' ...
Pullet asked 4/1, 2019 at 0:49
2
Solved
Struggling to understand the difference between the 5 examples in the title. Are some use cases for series vs. data frames? When should one be used over the other? Which are equivalent?
6
Solved
I want to check every column in a dataframe whether it contains only numeric data. Specifically, my query is not about the datatype, but instead, I want to check every value in each column of the d...
4
I have a pandas series with boolean entries. I would like to get a list of indices where the values are True.
For example the input pd.Series([True, False, True, True, False, False, False, True])
...
Tile asked 4/9, 2018 at 19:53
11
Solved
I use Pandas 'ver 0.12.0' with Python 2.7 and have a dataframe as below:
df = pd.DataFrame({'id' : [123,512,'zhub1', 12354.3, 129, 753, 295, 610],
'colour': ['black', 'white','white','white',
'b...
7
Solved
I have the following df :
import pandas as pd
from datetime import datetime, timedelta
df = pd.DataFrame([
["A", "2018-08-03"],
["B", "2018-08-20"]
])
df.columns = ["Item", "Date"]
I want to ...
2
/opt/conda/lib/python3.7/site-packages/ipykernel_launcher.py:8: FutureWarning: Automatic reindexing on DataFrame vs Series comparisons is deprecated and will raise ValueError in a future version. D...
4
Solved
Given the following Panda series:
>>>series = pd.Series([1, 2, 3], index=["a", "b", "c"])
>>>series
a 1
b 2
c 3
dtype: int64
Is there a way to produce this?
>>>series...
3
Solved
When I run the below code, it gives me an error saying that there is attribute error: 'float' object has no attribute 'split' in python.
I would like to know why this error comes about.
def text...
Tannertannery asked 10/10, 2018 at 9:26
7
Solved
I have some data I'm trying to organize into a DataFrame in Pandas. I was trying to make each row a Series and append it to the DataFrame. I found a way to do it by appending the Series to an empty...
Barbarese asked 13/10, 2015 at 4:20
36
Solved
I was having issues in printing a series of prime numbers from one to hundred. I can't figure our what's wrong with my code.
Here's what I wrote; it prints all the odd numbers instead of primes:
...
8
Solved
I'm somewhat new to pandas. I have a pandas data frame that is 1 row by 23 columns.
I want to convert this into a series. I'm wondering what the most pythonic way to do this is?
I've tried pd.Serie...
0
There was a great question and answer about the difference between pandas Series str.replace() and replace() method:
stackoverflow.com/difference
I wanted to expand on this and ask - why not always...
Dunston asked 12/6, 2022 at 10:8
3
Solved
Hope you could help me. I am new to python and pandas, so please bear with me. I am trying to find the common word between three data frames and I am using Jupiter Notebook.
Just for example:
df1...
Sauerbraten asked 4/10, 2017 at 2:39
7
Solved
I have a data frame where most of the columns are varchar/object type. Length of the column varies a lot and could be anything within the range of 3 - 1000+ . Now, for each column, I want to measur...
Pinette asked 14/5, 2018 at 21:11
8
Solved
In Pandas, when I select a label that only has one entry in the index I get back a Series, but when I select an entry that has more then one entry I get back a data frame.
Why is that? Is there a ...
2
Solved
I have the following panda Series:
print(df.head())
Country Energy Supply Energy Supply per Capita % Renewable
0 Afghanistan 3.210000e+08 10 78.669280
1 Albania 1.020000e+08 35 100.000000
2 Alger...
© 2022 - 2025 — McMap. All rights reserved.