Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

dataframe

python pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working

August 16, 2022 by Magenaut

I import a dataframe via read_csv, but for some reason can’t extract the year or month from the series df['date'], trying that gives AttributeError: 'Series' object has no attribute 'year':

Categories Python, Q&A Tags dataframe, datetime, extract, pandas, python Leave a comment

selecting from multi-index pandas

August 16, 2022 by Magenaut

I have a multi-index data frame with columns ‘A’ and ‘B’.

Categories Python, Q&A Tags dataframe, multi-index, pandas, python Leave a comment

Pandas DataFrame stack multiple column values into single column

August 16, 2022 by Magenaut

Assuming the following DataFrame:

Categories Python, Q&A Tags dataframe, melt, pandas, python Leave a comment

Python – How to convert JSON File to Dataframe

August 16, 2022 by Magenaut

How can I convert a JSON File as such into a dataframe to do some transformations.

Categories Python, Q&A Tags dataframe, json, pandas, python Leave a comment

Pandas select rows and columns based on boolean condition

August 16, 2022 by Magenaut

I have a pandas dataframe with about 50 columns and >100 rows. I want to select columns 'col_x', 'col_y' where 'col_z' < m. Is there a simple way to do this, similar to df[df['col3'] < m] and df[['colx','coly']] but combined?

Categories Python, Q&A Tags conditional, dataframe, pandas, python Leave a comment

Pandas dataframe fillna() only some columns in place

August 16, 2022 by Magenaut

I am trying to fill none values in a Pandas dataframe with 0’s for only some subset of columns.

Categories Python, Q&A Tags dataframe, pandas, python Leave a comment

How to convert column with list of values into rows in Pandas DataFrame

August 16, 2022 by Magenaut

Hi I have a dataframe like this:

Categories Python, Q&A Tags dataframe, pandas, python Leave a comment

Dataframe set_index not setting

August 16, 2022 by Magenaut

I have a dataframe and am trying to set the index to the column ‘Timestamp’. Currently the index is just a row number. An example of Timestamp’s format is: 2015-09-03 16:35:00

Categories Python, Q&A Tags dataframe, pandas, python Leave a comment

Remove reverse duplicates from dataframe

August 16, 2022 by Magenaut

I have a data frame with two columns, A and B. The order of A and B is unimportant in this context; for example, I would consider (0,50) and (50,0) to be duplicates. In pandas, what is an efficient way to remove these duplicates from a dataframe?

Categories Python, Q&A Tags dataframe, pandas, python Leave a comment

SQL-like window functions in PANDAS: Row Numbering in Python Pandas Dataframe

August 16, 2022 by Magenaut

I come from a sql background and I use the following data processing step frequently:

Categories Python, Q&A Tags dataframe, numpy, pandas, python Leave a comment
Older posts
Newer posts
← Previous Page1 … Page23 Page24 Page25 … Page36 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress