Linked Questions
27 questions linked to/from How do I get the row count of a Pandas DataFrame?
0
votes
0
answers
56
views
How do I use the .count() function so that it gives me the sample variance of column 'Y'? As of now it giving me a list with the same value(s) [duplicate]
I am working on an assignment that is meant to help me familiarize myself with pandas, and the portion I am stuck on wants me to find the sample variance of Y. It says I must draft the Python/Pandas ...
171
votes
21
answers
403k
views
How to obtain the total numbers of rows from a CSV file in Python?
I'm using python (Django Framework) to read a CSV file. I pull just 2 lines out of this CSV as you can see. What I have been trying to do is store in a variable the total number of rows the CSV also.
...
244
votes
9
answers
98k
views
What's the difference between a Python "property" and "attribute"?
I am generally confused about the difference between a "property" and an "attribute", and I can't find a great resource to concisely detail the differences.
134
votes
11
answers
241k
views
start index at 1 for Pandas DataFrame [duplicate]
I need the index to start at 1 rather than 0 when writing a Pandas DataFrame to CSV.
Here's an example:
In [1]: import pandas as pd
In [2]: result = pd.DataFrame({'Count': [83, 19, 20]})
In [3]: ...
39
votes
6
answers
272k
views
pandas python how to count the number of records or rows in a dataframe
Obviously new to Pandas. How can i simply count the number of records in a dataframe.
I would have thought some thing as simple as this would do it and i can't seem to even find the answer in ...
19
votes
4
answers
906
views
How to concat multiple Pandas DataFrame columns with different token separator?
I am trying to concat multiple Pandas DataFrame columns with different tokens.
For example, my dataset looks like this :
dataframe = pd.DataFrame({'col_1' : ['aaa','bbb','ccc','ddd'],
...
11
votes
1
answer
2k
views
How to interpret the returned string of timeit
The following:
timeit print("foo")
returns something like: 100000 loops, best of 3: 2.35 µs per loop. I guess the 100000 relates to number argument of timeit. I don't understand what is best of 3 ...
3
votes
1
answer
7k
views
Groupby and count() with alias and 'normal' dataframe: python pandas versus mssql
Coming from a SQL environment, I am learning some things in Python Pandas. I have a question regarding grouping and aggregates.
Say I group a dataset by Age Category and count the different ...
4
votes
1
answer
3k
views
TypeError: object of type 'generator' has no len()
How could i fix this error:
TypeError: object of type 'generator' has no len()
Thanks!
for index, row in df_result.iterrows():
if index == 0:
tempIndex = 0
else:
if row['LEADID'] == df_result....
7
votes
3
answers
1k
views
Identifying statistical outliers with pandas: groupby and reduce rows into different dataframe
I'm trying to understand how to identify statistical outliers in groups of dataframe. I will need to group the rows by the conditions and then reduce those groups into a single row and later find the ...
0
votes
1
answer
5k
views
How to calculate the number of rows of a dataframe efficiently? [duplicate]
I have a very large pyspark dataframe and I would calculate the number of row, but count() method is too slow. Is there any other faster method?
-1
votes
1
answer
2k
views
TypeError: 'numpy.int64' object is not callable, whenever I call len function in python?
whenever I try to use len function in my code I get this error ?
long_trade={}
short_trade={}
long_trade['total_long']=get_total_long(long_df,len(long_df))
short_trade['total_short']=get_total_short(...
1
vote
1
answer
1k
views
How can we sample from a large data in PySpark quickly when we don't the the size of dataframe?
I have two pyspark dataframe tdf and fdf, where fdf is extremely larger than tdf. And the sizes of these dataframes are changing daily, and I don't know them. I want to randomly pick data from fdf to ...
0
votes
3
answers
2k
views
using pandas to find length of a column with given range
so im trying to use pandas instead of a for loop to count the number of movies in a given range of year. Assume by data frame has 2 columns and 'year' is the column name at column 2
I solved it using ...
0
votes
1
answer
1k
views
Simple Pandas DataFrame read_csv then GroupBy with Count / KeyError
I'm just trying to get a count of rows for a values in a given column, for example:
CSV Data:
'Occupation','data'
'Carpenter','data1'
'Carpenter','data2'
'Carpenter','data3'
'Painter','data1'
'Painter'...