All Questions
53 questions
0
votes
0
answers
99
views
Column value update issue
import pandas as pd
import numpy as np
from itertools import combinations
data = {'FFC': [200, 52880],
'CLUB': [0, 0],
'PBC': [200, 0],
'ESC': [200, 0],
'LPLC': [250, 0],
'FPLC': [...
0
votes
1
answer
52
views
Incorrect behavior of Spyder or Pandas when calling function DataFrame.info()
I'm using Spyder. Creating some dataframe with Pandas:
import pandas as pd
import numpy.random as npr
npr.seed(0)
df = pd.DataFrame(npr.randint(1, 10, size=(3,4)))
I get a strange behavior when using ...
0
votes
1
answer
48
views
I'm getting strange, repeated results using spaCy and pandas
I'm making a bot that solves the New York Times "Connections" game. I'm trying to make a matrix that has the cosine similarities of words so that I can check to see which ones are most ...
-1
votes
1
answer
53
views
Python function for plotting distributions works with one DataFrame but not another - no output or error
I have the following python function to make graphs.
def plot_distributions(dataframe, title=None):
# Set the style of seaborn
sns.set(style="whitegrid")
# Plotting ...
-1
votes
1
answer
130
views
Debugging a very large dataframe in pandas using Jupyter Notebool
I have a csv file with a column 'record' that has dictionaries (variable sized) as values and they are saved as 'str'. I read the file in a dataframe and am trying to get the dictionary keys separated ...
0
votes
0
answers
282
views
Backtrader library not properly calculating trades
I am using backtrader in python to use for my strategy. I already tried printing the parts where the errors might have occured but I still haven't figured this out.
The title might be wrong as well ...
2
votes
1
answer
366
views
Using map to convert pandas dataframe to list
I am using map to convert some columns in a dataframe to list of dicts. Here is a MWE illustrating my question.
import pandas as pd
df = pd.DataFrame()
df['Col1'] = [197, 1600, 1200]
df['Col2'] = [...
0
votes
0
answers
100
views
Why pandas cannot read my column name in excel? How to solve this problem?
Traceback (most recent call last):
File "<ipython-input-51-afc09c056d5a>", line 1, in <module>
runfile('C:/Users/Jamie Tsoi/OneDrive/Desktop/FYP/office hourly.py', wdir='C:...
0
votes
1
answer
40
views
Pandas list comparison giving value error
I have a dataframe I generate by using
df = qr_actions.get_pandas_df(query)
and then generate a list of the rows using rows = [r[1] for r in df.iterrows()] and am trying to compare it to another list ...
1
vote
1
answer
44
views
the else block in the following code isn't working and only the if statement is being executed to calculate the volume. What is going wrong?
def volume(df):
for i in range(len(df['depth'])):
if df['depth'][i] > 60 :
df['volume']=df['x']*df['y']*df['z']
else:
df['volume'] = 8
return df
I am working to calculate volume of a ...
0
votes
1
answer
83
views
Bypassing and printing out the name of an Error in a Loop - Python [duplicate]
Although I know it is not good practice to bypass an error, I'm trying to figure out in which of the data sets that I am working one, I get an error.
I am looping through all of the Data Sets, and ...
1
vote
0
answers
2k
views
TypeError: join() takes no keyword arguments
I'm trying to concatenate a list of columns based on a condition inside a class. I tried this piece of code outside the class
df1[col_list].astype(str).apply("_".join,axis=1)and it is ...
0
votes
0
answers
199
views
Enter Python debugger on an exception ignored by a library
I have introduced a bug in some complicated code which is noisily swallowed by some library code I don't want to learn about:
In [212]: start = time() ; result = big_messy_thing() ; stop = time() ; ...
2
votes
1
answer
640
views
How do you place a breakpoint inside a python package?
I'm working on contributing open source to the pandas package inside python. When I run import pandas as pd, it points to the installed version of python.
Wondering the best way to import the local ...
0
votes
0
answers
222
views
UnicodeDecodeError again: 'utf-8' when debugging Python files in PyCharm Community
Current conclusion:
The encoding of the converted file is utf-8->utf-8 big->ansi -> utf-8. Reopen the file after each conversion.
After observing for a period of time, there is no such error.
...