Questions tagged [pandas]
Pandas is a Python library for data manipulation and analysis, e.g. dataframes, multidimensional time series and cross-sectional datasets commonly found in statistics, experimental science results, econometrics, or finance. Pandas is one of the main data science libraries in Python.
pandas
288,238
questions
1
vote
1
answer
32
views
Apply sklearn logloss with rolling on pandas dataframe
My function call looks something like
loss = log_loss(y_true=validate_d['y'], y_pred=validate_probs, sample_weight=validate_df['weight'], normalize=True)
Is there any way to combine this with pandas ...
-2
votes
1
answer
48
views
trying to find out the logic of this page: approx ++ 100 results stored - and parsed with Python & BS4
trying to find out the logic that is behind this page:
we have stored some results in the following db:
https://www.raiffeisen.ch/rch/de/ueber-uns/raiffeisen-gruppe/organisation/raiffeisenbanken/...
1
vote
1
answer
22
views
finding the minimum value of matched rows between two dataframes
I have Two data frames
import pandas as pd
exam_1 = pd.DataFrame({'user': ['A', 'B', 'C'],
'marks': [10, 50, 40]})
exam_2 = pd.DataFrame({'user': ['A', 'C', 'D'],
...
0
votes
2
answers
71
views
What is the best practice to calculate global frequency of list of elements with exact orders in python within multiple pandas dataframe?
Let's say I have the following datafarme df1 corresponding to user1:
+-------------------+-------+--------+-------+-------+----------+----------------+
| Models | MAE | MSE | RMSE | ...
-2
votes
1
answer
60
views
Can I drop a row twice? [closed]
I want to drop rows with outliers in two different columns, and some of the outliers are present in both columns, so after I drop them in the first column, it drops them fine, but when I try to drop ...
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
30
views
trying to apply a bs4-approach to wikipedia-page: results do not store in a df
due to the fact that scraping on Wikipedia is a very very common technique - where we can use an appropiate approach to work with many many different jobs - i did have some issues with getting back ...
0
votes
0
answers
15
views
Reading xls file from Japan METI statistics using Python
I want to access xls sheets on METI's website. But none of the usual methods work. Taking this webpage:
https://www.enecho.meti.go.jp/statistics/petroleum_and_lpgas/pl007/results.html
and this file
...
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
34
views
Extract a JSON from an API and I need to extract into different dataframes all information
In the JSON, I have information within each main object, which includes sub-objects and lists of objects with more details.
"ns0:sfobject": {
"@xmlns:ns0": "urn:...
0
votes
0
answers
64
views
Sorting a DataFrame by Multiple Conditions in Pandas
I'm struggling with a specific sort that I'm not managing to implement in Python.
Here's a sample dataframe
import pandas as pd
data = {
'product': ['A', 'A', 'A', 'B', 'B', 'B'],
'quantity': ...
0
votes
1
answer
37
views
dataframe plot histogram boundary bins
bins = [x for x in range(-10, 11)]
df['val'].plot(kind='hist', bins=bins)
I want to put all the out-range values >10 or <-10 into the boundary right/left bin but not change their widths. btw ...
0
votes
0
answers
40
views
Error in converting pandas dataframe into spark dataframe
I'm encountering an issue in Jupyter Notebook when working with Pandas and Spark on Kubernetes (k8s). Here's the sequence of steps I follow:
Create a Pandas DataFrame.
Create a Spark session ...
-1
votes
0
answers
29
views
Getting error TypeError: unsupported operand type(s) for /: 'str' and 'float' while using vwap from pandas_ta in python
I am using following versions
numpy 2.0.1
pandas 2.2.2
pandas_ta 0.3.14b0
python 3.11.14
For calculating vwap i am trying code
oneMinDF1['vwap'] = ta.vwap(oneMinDF1.inth, oneMinDF1.intl, oneMinDF1....
3
votes
1
answer
39
views
How to plot justify bar labels to the right side and add a title to the bar labels in Python's matplotlib?
I have created a chart in matplotlib in python, but the last line in the following code doesn't allow alignment of the bar labels outside of the graph.
import matplotlib.pyplot as plt
g=df.plot.barh(x=...