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,144
questions
1
vote
2
answers
41
views
How To Find Users Who Appear Each Day In Data Set
I'm fairly new to pandas and struggling to understand how to use it to allow me to better understand user behavior in my dataset. For each day in my dataset users may have an entry indicating they ...
0
votes
1
answer
41
views
AttributeError: module 'numpy' has no attribute 'concat'
I have written some simple code to iterate through a group of lists I am analyzing, and I discovered this error - module 'numpy' has no attribute 'concat', in this case would there be a solution?
I'm ...
-1
votes
0
answers
40
views
Not All Values in Dataset getting Replaced
I was working with a dataset where categorization for Education an individual was categorized by number (e.g. 3 for an associate degree). For easier categorization, I decided to change each number to ...
0
votes
0
answers
43
views
pd.Timestamp() behavior in Pandas
Trying to understand why t1 takes current date whereas t2 takes the epoch date in Pandas in Python. Any thoughts would help.
import pandas as pd
t1 = pd.Timestamp("23:12:05")
print("t1:...
-5
votes
0
answers
42
views
Using python, how to create repetitive work schedules [closed]
It is our company's group work schedule. As a three-shift work, group 2 works day and night, and group 1 is off. The schedule of working the daytime for 4 days and day off for 2 days, then working the ...
0
votes
1
answer
39
views
Groupby and Transform and Regression
I am trying to get the residuals from a simple regression. This regressions is run by each Year and Group. This is what I have done. Howevevr, is there a way to get that residuals as a new columns ...
0
votes
1
answer
51
views
Sampling in python with multiple conditions and percentages
Person ID
Condition 1
Condition 2
Condition 3
A
Yes
No
Yes
B
No
Yes
No
C
Yes
No
No
Hi! I have to generate a sample from a fairly large dataset, and the inclusion criteria are a little more ...
0
votes
1
answer
51
views
Pandas Flatten Row When Doing Groupby
I have a Pandas dataframe that has address and contact information. The rows are on occasion duplicated because there are different values in the respective contact information (the address ...
4
votes
2
answers
54
views
How to add legend to df.plot/legend not showing up df.plot()
I am currently creating a scatter plot with the results of some evaluation I am doing.
To get a dataframe of the same structure as mine you can run:
import pandas as pd
models = ["60000_25_6&...
1
vote
1
answer
53
views
How do you create a pivot table group by Date and perfom calculation on 2 values in pandas
I have this data frame:
df
Node Interface Speed Band_In carrier Date
Server1 wan1 100 80 ATT 2024-06-01
Server1 wan2 100 60 Sprint ...
1
vote
2
answers
54
views
Pandas Map Dictionary with Multiple Values to Dataframe
I have the following dataframe:
data = [['BALANCED', 'Corp EUR'], ['YIELD', 'Corp USD'], ['GROWTH', 'HG CHF']]
df = pd.DataFrame(data, columns=['STRATEGY', 'ASSET_CLASS']
df
STRATEGY ...
1
vote
0
answers
36
views
pandas to_csv adding extra escape character to path
I am generating a csv file in pandas using this code:
current_working_directory = os.getcwd()
path2 = 'Documents'
current_datetime = datetime.now()
filename = f"python_df_{current_datetime}.csv&...
0
votes
0
answers
29
views
Slow execution while Filtering and Selecting Columns in Dask DataFrame Using query() and compute()
I'm working with a large Dask DataFrame (data) and I need to filter rows based on a specific ID (id12) in the column named 'ID'. Additionally, I want to select only two columns ('col1' and 'col2') ...
0
votes
0
answers
20
views
Xarray failing to save NetCDF due to illegal characters
I have a DataFrame in python. Using "df.to_excel('temp/df.xlsx')" i have exported it, here is a screenshot of the resulting file in Excel:
This exists in python as a Pandas DataFrame.
I ...
0
votes
0
answers
30
views
How to right align numbers in a table created from a dataframe using quarto and pdf?
I am using pandas in a jupyter notebook and I would like to export my notebook in a pdf document using quarto. Everything work except the alignment of numbers in the table. If you have positive and ...