Giter VIP home page Giter VIP logo

pandas-videos's Introduction

Welcome to Data School!

My name is Kevin Markham, and I've taught Data Science in Python to over a million students.

My tutorials explain Data Science topics in a clear, thorough, and step-by-step manner.

I'd love to teach you, regardless of your educational background or professional experience.

If you're ready to learn Data Science and start your new career, I'd love for you to join me! ๐Ÿš€

Here's how to get started (for free):

  1. Sign up for my "Tuesday Tips" newsletter - I'll help you get better at Data Science every week!
  2. Enroll in one of my online courses - I can teach you Python or Machine Learning!
  3. Check out my catalog of resources - I've got tutorials on a dozen Data Science topics!

Let's connect:

pandas-videos's People

Contributors

justmarkham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandas-videos's Issues

Converting pandas.Timestamp into date only by removing timestamp

You've made a good video but you missed this one thing to explain. Actually the situation is in below code.

class NumpyEncoder(DjangoJSONEncoder):
    def default(self, obj):
        if isinstance(obj, np.ndarray):
            return obj.tolist()
        elif isinstance(obj, pd.Timestamp):
            return str(obj)

    return super().default(obj)
with pd.ExcelFile(default_storage.open(path)) as xls:
    sheet_names = xls.sheet_names
    sheets_df = [pd.read_excel(xls, sheet_name, header=None)
                 for sheet_name in sheet_names]
    worksheets_columns = [list(sheet_df.columns) for sheet_df in sheets_df]
    worksheets_data = [json.loads(json.dumps(
        sheet_df.fillna('').applymap(str).to_numpy(), cls=NumpyEncoder))
                       for sheet_df in sheets_df]

I need to convert pandas.Timestamp in the situation above to date only. Currently shows timestamp also.

Thanks in advance.

Notebook in text format

Hi,

I just created my account in Github, pardon the simple question.

Is it possible to download the notebooks that you have provided in text format?

Here's the link of the one I'm looking at:
http://nbviewer.jupyter.org/github/justmarkham/pandas-videos/blob/master/pandas.ipynb#25.-How-do-I-work-with-dates-and-times-in-pandas%3F-%28video%29

I'm planning to work with the notebooks without having to type the code one by one.
If it's possible to do this please teach me how! Thank you!

How to add a new time column with new calculated time data?

Hi Just Markham,

I want to add +8 hours to all the existing times and save it to a new column in the DataFrame. I only figured out how to create a new column. But I don't know how to add my delta time to the new time data.

Electronically yours,
Mr. Biggles

from datetime import timedelta
import pandas as pd

ufo = pd.read_csv('http://bit.ly/uforeports')

print("")
ufo['Time'] = pd.to_datetime(ufo.Time)
print(ufo)

print("")
print("_______________________________________________________________________")
print("")

print("ufo.dtypes")
print(ufo.dtypes)

print("")
print("_______________________________________________________________________")
print("")

# Add a new column with new data.

delta = timedelta(hours=-8)
# calc_utc_time = data_cell + delta

ufo['utc_time'] = ufo.Time
print(ufo)

print("")
print("_______________________________________________________________________")
print("")

print("ufo.dtypes")
print(ufo.dtypes)

print("")
print("_______________________________________________________________________")
print("")

How to remove the text Timestamp when saving DataFrame as Dictionary?

Hi Sensei Markham, @justmarkham

I need to save my DataFrame as Dictionary in order to push my data into my database using Flask SQLAlchemy. But even when I change the DataType for column Time from Datetime to Object. My dictionary variable still contains the text Timestamp, how can I remove this text and parenthesis characters from my dictionary?

ufo_dict_2

{0: {'City': 'Ithaca', 'Colors Reported': nan, 'Shape Reported': 'TRIANGLE', 'State': 'NY', 'Time': Timestamp('1930-06-01 22:00:00')}}

.

x13_change_DataType_for_Series.py

import pandas as pd

#_______________________________________________________________________________

ufo = pd.read_csv('http://bit.ly/uforeports')

print(ufo.head())
print("")
print(type(ufo))
print("")
print("ufo.dtypes")
print(ufo.dtypes)

print("")
print("_______________________________________________________________________")
print("")

#_______________________________________________________________________________

# Convert Time datatype from Object to Datetime.

ufo['Time'] = pd.to_datetime(ufo.Time)

print(ufo.head())
print("")
print(type(ufo))
print("")
print("ufo.dtypes")
print(ufo.dtypes)

print("")
print("_______________________________________________________________________")
print("")

#_______________________________________________________________________________

# Convert DataFrame to Dictionary.

ufo_dict_1 = ufo.to_dict('index')

print("ufo_dict_1")
print("")
print(dict(list(ufo_dict_1.items())[0:3]))
print("")
print(type(ufo_dict_1))

print("")
print("_______________________________________________________________________")
print("")

#_______________________________________________________________________________

# Convert Time datatype from Datetime to Object.

ufo['Time'] = ufo.Time.astype(object)

print(ufo.head())
print("")
print(type(ufo))
print("")
print("ufo.dtypes")
print(ufo.dtypes)

print("")
print("_______________________________________________________________________")
print("")

#_______________________________________________________________________________

# Convert DataFrame to Dictionary.

ufo_dict_2 = ufo.to_dict('index')

print("ufo_dict_2")
print("")
print(dict(list(ufo_dict_2.items())[0:3]))
print("")
print(type(ufo_dict_2))

print("")
print("_______________________________________________________________________")
print("")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.