All Questions
21,250
questions
0
votes
0
answers
20
views
Pandas check if a column has NaT type, unable to find date diff with NaT values [duplicate]
I have StartDate and ExitDate two columns in my dataframe with NaT values in ExitDate column
I wish to create a third column Tenure by finding Difference between ExitDate and StartDate.
StartDate ...
0
votes
1
answer
30
views
Efficient calculation of volatility using EWMA
I am trying to calculate the volatility using EWMA (Exponentially Weighted Moving Average).
Here is the function I developed:
def ewm_std(x, param=0.99):
n = len(x)
coefs = param ** np.arange(...
0
votes
1
answer
36
views
Update data in json kept in excel sheet with python
I have an Excel sheet that has json stored in on of it's cells. Sheet has multiple rows, but every json is in one column.
I need a way to replace some of the elements of that json, and save it back as ...
0
votes
1
answer
42
views
Change y axis scaling on a Seaborn Heatmap
I am at the final stage of displaying a heatmap within a facetgrid. When I am presenting the data, some of the index values may or may not be present for the row / column combination. I would like to ...
-4
votes
1
answer
54
views
Numpy reshape issue: ValueError: cannot reshape array
I'm trying to implement linear regression on the California housing dataset, and I'm reading data as below:
data = pd.read_csv(r'C:\Users\California_Houses.csv',header=None)
print(data.shape)
output: (...
0
votes
0
answers
92
views
How to solve Pandas/Numpy error in Python?
EDIT: Ok so the problem might be that I haven't removed the old python env when I updated with the new version.
I've seen that I do have a "C:\users...\Python311" and a "C:\users...\...
0
votes
1
answer
36
views
Pandas apply is turning matrices into nan/None
I am running the following code on a dataset trying to tally the rows from one data set that match a varied set of criteria. I am using the apply function to store this tally inside of a matrix, where ...
0
votes
2
answers
68
views
How to combine type hint using bound type variable and static types for maximum flexibility?
I would like to add type hints to a simple function. Since it internally only uses numpy calls, it is very flexible with its inputs. Basically, it accepts all array-like objects, for which there is ...
0
votes
1
answer
53
views
What is the meaning of: Pandas data cast to numpy dtype of object. Check input data with np.asarray(data) and how can be solved?
I'm trying to model a time series for a stock price with the following code:
import opendatasets as od
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots ...
0
votes
0
answers
20
views
read parquet file in dask and convert them to correct numpy shape
I am reading a parquet file in dask and trying to reshape it to how I want it, but it seems rather impossible (I am quite new to dask too).
So, I have a parquet file which has some 8M x 384d numpy ...
1
vote
1
answer
60
views
Panda's value_counts() method counting missing values inconsistently
Please consider this simple dataframe:
df = pd.DataFrame({'x': [1, 2, 3, 4, 10]}, index = range(5))
df:
x
0 1
1 2
2 3
3 4
4 10
Some indices:
ff_idx = [1, 2]
sd_idx= [3, 4]
One way of ...
0
votes
0
answers
16
views
Python flask application is not working properly on Apache 24 in windows
I am using Python 3.8.10 with Apache(2.4.59) and mod_wsgi(4.9.4)on windows10. When running my application, the API requests go into a pending state. After troubleshooting with print statements, I ...
0
votes
0
answers
22
views
Synthetic Data Vault MultiTableMetadata and get_column_pair_plot
I need help about using get_column_pair_plot because I have difficulty on understanding how to use MultiTableMetadata. Consider the following data :
import numpy as np
import pandas as pd
from sdv....
1
vote
0
answers
78
views
Optimize loops in Numpy correlation matrices
I have a piece of code to calculate price sensitivity based on the product and its rating.
Below is the original data set with product type, reported year, customer’s rating, price per unit, and ...
0
votes
0
answers
77
views
Add new rows to dataset in nested for loop
The following script works when data4 is used to create dataframe, hours_date_match_barc. It breaks when I want to use data3 and I believe it is because it is not able to add more rows to out.
...